[Tutor] A Python idiom that I don't get
Don Taylor
nospamformeSVP at gmail.com
Wed Apr 26 16:05:30 CEST 2006
w chun wrote:
> it sounds like you did not develop the original code. it seems to
> work... why are you trying to replace it? are you refactoring?
No it is not my code. I am trying to get it running in Jython which does
not support the bool function. I may refactor it after I get it working
in Jython, but right now I have added the following function to my module:
def bool(value):
if value:
return 1
return 0
and this seems to work and lets me leave the original source code
untouched for now.
> i like both of these better... they will perform better than with
> bool(). of the two, it would be interesting to study which one's
> faster... and why.
>
Performance is not really important but I will try some instrumentation
on this code.
FWIW. I am trying to write a Jython extension to the Pydev/Eclipse IDE
that will re-wrap selected comment blocks and docstrings. Pydev now
supports extensions written in Jython - see: http://pydev.sourceforge.net/
Don.
More information about the Tutor
mailing list