PEP 318 - Function Modifier Syntax
Alexander Schmolck
a.schmolck at gmx.net
Tue Jun 10 19:19:40 EDT 2003
sismex01 at hebmex.com writes:
> Yes, but computer languages do not benefit from having words
> with multiple distinct meanings.
Which is why really advanced languages all use early binding and a single
namespace?
> >>> def SpecialFunction(a,b,c) as Synchronized:
> ....
>
> This might tell many a user that this definition of SpecialFunction
> gives it an additional name, Synchronized, and not that the
> Synchronized() modifier is applied to the function SpecialFunction.
"hmm, let's see, 'as' ... where have I seen that word before... Oh yes, in
combination with the 'import' statement -- so clearly what's going on here is
that this thread-safe module here defines a function called 'Synchronized'
over and over again, just to be on the safe side."
I might just suffer from a lack of imagination, but somehow I doubt showing
code fragments like the above to fellow python programmers will uncover many
flesh-and-blood instantiations of your hypothetical user class (I'll quizz
some colleagues tomorrow).
'as
More information about the Python-list
mailing list