Finding the instance reference of an object

Benjamin Kaplan benjamin.kaplan at case.edu
Fri Oct 17 15:31:13 EDT 2008


On Fri, Oct 17, 2008 at 3:03 PM, Aaron Castironpi Brady <
castironpi at gmail.com> wrote:

> On Oct 17, 10:56 am, Joe Strout <j... at strout.net> wrote:
> > On Oct 16, 2008, at 11:23 PM, Dennis Lee Bieber wrote:
> snip
> > >    But, it seems, you are the only one arguing that "the semantics are
> > > all the same"... Doesn't that suggest that they aren't the same?
> >
> > No, it suggests to me that there's a lot of confusion in the Python
> > community.  :)  It appears as though people either (a) really want to
> > think that Python's object handling is special and unique for
> > emotional reasons, or (b) are comparing it to really ancient languages
> > that didn't have any notion of objects and object references.  This
> > has led to making up new terminology and spreading confusion.  I'm
> > coming back to Python from almost a decade of working with other
> > modern languages (including implementing the compiler for one of
> > them), and I don't see any difference at all between Python's object
> > handling and those.
> >
> > Best,
> > - Joe
>
> I'm not fluent in Java so you'll have to be the judge.
>
> In Python:
>
> b= 0
> f( b )
>
> No matter what, b == 0.  C doesn't guarantee this.  Does Java?
>

Java also passes arguments by value and has immutable ints.


> Further:
>
> b= {}
> c= b
> f( b )
>
> No matter what, 'c is b' is true.  C doesn't have an 'is' operator.
> Does Java?
>

Primitives (chars, ints, floats, shorts, longs, bytes, booleans, and
doubles)  don't have an identity operator because they aren't treated as
objects. Since Java doesn't allow operator overloading, == is used for
identity of objects and you have to define an equals method for equivalence.


> Lastly, the word 'same' is ambiguous or poorly defined.  It can mean
> either 'identical' or 'equal'.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081017/eeffc867/attachment-0001.html>


More information about the Python-list mailing list