On Thu, 2 Jun 2011 08:37:09 -0500
"Edward K. Ream" <[email protected]> wrote:

> That is, when I do repr(anObject), I want to know what that
> object *really* is.

collections.namedtuple meets that need

from collections import namedtuple
Point = namedtuple('Point', 'x y')
p = Point(11, y=22)
p

Point(x=11, y=22)

I've used them sometimes, but I'm not that excited about them, because:

p.z = 44

AttributeError: 'Point' object has no attribute 'z'

I understand why, but I think you can do 
b.something_I_just_thought_of = 7 with a bunch?

Nice when you want to write 
p.x = p0.x + r * cos(a)
instead of
p['x'] = p0['x'] + r * cos(a)

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to