[Python-bugs-list] [ python-Feature Requests-481962 ] Make modules callable

SourceForge.net noreply@sourceforge.net
Wed, 22 Jan 2003 20:48:31 -0800


Feature Requests item #481962, was opened at 2001-11-14 23:11
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=481962&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Thomas Justin Shaw (justinshaw)
Assigned to: Nobody/Anonymous (nobody)
Summary: Make modules callable

Initial Comment:
Many modules are have the same name as the main class 
they contain.  I.E. 

gnu = Gnuplot.Gnuplot()

Why not make modules callable.  That is if a module 
contains a function called "__init__()" then that 
fucntion gets called whenever the code

x = module(args)

is encountered.

Just an idea.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-01-22 23:48

Message:
Logged In: YES 
user_id=80475

I don't think this shortcut gives an advantage over:
     from Gnuplot import Gnuplot
     . . .
     x = Gnuplot(args)




----------------------------------------------------------------------

Comment By: Andrew Bennetts (spiv)
Date: 2002-06-27 02:51

Message:
Logged In: YES 
user_id=50945

Wouldn't calling a function named "__call__" make more sense
than "__init__"?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=481962&group_id=5470