Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > embarrassing class question

Reply
Thread Tools

embarrassing class question

 
 
Gregory Ewing
Guest
Posts: n/a
 
      10-30-2010
Paul Rudin wrote:
> Gregory Ewing <(E-Mail Removed)> writes:
>
>>You can clean up dir() by defining __all__ as a list of
>>names that you want to officially export.

>
> I'm not sure that's necessarily a good idea... when you're trying to figure
> out why something behaves in a certain way you want to check for the
> presence of methods with special names.


If you need to find out what's really there, you can always
look at module.__dict__.keys().

(BTW, there are no function names that have a special meaning
in a module dict -- a module is not like a class.)

--
Greg

 
Reply With Quote
 
 
 
 
Steven D'Aprano
Guest
Posts: n/a
 
      10-30-2010
On Sat, 30 Oct 2010 19:30:21 +1300, Gregory Ewing wrote:

> (BTW, there are no function names that have a special meaning in a
> module dict -- a module is not like a class.)


Pity... it would be nice to have a __main__() function, or perhaps
main(), that was automatically called when you call the module like a
script.

There are, however, a few special module attributes -- they just aren't
functions. __doc__, __name__, __file__ and __package__ come to mind.


--
Steven
 
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
Embarrassing regex question Aaron Fude Java 5 06-21-2010 10:00 PM
Embarrassing problem with vector T_P C++ 9 09-12-2009 04:25 PM
embarrassing spaghetti code needs stylistic advice luser-ex-troll C Programming 72 03-31-2009 08:31 PM
Embarrassing question - Christopher Rose Ruby 3 07-18-2006 05:56 PM
Embarrassing Moment slumpy Computer Support 21 08-25-2003 09:57 PM



Advertisments