Callable modules?

Chris Liechti cliechti at gmx.net
Mon Jul 22 20:49:14 EDT 2002


Paul Rubin <phr-n2002b at NOSPAMnightsong.com> wrote in 
news:7x7kjne14g.fsf at ruckus.brouhaha.com:

> Chris Liechti <cliechti at gmx.net> writes:
>> considering the backwards incompatibility, it makes no sense to add a 
>> __call__ right now.
> 
> What incompatibility?  Do you think people are out there writing
> modules with __call__ functions, and then depending on raising an
> exception when they call the module directly?

if a __call__ feature was added, it would of course only work in newer 
versions of python. so every code that uses this not backwards compatible.

the value of having a __call__ is just not big enough to require a 
dependency on the latest python.

when you do a
try:
    	module()
except ??:
    	module.__call__()

just to be backwards compatible, its already a waste... you could have 
called __call__ directly and save the extra try:..except:
and at the same time you could have given it a reasonable name.

chris

-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list