PEP318 yet an alternate syntax idea

Michele Simionato michele.simionato at poste.it
Tue Mar 23 19:44:02 CET 2004


Marco Aschwanden <PPNTWIMBXFFC at spammotel.com> wrote in message news:<mailman.277.1080045041.742.python-list at python.org>...
> Python has the concept that names with a preceding underscores (__) will 
> be mangled in some way. I suppose the "compiler"/interpreter does this 
> name-mangling. Why not use the same concept:
> 
> def __static__theRealFunctionName(self, var1, var2):
>      pass
> 
> The compiler will do some name mangling. The function is called without 
> the __static__ part:
> 
> --> theRealFunctionName(3,4)
> 
> 
> The advantages:
> 
> - Old code won't break (except if someone has functions starting with 
> __static__).
> - It is an already used concept for "private" variables --> they might be 
> migrated to __private__
> - well they even might be joined: 
> __static____privat__theRealFunctionName(...)
> - don't use it if you don't need it (this probably defaults to a 
> __public__)
> - The definition tells us what kind of method (class?) this is
> 
> The disadavantage:
> - long names
> 
> Stupid idea? I guess so, but I am too stupid to see why?
> 
> Bye,
> 
> Marco


Three reasons:

1. it is ugly;

2. you don't need to change the core language for that. Implementing
   this idea in Python 2.2+ is just an exercise in metaclasses. It
   does not deserve a PEP.

3. How do you pass parameters to the decorator?


        Michele Simionato



More information about the Python-list mailing list