Webinar on How to Manage Your Python Open Source

2014-07-06 Thread rafi . michaeli
://attendee.gotowebinar.com/register/7034105107342895362 we hope to see you there :) Rafi, WhiteSource software. -- https://mail.python.org/mailman/listinfo/python-list

Re: aproximate a number

2005-08-28 Thread rafi
; math.ceil returns what you need but as a float, then create an int >>> import math >>> math.ceil (12.3) 13.0 >>> int (math.ceil (12.3)) 13 hth -- rafi "Imagination is more important than knowledge." (Albert Einstein) -- http://mail.python.org/mailman/listinfo/python-list

Re: variable hell

2005-08-26 Thread rafi
Ron Garret wrote: >>Because eval() takes an expression as an argument, and assignment is a >>statement. > > And if you find this distinction annoying, try Lisp. that's were I come from :-) -- rafi "Imagination is m

Re: a dummy python question

2005-08-25 Thread rafi
> If you turn this into a module file and run this > it print out > 3 2 1 0 none I suppose you wrote this down (instead of cut and paste) as the none is not capitalized. There must be something else in your module that writes the none as your code presented above should really not "a

Re: variable hell

2005-08-25 Thread rafi
Steve Holden wrote: > Because eval() takes an expression as an argument, and assignment is a > statement. I am definitely not a language lawyer... but I should a little bit more thanks, -- rafi "Imagination is more important tha

Re: variable hell

2005-08-25 Thread rafi
istake ;) > > It actually is > > exec 'a%s=%s' % (count, value) Noted. In the meantime another question I cannot find an answer to: any idea why does eval() consider '=' as a syntax error? >>> eval ('a=1') Traceback (most recent call last): F

Re: Speed quirk: redundant line gives six-fold speedup

2005-08-25 Thread rafi
or at the beginning of a chunk may not be the same for processing? All the instructions of the program would then be in the cpu cache for example in the same block while in the other case theyr would be in two distinct block -> thus less caching for the cpu... [this particular problem arose when I was working several year ago on a persistent object manager for a distributed operating system] -- rafi "Imagination is more important than knowledge." (Albert Einstein) -- http://mail.python.org/mailman/listinfo/python-list

Re: variable hell

2005-08-25 Thread rafi
Adriaan Renting wrote: > You might be able to do something along the lines of > > for count in range(0,maxcount): > value = values[count] > exec(eval("'a%s=%s' % (count, value)")) why using the eval? exec ('a%s=%s' % (count, value)) should be

Re: RE Despair - help required

2005-08-25 Thread rafi
'.txt') or if you are really reluctant: >>> 'c:\\foo\\bar'.split ('\\') ['c:', 'foo', 'bar'] >>> 'c:\\foo\\bar'.split ('\\') [-1] 'bar' > Fredrik Lundh wrote: >> instead of

Re: Default function arguments behaving badly

2005-08-24 Thread rafi
unction, it uses the same list that has been filled before... you do not have the problem with say and int or a string as they are non mutable objects. however lists are mutable objects so... modify your function as follow: def myFunction(l1,l2,result=None): if result is None:

Re: Email client in Pyhton

2005-08-24 Thread rafi
nd managing folders. > > I also look for some existing mail client, written in python > which wud serve my cause. > > i searched google for no avail. > -- rafi "Imagination is more important than knowledge." (Albert Einstein) -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading just a few lines from a text file

2005-08-23 Thread rafi
my program by reading only the last 20 > lines. How do I do this? > > Thomas Philips > If you are using a Unix: tail -20 file.txt -- rafi "Imagination is more important than knowledge." (Albert Einstein) -- http://mail.python.org/mailman/listinfo/python-list

Re: how to deal with space between numbers

2005-08-23 Thread rafi
lly when several persons replied to you... -- rafi "Imagination is more important than knowledge." (Albert Einstein) -- http://mail.python.org/mailman/listinfo/python-list

Re: while c = f.read(1)

2005-08-23 Thread rafi
when no data is available? If no data is available then nothing is returned, the function hangs. (Which is the cas for receive) -- rafi "Imagination is more important than knowledge." (Albert Einstein) -- http://mail.python.org/mailman/listinfo/python-list

Re: loop in python

2005-08-23 Thread rafi
fast to give a false answer, it is like driving a truck with the eyes closed in down town ("I can go fast, I am not scared, I do not see the dangers"). Please tell us for you are working in order for us to avoid the software / services you are providing. -- rafi "Imag

Re: loop in python

2005-08-22 Thread rafi
#x27;s computer programs where running two times slower but with two times less bugs, imagine how many hours we would benefit... -- rafi "Imagination is more important than knowledge." (Albert Einstein) -- http://mail.python.org/mailman/listinfo/python-list

Re: split function

2005-08-22 Thread rafi
join (values))) output.close () you can define two function, in case of your output may vary in the future. > [snip your code] 8 levels of indentation seems really to much for a good ppiece of code from my point of view. my 2 cents -- rafi "Imagination is more important than knowledge." (Albert Einstein) -- http://mail.python.org/mailman/listinfo/python-list

Re: tkinter text widget question

2005-08-21 Thread rafi
"%s.%s" % (row, column) should answer your problem easily my 2 cents -- rafi "Imagination is more important than knowledge." (Albert Einstein) -- http://mail.python.org/mailman/listinfo/python-list

Re: Library vs Framework (was Dr. Dobb's Python-URL!)

2005-08-15 Thread rafi
provides an overall structure with particular rules for its use, while the library provide basic blocks that you may assemble in your own way (even if some constaints exist). -- rafi "Imagination is more important than knowledge." (Albert Einstein) -- http://mail.python.org/mailman/listinfo/python-list

Re: get a list of mounted filesystems under MacOSX

2005-08-15 Thread rafi
n MacOSX, apart from calling "mount" as > an external program and parsing the output - but I prefer "cleaner" > solutions. Is there one? why not looking at the content of the /Volumes folder? my 2 cents -- rafi "Imagination is more important than knowledge

Re: Art of Unit Testing

2005-08-02 Thread rafi
rafi wrote: > In order to unit test a function / method one should use mock objects, > otherwise you may not be sure that your code is faulty. 'should' may be too strong, 'may' may be better. In the meantime I found: http://python-mock.sourceforge.

Re: Art of Unit Testing

2005-08-02 Thread rafi
at long to run (well from my point of view, which is again not the one of an expert of unit testing). I do agree with Benjamin Niermann when he says: "Or because it is already close to perfection (at least in what it is intended to do)." unittest is for unittesting :-) my 2 cents -- ra

Re: inheriting from datetime

2005-08-01 Thread rafi
wing code or line 3 of the use of the code? on my box it runs, except that ValueError is not caught by the except. side question: what is the point of accepting invalid dates? -- rafi "Imagination is more important than knowledge."

Re: multiple inheritance super()

2005-07-28 Thread rafi
plement some CORBA stuff using Java (moreover compared to C++) because of the lack of multiple inheritance. -- rafi "Imagination is more important than knowledge." (Albert Einstein) -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple inheritance super()

2005-07-27 Thread rafi
Michele Simionato wrote: >>I am mostly >>using old style (without type unification) init but this motivate the >>shift for the new style. Is there somewhere a document about this? > > Yes, see http://www.python.org/2.3/mro.html by yours truly > >Michele Sim

Re: multiple inheritance super()

2005-07-27 Thread rafi
er goes through all the super classes init to find the attributes that may have name conflict and keep the value of the attribute baesd upon the order of the class declaration in the definition of C (here the value of foo in A). Am I right? I am mostly using old style (without type unification)

Re: multiple inheritance super()

2005-07-26 Thread rafi
se, so it takes the first one in the list of inherited classes (order of the declaration). However I cannot find an explanation (I may have googled the wrong keywords) for the order of the __init__ calls from C. I was expecting (following the same order as the method

Re: OS X py2app confusion

2005-07-25 Thread rafi
e as the one used to isntall py2app? Have you tried to re-install the py2app (even version 0.17)? my 2 cents -- rafi "Imagination is more important than knowledge." (Albert Einstein) -- http://mail.python.org/mailman/listinfo/python-list

Re: FAQ?

2005-07-24 Thread rafi
;ve accessed on slicing) didn't answer > my question. If, after looking for information on your own you did not find a solution, it may mean that you are ready to post a question :-) my 2 cents -- rafi "Imagination is more important than knowledge." (Albert Einstein) -- http://mail.python.org/mailman/listinfo/python-list