Re: static variables in functions (was: Version Number Comparison Function)

2005-03-29 Thread Bengt Richter
On 29 Mar 2005 00:29:06 -0800, El Pitonero [EMAIL PROTECTED] wrote:

Christos TZOTZIOY Georgiou wrote:

 One of the previous related threads is this (long URL):

http://groups-beta.google.com/group/comp.lang.python/messages/f7dea61a92f5e792,5ce65b041ee6e45a,dbf695317a6faa26,19284769722775d2,7599103bb19c7332,abc53bd83cf8f636,4e87b44745a69832,330c5eb638963459,e4c8d45fe5147867,5a184dac6131a61e?thread_id=84da7d3109e1ee14mode=threadnoheader=1#doc_7599103bb19c7332

Another previous message on this issue:

http://groups-beta.google.com/group/comp.lang.lisp/msg/1615d8b83cca5b20

Python's syntax surely is not clean enough for concise metaprogramming.
At any rate, I'd agree with Fernando's assessment:

Fernando wrote:
 The real problem with Python is ... Python is
 going the C++ way: piling feature upon feature, adding bells
 and whistles while ignoring or damaging its core design.

If the core design were better, many new features in Python could
have been rendered unnecessary.

Do you have specific recommendations that might benefit python 3000?
What better core design features would have eliminated what new features?
;-)

Regards,
Bengt Richter
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: static variables in functions (was: Version Number Comparison Function)

2005-03-29 Thread El Pitonero
Christos TZOTZIOY Georgiou wrote:

 One of the previous related threads is this (long URL):

http://groups-beta.google.com/group/comp.lang.python/messages/f7dea61a92f5e792,5ce65b041ee6e45a,dbf695317a6faa26,19284769722775d2,7599103bb19c7332,abc53bd83cf8f636,4e87b44745a69832,330c5eb638963459,e4c8d45fe5147867,5a184dac6131a61e?thread_id=84da7d3109e1ee14mode=threadnoheader=1#doc_7599103bb19c7332

Another previous message on this issue:

http://groups-beta.google.com/group/comp.lang.lisp/msg/1615d8b83cca5b20

Python's syntax surely is not clean enough for concise metaprogramming.
At any rate, I'd agree with Fernando's assessment:

Fernando wrote:
 The real problem with Python is ... Python is
 going the C++ way: piling feature upon feature, adding bells
 and whistles while ignoring or damaging its core design.

If the core design were better, many new features in Python could
have been rendered unnecessary.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: static variables in functions (was: Version Number Comparison Function)

2005-03-28 Thread TZOTZIOY
On Fri, 25 Mar 2005 19:23:37 GMT, rumours say that [EMAIL PROTECTED] (Bengt
Richter) might have written:

On Fri, 25 Mar 2005 17:02:31 +0100, Fredrik Lundh [EMAIL PROTECTED] wrote:

Keith wrote:

 Is there a function for comparing version numbers?

 E.g.

 0.1.0  0.1.2
 1.876b  1.876c
 3.2.2  3.4

the following works for many common cases:

import re

def cmpver(a, b):
def fixup(i):
try:
return int(i)
except ValueError:
return i
a = map(fixup, re.findall(\d+|\w+, a))
b = map(fixup, re.findall(\d+|\w+, b))
return cmp(a, b) # -1 if ab, 0 if a=b, 1 if ab

[OT] Visually, I like the nested def fixup, and I realize
that for cmpver execution overhead is not likely to be an issue,
but in general, what do you think of not being able
to write it that way if MAKE_FUNCTION overhead is unacceptable?

What if we had something like

@sticky('fixup') # evaluate binding only first time
def cmpver(a , b):
   def fixup ... ?

One of the previous related threads is this (long URL):

http://groups-beta.google.com/group/comp.lang.python/messages/f7dea61a92f5e792,5ce65b041ee6e45a,dbf695317a6faa26,19284769722775d2,7599103bb19c7332,abc53bd83cf8f636,4e87b44745a69832,330c5eb638963459,e4c8d45fe5147867,5a184dac6131a61e?thread_id=84da7d3109e1ee14mode=threadnoheader=1#doc_7599103bb19c7332
-- 
TZOTZIOY, I speak England very best.
Be strict when sending and tolerant when receiving. (from RFC1958)
I really should keep that in mind when talking with people, actually...
-- 
http://mail.python.org/mailman/listinfo/python-list