PEP 318 - Function Modifier Syntax

Roman Suzi rnd at onego.ru
Thu Jun 12 02:41:47 EDT 2003


On 11 Jun 2003, Kevin Smith wrote:

>In <3EE67C20.941FCA51 at alcyone.com> Erik Max Francis  wrote:
>> A fair point.  So if you were able to choose any keyword for this task
>> that you wished, which would you choose?
>
>I had considered the word 'using' instead of 'as'.  Someone else in this 
>thread also suggested that.  Then the the following def:
>
>    def foo(self) using classmethod, synchronized(lock):
>        blah, blah, blah
>
>reads as:
>
>    "Define [a function] foo using [the behaviors of] classmethod and 
>synchronized"

If additions to def are to introduced to Python, it will not matter to me much
if they are "as"-based, "using"-based or []-based.

However, I'd liked to see the new syntax to be more uniform, not just 
for def.

For example (please forgive for stupid keywords - I am no expert in
OOP):

class A(type) using [metaclassic]:
  def f(self,y,z) using [classmethod, synchronized(lock)]:
    lalalala

for i in [metaclassic, classmethod, synchronized(lock)]:
  print type(i)


Or even plain code-blocks:

[synchronized(lock2)]:
  print "haha"


Disclaimer: OOP gurus are free to contact me and remind me why Python needs
all those fancy classmethods, etc. If syncronisation is so important, why not
add a new operator to Python? (I think it is no less important than assert,
for example)


Sincerely yours, Roman Suzi
-- 
rnd at onego.ru =\= My AI powered by GNU/Linux RedHat 7.3






More information about the Python-list mailing list