Re: How to process syntax errors

2016-10-14 Thread Pierre-Alain Dorange
python to understand your new syntax, just write a small interpreter to translate your new language to python. -- Pierre-Alain Dorange Moof <http://clarus.chez-alice.fr/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses

Re: How to process syntax errors

2016-10-12 Thread Pierre-Alain Dorange
m just an amateur developer. But what confuse me, is that Python require "real live" interpratation of the code to work properly (or perhaps i also confuse on that but Python rely on interpretation of the code to conform to its own standard, ie variables can change type during execution...) -- Pierre

Re: Python code is compiled before execution

2016-10-11 Thread Pierre-Alain Dorange
trange the initial request. And sure, i overinterpret or simplify thing (compiling)... But it seems that all this talk do not interested the initial requester (Mr Puneet) : at that time he has not answer to the thread. -- Pierre-Alain Dorange Moof <http://clarus.chez-alice.fr/&

Re: Python code is compiled before execution

2016-10-11 Thread Pierre-Alain Dorange
interpretation, byte-code compilation, JIT compilation, AOT compilation... So yes Python compile (bytecode). -- Pierre-Alain Dorange Moof <http://clarus.chez-alice.fr/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licens

Re: How to process syntax errors

2016-10-11 Thread Pierre-Alain Dorange
means it is most definitely > meant to be able to be caught. Using compile() function yes. So yes there is a way to check "syntax error" before executing code (using compile function and exceptions) but it was not standard, nor widely used... It was still a hack for me, but perhaps

Re: How to process syntax errors

2016-10-10 Thread Pierre-Alain Dorange
uested but that only a hack and should not be used in real world. -- Pierre-Alain Dorange Moof <http://clarus.chez-alice.fr/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- https://mail.python.org/mailman/listinfo/python-list

Re: BeautifulSoup help !!

2016-10-07 Thread Pierre-Alain Dorange
ve the page, extract data, extract last river level and mean the 24h last levels. <https://www.dropbox.com/sh/k5974t374zmcoj6/AACes_Xo5DrxCbE1RjSaeKXYa?dl=0> Note : it was probably not beautiful python code, but it works for the purpose it was written. -- Pierre-Alain Dorange

Re: Creating a calculator

2016-07-04 Thread Pierre-Alain Dorange
DFS wrote: > > 2 lines? Love it! > > But apparently eval==evil. > > http://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html > > I bet you get hammered about it here on clp. It was a software to be deploy, it was just for educational purpose.

Re: Creating a calculator

2016-07-01 Thread Pierre-Alain Dorange
- env={} env["__builtins__"] = None u=raw_input('Enter calculation:") print eval(u,env) - -- Pierre-Alain Dorange Moof <http://clarus.chez-alice.fr/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- https://mail.python.org/mailman/listinfo/python-list

Re: Creating a calculator

2016-07-01 Thread Pierre-Alain Dorange
;*':c=n1*n2 > if op=='/':c=n1/n2 > print(ui+' = '+str(c)) > --- More reduced : -- u=raw_input('Enter calculation:") print eval(u) -- works and compute : 1+2+3+4-1+4*2 2+3.0/2-0.5 Pe

Re: Empty List

2016-06-27 Thread Pierre-Alain Dorange
;something" that perhaps will fill the list (word.append("hello"). Then after do your job, you perhaps need to print it. But initializing and just print, will do nothing else than initialize and print the result... As state before this code more or less like : a=0 print a -- P

Re: Break and Continue: While Loops

2016-06-24 Thread Pierre-Alain Dorange
something must exist first. -- Pierre-Alain Dorange Moof <http://clarus.chez-alice.fr/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- https://mail.python.org/mailman/listinfo/python-list

Re: Can math.atan2 return INF?

2016-06-24 Thread Pierre-Alain Dorange
Marko Rauhamaa wrote: > Note that the "valid point of view for external observers" is the only > valid scientific point of view. For a scientific point of view, right. But tell this to the one that will be close to a blackhole ;-) -- Pierre-Alain Dorange Moof <

Re: Can math.atan2 return INF?

2016-06-23 Thread Pierre-Alain Dorange
Steven D'Aprano wrote: > > which infinity. There are many - some larger than others > > China has just announced a new supercomputer that is so fast it can run an > infinite loop in 3.7 seconds. Near a black hole 3.7 seconds can last an infinite time... -- Pierre-Alain

Re: Can math.atan2 return INF?

2016-06-23 Thread Pierre-Alain Dorange
ncy is always atan2(y,x) tend to pi/4 if you looks at lot od y and x that will be grater and greater each time : the final frontier would always be pi/4, even if t take a long time to reach it. -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence C

Re: [tkinter] widget size adjustment

2016-06-22 Thread Pierre-Alain Dorange
not explore this, i just thought NSEW was also CENTERED. Many Thanks. -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- https://mail.python.org/mailman/listinfo/python-list

Re: [tkinter] widget size adjustment

2016-06-22 Thread Pierre-Alain Dorange
pmx-bigmap> the tkinter code is in pmx.py the canvas class was TMap GUI was created in main_gui.__init__() callback function was main_gui.resize() -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons &quo

Re: Can math.atan2 return INF?

2016-06-22 Thread Pierre-Alain Dorange
been NaN too but i'm not a math expert, but the limit of atan2 would be 45°, so pi/4 radians (0,7854). As x,y are coordinates, the both infinite would tend toward 45°. x only infinite would be 0° (0 radians) y only infinite woudl be 180° (pi/2 radians) -- Pierre-Alain Dorange&

Re: Can math.atan2 return INF?

2016-06-21 Thread Pierre-Alain Dorange
Steven D'Aprano wrote: > py> math.atan2(NAN, 0) > nan > > I think that the only way it will return a NAN is if passed a NAN. yes of course if you pass an invalid argument (NAN is not a real value, atan2 except coordinate x,y), the result would be invalid... --

Re: [tkinter] widget size adjustment

2016-06-21 Thread Pierre-Alain Dorange
to see a different portion. So i except the map to be resized to show a bigger portion of the whole map : no streching. -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.

Re: Can math.atan2 return INF?

2016-06-21 Thread Pierre-Alain Dorange
quadrant (for angle answer). -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- https://mail.python.org/mailman/listinfo/python-list

Re: [tkinter] widget size adjustment

2016-06-21 Thread Pierre-Alain Dorange
he cell where the canvas widget is put). I think i can resize the canvas, but i can't find a way to get the available space after resize. Perhaps using the grid manager is not the godd idea for that ? I except it was more understandable. -- Pierre-Alain Dorange<http://microwar.sour

[tkinter] widget size adjustment

2016-06-19 Thread Pierre-Alain Dorange
at to do from that. Any clue or advice or tutorial ? -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- https://mail.python.org/mailman/listinfo/python-list

Re: pygame and py2app : big package

2009-09-20 Thread Pierre-Alain Dorange
t; > > numpy is very big and i doubt all is reallly needed > > > > Excuse me, but what was the point? (id est, are you just saying this > or do you wish to ask a question?;) Sorry, it was not clear. But i want to know if i can make the package smaller, because the total packag

Re: Profiling Python Apps on Mac?

2009-01-28 Thread Pierre-Alain Dorange
.org/library/profile.html> -- Pierre-Alain Dorange MicroWar 2.0 : tuez des PC <http://microwar.sourceforge.net/> -- http://mail.python.org/mailman/listinfo/python-list

Re: New to python, open source Mac OS X IDE?

2009-01-28 Thread Pierre-Alain Dorange
e Python directly from Xcode but i do not understand the right way to do this. There is project for PyObjC but a can't make working directly simple script project, so i continue to use terminal... -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous l

[MacOS] Multiple versions of a module

2009-01-25 Thread Pierre-Alain Dorange
? I do a site._test() and i return my only 1.8.0 module for pygame, 1.9.0 is ignored. The same with Any clue ? -- Pierre-Alain Dorange <http://microwar.sourceforge.net/> -- http://mail.python.org/mailman/listinfo/python-list

Re: s=ascii(hexlify(urandom(10)))

2009-01-17 Thread Pierre-Alain Dorange
ou invoked the ascii() builtin, the b > >> prefix should disappear? Re-read the documentation of the > >> ascii() builtin - it probably does something completely different > >> from what you expect it to do. > > > > s = str(hexlify(urandom(8)))[2:18] > > And you

Pythonic way to handle coordinates

2009-01-17 Thread Pierre-Alain Dorange
ust exist allready ? -- Pierre-Alain Dorange Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- http://mail.python.org/mailman/listinfo/python-list

Re: I always wonder ...

2008-12-27 Thread Pierre-Alain Dorange
le SketchUp, do want > to get on board? I've other real project on the run, no crusade just programming. Google sketchup doesn't really interest me, sorry... -- Pierre-Alain Dorange Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creative

Re: I always wonder ...

2008-12-26 Thread Pierre-Alain Dorange
r wrote: > > Go to Google groups... it looks perfect :) It's a usenet group here, nothing to do with google groups. To get back to the group subject, what is your actual python projects ? -- Pierre-Alain Dorange Ce message est sous licence Creative Commons "by-nc-sa-2.

Re: I always wonder ...

2008-12-25 Thread Pierre-Alain Dorange
|--//''`\--| > | (( +==)) | > |--\_|_//--| Very nice indeed, but you forget ascii art need a fixed font... --

Re: no sign() function ?

2008-12-24 Thread Pierre-Alain Dorange
ft. > At least until you profile your > application and discover that the sign() function is the bottleneck > keeping your program slow. In each frame i'll have to use about 10 to 20 sign() call, so it'll not be the bottleneck. -- Pierre-Alain Dorange<http:/

[Offtopic] Re: I always wonder ...

2008-12-23 Thread Pierre-Alain Dorange
r wrote: > [...] > Well that shows that even lads with tiny nads can be brave, any of the > other trolls want to expose them selfs? This thread is offtopic, please just keep silent and let it be closed... -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce m

Re: Python's popularity

2008-12-23 Thread Pierre-Alain Dorange
III. Do you want to know my > favorite color too? Only if it's pythonic. -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- http://mail.python.org/mailman/listinfo/python-list

Re: no sign() function ?

2008-12-23 Thread Pierre-Alain Dorange
) sign_3 : 0.498 (+33%) It seems it don't change the relative results between the methods. Using timeit make measure accurate and remove print/range footprints. I also try Arnaud's proposition, it make sign_0 just a little better (-1%) -- Pierre-Alain Dorange<http://microwa

Re: no sign() function ?

2008-12-22 Thread Pierre-Alain Dorange
ge from -1000 to 0 sign_0 : 0.46" sign_1 : 0.30" (-35%) 1000 Random from -500 to +500 sign_0 : 0.37" sign_1 : 0.42" (+13%) -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- http://mail.python.org/mailman/listinfo/python-list

Re: no sign() function ?

2008-12-22 Thread Pierre-Alain Dorange
0.5244 second (+26%) conclusions --- 1/ python is fast 2/ method (0) is the fastest 3/ cmp method (2) is the slowest 4/ the precise one (IEEE 754) is also fast (1) -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licenc

Re: no sign() function ?

2008-12-22 Thread Pierre-Alain Dorange
Christian Heimes wrote: > Pierre-Alain Dorange schrieb: > > I don't find any sign(x) function in the math library (return the sign > > of the value). > > I've read that math module is a wrapper to C math lib and that C math > > lib has not sign(), so... >

no sign() function ?

2008-12-22 Thread Pierre-Alain Dorange
better and could be faster. How do you implement this or is there any other module with a sign() function ? -- Pierre-Alain Dorange<http://microwar.sourceforge.net/> Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons

Re: re.match() performance

2008-12-18 Thread Pierre-Alain Dorange
atching Time: 0.122432 (Compiled) Pattern Matching Time: 0.12012 Ratio Compiled/NotCompiled: 0.981116048092 2nd time and more Pattern Matching Time: 0.00257 (Compiled) Pattern Matching Time: 0.000619 Ratio Compiled/NotCompiled: 0.240856031128 Config python 2.5.1 / MacOS X 10.5 --

Game to test : MicroWar 2.0 alpha 6

2008-12-14 Thread Pierre-Alain Dorange
p Bonus (give 5 super-bomb) * adding Saucer explosion : generate Virus that can infect PC * clean the screens handling -- Pierre-Alain Dorange Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- http://mail.pyt

Re: Python and audio frequency analysis

2008-12-08 Thread Pierre-Alain Dorange
e display module you can use pygame, pyglet or pyOpenGL, there are fast. For the audio analysis i thought the module must be written in C or something very fast, because python, due to it's nature, would probably not compute spectrum as fast as real time : 44100 samples per seconds is a lot

Re: Beginner trying to understand functions.

2008-12-08 Thread Pierre-Alain Dorange
i you want to loop in getAge() : def getAge(): age=-1 while age<0: try: age = int(input('Please enter your age: ')) except ValueError: print('That was not a valid number. Please try again.') return age I'm a begi

Re: Strengths and weaknesses of Pygame vs. pyglet vs. PyOpenGL?

2008-12-08 Thread Pierre-Alain Dorange
y iMac intel, i run my small arcade game (a spaceinvader like) between 800-1400 fps using dirtyrect. I can also run without modification on Windows and Unbuntu using WMWare on the same machine. -- Pierre-Alain Dorange <http://microwar.sourceforge.net/> Ce message est sous licence Creative Co

Re: Air Force1 and Air Jordan shoes PAYPAL wholesale

2008-11-20 Thread Pierre-Alain Dorange
air force1 shoes <[EMAIL PROTECTED]> wrote: >>> air force1 shoes. air force1 high shoes. air force1 light shoes File "", line 1 air force1 shoes. air force1 high shoes. air force1 light shoes ^ SyntaxError: invalid syntax >>> -- Pierre-

Re: python vs smalltalk 80

2008-11-19 Thread Pierre-Alain Dorange
gavino <[EMAIL PROTECTED]> wrote: > python vs smalltalk 80 > > which is nicer? 1st clue : Python got less letters in its name. 2nd clue : 80 is the year of the release of Alan Vega/Martin Rev album 3rd clue : Smalltalk began with an S, but Python with a P -- Pierre-Alain Dora

Trouble with getdefaultlocale on Mac

2008-11-06 Thread Pierre-Alain Dorange
None) The same test at my office, with MacOS X 10.5 / Python 2.5.x return the right answer ; ('fr_FR','mac-roman') My goal is to dertermine th user language define on the running system, any helps ? -- Pierre-Alain Dorange Ce message est sous licence Creative Commons &qu

Re: equivalent of py2exe in other os

2008-10-07 Thread Pierre-Alain Dorange
on.org/moin/MacPython/py2app> -- Pierre-Alain Dorange Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Python embedding question (2).

2008-07-30 Thread Pierre-Alain Dorange
e an external program paint an image from a camera into a portion of > the screen while pyGame is running? Don't know... -- Pierre-Alain Dorange Ce message est sous licence Creative Commons "by-nc-sa-2.0" <http://creativecommons.org/licenses/by-nc-sa/2.0/fr/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble using pinckle

2008-07-03 Thread Pierre-Alain Dorange
++ !-) OK ;-) I just ask myself what was the best method (according to python phylosophy). -- Pierre-Alain Dorange Vidéo, DV et QuickTime <http://www.garage-video.com/> Clarus, the DogCow<http://clarus.chez.tiscali.fr/> -- http://mail.python.org/mailman/listinfo/python-list

Re: Trouble using pinckle

2008-07-02 Thread Pierre-Alain Dorange
me directory and perhaps i would also faced to permissions issues... But first is there a way to determine on which platfrom the python script is running ? -- Pierre-Alain Dorange Vidéo, DV et QuickTime <http://www.garage-video.com/> Clarus, the DogCow<http://clarus.chez.tiscali.fr/> -- http://mail.python.org/mailman/listinfo/python-list

Trouble using pinckle

2008-07-02 Thread Pierre-Alain Dorange
self): f=open(kFileName,'w') pickle.dump(self,f) f.close() return 0 def main(): p=Prefs() p.load() print 'test %d (after load)' % p.test p.test+=1 print 'test %d (before save)' % p.test p.save() print