Home

Dick Moores wrote:
> On 8/12/07, *Ben Finney* <bignose+hates-spam@benfinney.id.au
> <mailto:bignose+hates-spam@benfinney.id.au>> wrote:
>
> Dick Moores <rdm@rcblue.com <mailto:rdm@rcblue.com>> writes:
>
> > At 06:13 PM 8/9/2007, Ben Finney wrote:
> > >it's entirely left to the language implementation which
> > >optimisation trade-offs to make, and the language user (that's you
> > >and I) should *not* expect any particular behaviour to hold between
> > >different implementations.
> >
> > I'm not clear on the meaning of "implementations" here. Would 2.5
> > for Windows, Mac, Linux all be different implementations? Would Iron
> > Python be another? ActivePython?
>
> For the purpose of the above statement, you should consider even the
> same Python on two different machines to be "different
> implementations". As a programmer writing Python code, you should not
> expect any "implementation-dependent" behaviour to operate in any
> particular way.
>
>
> So would a programmer EVER use "is" in a script?

Sure. For example, the canonical test for None uses

x is None

because there is only ever one instance of type Nonetype, so it's the
fastest test. Generally speaking you use "is" to test for identity (do
these two expressions reference the same object) rather than equality
(do these two expressions evaluate to equivalent objects).

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------

previous
next

Re: Seek the one billionth line in a file containing 3 billionlines.
Re: sorting a list numbers stored as strings
Urgent!!! UPGRADE METHODOLOGY
Tool for checking memory leaks.
Re: C++ Primer ex 6.20
Fundacja Avalon
Niechciane i Zapomniane
Fundacja Iskierka
Nasze Dzieci
Pajacyk