[issue2040] Class instance attributes that are property() should appear in __dict__

2008-02-07 Thread Jag Ginsberg

New submission from Jag Ginsberg:

If I have a class:

class Foo(object):
  bar = property(lambda self: 'baz') # ignore the value's trivial nature

and then run:

>>> foo_obj = Foo()
>>> foo_obj.__dict__

... I would expect to see:

{'bar': 'baz'}

... and not:

{}

This would seem consistent with what a property is supposed to
masquerade as. Do you disagree?

-jag

--
components: Interpreter Core
messages: 62159
nosy: jag
severity: minor
status: open
title: Class instance attributes that are property() should appear in __dict__
type: behavior

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2040>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2040] Class instance attributes that are property() should appear in __dict__

2008-02-07 Thread Jag Ginsberg

Jag Ginsberg added the comment:

I appreciate your quick response, and I certainly hope you won't read
this as me being anything but ignorant, but how can a property whose
function definitions include "self" be "about" the class and not the
instance?

I agree that Foo.__dict__ should include the 
reference, but if a property is supposed to be a function that behaves
like an instance attribute (I say "instance" because of the presence of
self in the arguments and not cls), wouldn't it make sense for its value
to be included in foo_obj.__dict__ like every other attribute whose
value is specific to the instance?

I'm sure my misunderstanding is in the intended definitions of __dict__
and of property(). :-/

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue2040>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com