Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #8700

Re: Inexplicable behavior in simple example of a set in a class

References <2dc52e22-5c0f-4e24-8197-df616db1a42c@u2g2000yqb.googlegroups.com> <mailman.566.1309644846.1164.python-list@python.org> <6441039f-f226-4632-8e74-2b6415bf914e@n28g2000vbs.googlegroups.com> <CAPTjJmofz7eRxmLyUwhKtz+w8-R-Kq7pwNvFXec7=DOSLc+5BA@mail.gmail.com>
Date 2011-07-02 18:07 -0700
Subject Re: Inexplicable behavior in simple example of a set in a class
From Chris Rebert <clp2@rebertia.com>
Newsgroups comp.lang.python
Message-ID <mailman.572.1309655278.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, Jul 2, 2011 at 5:46 PM, Chris Angelico <rosuav@gmail.com> wrote:
> On Sun, Jul 3, 2011 at 8:23 AM, Saqib Ali <saqib.ali.75@gmail.com> wrote:
>> So just out of curiosity, why does it work as I had expected when the
>> member contains an integer, but not when the member contains a set?
>
> It's not integer vs set; it's the difference between rebinding and
> calling a method. It's nothing to do with object orientation; the same
> happens with ordinary variables:
<snip>
>>>> c=d=[]
>>>> c,d
> ({}, [])

Nasty typo in your pseudo-interpreter-session there...

Cheers,
Chris

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Inexplicable behavior in simple example of a set in a class Saqib Ali <saqib.ali.75@gmail.com> - 2011-07-02 14:59 -0700
  Re: Inexplicable behavior in simple example of a set in a class Chris Rebert <clp2@rebertia.com> - 2011-07-02 15:14 -0700
    Re: Inexplicable behavior in simple example of a set in a class Saqib Ali <saqib.ali.75@gmail.com> - 2011-07-02 15:23 -0700
      Re: Inexplicable behavior in simple example of a set in a class Chris Rebert <clp2@rebertia.com> - 2011-07-02 16:25 -0700
      Re: Inexplicable behavior in simple example of a set in a class Chris Angelico <rosuav@gmail.com> - 2011-07-03 10:46 +1000
      Re: Inexplicable behavior in simple example of a set in a class Chris Rebert <clp2@rebertia.com> - 2011-07-02 18:07 -0700
      Re: Inexplicable behavior in simple example of a set in a class Chris Angelico <rosuav@gmail.com> - 2011-07-03 11:14 +1000
  Re: Inexplicable behavior in simple example of a set in a class Peter Otten <__peter__@web.de> - 2011-07-03 00:22 +0200
  Re: Inexplicable behavior in simple example of a set in a class Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-03 12:25 +1000

csiph-web