Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Invisible function attributes

Reply
Thread Tools

Invisible function attributes

 
 
John J. Lee
Guest
Posts: n/a
 
      09-11-2003
Crumbs, is this thread still running?

http://www.velocityreviews.com/forums/(E-Mail Removed) (Olivier Lefevre) writes:
> > Python has no declarations, only executable statements.

>
> I think this was the key to my confusion in this case.


Certainly part of it.


> > >>> bar(4)

> > Traceback (most recent call last):
> > TypeError: 'int' object has only read-only attributes (assign to .a)

>
> The way I read this, it says that a was bound to the name foo,


I'm not sure what's in your mind, and I'm only looking at this one
message (the rest aren't in my newsreader) but that traceback says you
tried to assign to an attribute on an integer, like so:

3.a = "bananas"


Doesn't make a lot of sense!

(Of course, you probably were assigning to a named integer, not a
literal

foo = 3
foo.a = "bananas"
)

[...]
> OTOH I read the func attr PEP and it says that they are
> implemented via a dict inside the function object. If so,
> shouldn't they be bound to the function object rather than
> to its name??


They are.


> Or is func_dict itself an attribute?


It is.


John
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making 1 control invisible while showing another in the exact location of the invisible one Andy B ASP .Net 5 05-29-2008 03:08 AM
Invisible - Succinic acid : (AMBER ACID) Invisible krithika.143@gmail.com C++ 0 04-14-2008 06:59 PM
class attributes & data attributes james_027 Python 2 06-20-2007 03:12 PM
WebControl.Attributes.Add and custom attributes P4trykx ASP .Net 2 01-31-2007 04:33 PM
Parse reserved attributes as normal attributes Max XML 1 09-22-2006 12:04 PM



Advertisments