[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: is operator

Matt Nordhoff

3/10/2008 9:35:00 AM

Metal Zong wrote:
> The operator is and is not test for object identity: x is y is true if
> and only if x and y are the same objects.
>
>>>> x = 1
>>>> y = 1
>>>> x is y
> True
>
> Is this right? Why? Thanks.

I believe Python automatically creates and caches int objects for 0-256,
so whenever you use them, they refer to the same exact objects. Since
ints are immutable, it doesn't matter.
--
4 Answers

Aaron Brady

3/10/2008 9:48:00 AM

0

> I believe Python automatically creates and caches int objects for 0-256,
> so whenever you use them, they refer to the same exact objects. Since
> ints are immutable, it doesn't matter.

One of the biggest hits on start-up time, by the way. ;)

Matt Nordhoff

3/10/2008 10:11:00 AM

0

castironpi@gmail.com wrote:
>> I believe Python automatically creates and caches int objects for 0-256,
>> so whenever you use them, they refer to the same exact objects. Since
>> ints are immutable, it doesn't matter.
>
> One of the biggest hits on start-up time, by the way. ;)

Well, the developers clearly decided it was worth it at the time. Who
knows, perhaps that's changed since then.
--

John Machin

3/10/2008 10:58:00 AM

0

On Mar 10, 9:11 pm, Matt Nordhoff <mnordh...@mattnordhoff.com> wrote:
> castiro...@gmail.com wrote:
> >> I believe Python automatically creates and caches int objects for 0-256,
> >> so whenever you use them, they refer to the same exact objects. Since
> >> ints are immutable, it doesn't matter.
>
> > One of the biggest hits on start-up time, by the way. ;)
>
> Well, the developers clearly decided it was worth it at the time. Who
> knows, perhaps that's changed since then.
> --

Matt,
PDFTT.
Cheers,
John

82trooper

2/19/2011 3:21:00 PM

0

On Feb 17, 11:10 pm, Gundam_PIlot_ <cjrrn12...@yahoo.com> wrote:
> On Feb 17, 10:24 pm, Troy <tbanth...@yahoo.com> wrote:
>
>
>
>
>
> > On Feb 17, 7:26 pm, 82trooper <rak...@comcast.net> wrote:
>
> > > Hello again, while I am here, I thought I would ask this question,
> > > too....does anyone know of any good places to play pinball in
> > > Cleveland??  I am going there for a 4 day business trip/training
> > > session next month, and was wondering if anyone had any suggestions??
>
> > > Thanks again,
> > > Mike
>
> > On the SW side of Cleveland, you can stop by the Pinball Shoppe in
> > North Olmsted.  They will have a dozen or so machines in the shop for
> > sale.   They are used to people coming in and kicking the tires and
> > playing a few games.   They have a web site so you can see what they
> > have in stock.  Plus, it's at no charge to play :).   The Pinball
> > Shoppe also usually supplies 3 to 4 pins at Swings n Things which is
> > not far from them on Stearn Rd.   You can call and ask if they have
> > any there right now... it's been a year since I've been over there.
>
> > Swings-N-Things Family Fun Prk
> > (440) 235-4420
> > 8501 Stearns Rd, Cleveland, OH
>
> > On the east side, there is a bowling alley with about 3 pins including
> > Iron Man.   Unfortunately, I forgot which one.   I went there once to
> > check out Iron Man.
>
> > Troy
>
> The swings n things has a Revenge from mars, Ripleys believe it or
> not, southpark, bram strokers dracula, Striker Extreme, and a Lethal
> Weapon 3
> Theres a bar right next to swings n things right at the corner of
> sterns and bagley road Called Falls Caafe or something like that. Its
> right next to subway. They have a attack from mars.
> Yorktown bowling lanes on pearl road in parma has an AFM as well.
> Winking Lizard in Macedonia has a Medieval Madness
> 82 Bar N Grill in North royalton has a Junkyard
> Cleats on pearl road in parma (Old hooters restaurant)  has a Family
> guy
> Common Grounds in Westpark (Lorain Rd. + Rocky River Dr.) has a Tales
> of the crypt
> Cloverleaf bowling lanes in Independence has a Viper, and a couple
> other pins- Hide quoted text -
>
> - Show quoted text -

Thanks for the info!!!+