Does Python compete with Java?

Jakub Fast kfast at poczta.onet.pl
Tue Apr 13 13:12:12 EDT 2004


>>Over the long term, I think Python's biggest key to success will be that we
>>will still be able to read the programs that we are writing now.
> 
> 
> No argument here :)

Hi,

I'm totally fresh to python, and i'm enjoying the language, and the 
readability a lot, but i just bumped into something that -- from my 
purely subjective perspective -- surprised me with pretty awful, 
not-very-readable syntax: operator overloads and static methods. is this 
an issue that is argued over? i just find these particular bits to be 
10x more intuitive the way they are implemented in c++...

would having the possibility of using

def static mymethod():

instead of the standard = staticmethod(...) do anything bad to python as 
it is? Same question goes for something along the lines  of 
__operator__['='] (self, etc).

On quite another note, is it possible to define your own operators in 
python? you could argue that this might actually make the code _less_ 
transparent, but then, at least for some cases, my experience shows that 
a few cleverly defined operators work magic in terms of bumping up the 
ease-of-use of a library. what i'm thiniking about, exactly, are the 
"--->"'s, "==>"'s, or "~~>"'s you'll see people using in prolog for 
instance. Also, can "and", "or", "not" etc. be overloaded?

I've been pondering using python+NLTK to teach a computational semantics 
class this summer (precisely because i think the basics of python would 
be easy for the students to learn quickly, and, class aside, that 
learning them actually might turn out useful for whatever they want to 
do in the future -- more useful than, say, prolog) and nothing can beat 
the intuitive appeal of

S ==> (NP and VP) or VP

over CFGProduction(S, NP, VP), CFGProduction(S, VP) for specifying your 
simple cfg, dcg or ebnf rules if you're completely new to programming 
and have just been given a programming assignment :)


Any comments, any answers?

Thanks in advance.

Kuba Fast






More information about the Python-list mailing list