Re: Newbie questions on import & cmd line run

2012-05-16 Thread alex23
On May 17, 11:45 am, gwhite wrote: > 1.  If running from the system command line, or the Sypder "run" > button, "__name__" is "__main__" rather than "newbie00", as seen > above. > > So, how would I get the file name newbie00.py in these two noted > cases? You can get it from the file name: i

Re: Newbie questions on import & cmd line run

2012-05-16 Thread Steven D'Aprano
On Wed, 16 May 2012 18:45:39 -0700, gwhite wrote: > #! > # Filename: newbie00.py "Supposed to"? Nothing -- it is completely optional. #! ("hash-bang") lines currently do nothing on Windows machines, they are just comments. However, on Unix and Linux machines (and Macintosh?) they are interpre

Algorithms in Python, #n+1

2012-05-16 Thread Antti J Ylikoski
I have continued my research in literature algorithms in Python. The algorithms in Knuth's volumes 1 -- 3 either have been incorporated into Python, or they can be easily implemented with Python. Quite as John Nagle said here. However, the Fascicles in Vol. 4 to my opinion contain nontrivially

Re: Newbie questions on import & cmd line run

2012-05-16 Thread Chris Rebert
On Wed, May 16, 2012 at 6:45 PM, gwhite wrote: > Hi, > > I am a newbie running the latest pythonxy (2.7.2.1) & spyder and > python 2.7.2.   I suspect my questions are mostly basic to python, and > not specific to Spyder or iPython. > > Note: Up until now, I mainly used MATLAB, and thus need to de-

Re: Newbie questions on import & cmd line run

2012-05-16 Thread Terry Reedy
On 5/16/2012 9:45 PM, gwhite wrote: Hi, I am a newbie running the latest pythonxy (2.7.2.1)& spyder and python 2.7.2. I suspect my questions are mostly basic to python, and not specific to Spyder or iPython. Note: Up until now, I mainly used MATLAB, and thus need to de-program myself appropr

Re: Where is the most recent Tkinter information

2012-05-16 Thread Simon Cropper
On 17/05/12 13:02, Mark R Rivet wrote: It seems like all the info on tkinter is around the 2000 time frame. Is tkinter still being developed/supported? The main page of the python 3.2.3 documentation for tkinter can be found here... http://docs.python.org/py3k/library/tkinter.html?highlight=t

Python and Tkinter by John E Grayson

2012-05-16 Thread Mark R Rivet
I have a copy of this book and was wondering how relevant the content is considering the publish date is 2000. Are people still using this information? Anyone have any experience with this book? I guess what I mean, is, any of the code in this book deprecated? or does it still contain information

Re: Are there any instrumentation widgets for wxpython or tkinter?

2012-05-16 Thread Mark R Rivet
On Sat, 12 May 2012 12:40:28 -0700 (PDT), Sverre wrote: >I searched for widgets used for PLC automation or lab instrumentation >like gauges, led's etc. in the net, but didn't found anything because >of those massive link spam sites. In the case there isn't any >solution, with which toolkit would

Re: Where is the most recent Tkinter information

2012-05-16 Thread Terry Reedy
On 5/16/2012 11:02 PM, Mark R Rivet wrote: It seems like all the info on tkinter is around the 2000 time frame. Is tkinter still being developed/supported? tkinter is CPython's tk interface. tcl/tk is still being developed at Active State. The Windows release for Py 3.3 will come with 8.5.11,

Where is the most recent Tkinter information

2012-05-16 Thread Mark R Rivet
It seems like all the info on tkinter is around the 2000 time frame. Is tkinter still being developed/supported? -- http://mail.python.org/mailman/listinfo/python-list

Re: cPython, IronPython, Jython, and PyPy (Oh my!)

2012-05-16 Thread Ethan Furman
Chris Angelico wrote: On Thu, May 17, 2012 at 9:01 AM, Ethan Furman wrote: A record is an interesting critter -- it is given life either from the user or from the disk-bound data; its fields can then change, but those changes are not reflected on disk until .write_record() is called; I do thi

bash/shell to python

2012-05-16 Thread Rita
Hello, I currently build a lot of interfaces/wrappers to other applications using bash/shell. One short coming for it is it lacks a good method to handle arguments so I switched to python a while ago to use 'argparse' module. Its a great complement to subprocess module. I was wondering if there is

Newbie questions on import & cmd line run

2012-05-16 Thread gwhite
Hi, I am a newbie running the latest pythonxy (2.7.2.1) & spyder and python 2.7.2. I suspect my questions are mostly basic to python, and not specific to Spyder or iPython. Note: Up until now, I mainly used MATLAB, and thus need to de-program myself appropriately. I use Win7-64. I wrote the f

Re: cPython, IronPython, Jython, and PyPy (Oh my!)

2012-05-16 Thread Tim Delaney
On 17 May 2012 11:13, Chris Angelico wrote: > On Thu, May 17, 2012 at 9:01 AM, Ethan Furman wrote: > > A record is an interesting critter -- it is given life either from the > user > > or from the disk-bound data; its fields can then change, but those > changes > > are not reflected on disk unt

Re: cPython, IronPython, Jython, and PyPy (Oh my!)

2012-05-16 Thread Chris Angelico
On Thu, May 17, 2012 at 9:01 AM, Ethan Furman wrote: > A record is an interesting critter -- it is given life either from the user > or from the disk-bound data;  its fields can then change, but those changes > are not reflected on disk until .write_record() is called;  I do this > because I am fr

Re: non-pickle persistance for dicts?

2012-05-16 Thread Devin Jeanpierre
On Wed, May 16, 2012 at 6:53 PM, Charles Hixson wrote: > Thanks.  It looks like either would do what I need.  Any suggestion as to > how to choose between them?  E.g., is AST better supported?  faster?  (I'm > tending towards AST purely because it seems more tied to Python, but of > course that *c

Re: Difference between str.isdigit() and str.isdecimal() in Python 3

2012-05-16 Thread Steven D'Aprano
On Wed, 16 May 2012 17:48:19 +0200, Marco wrote: > Hi all, because > > "There should be one-- and preferably only one --obvious way to do it", > > there should be a difference between the two methods in the subject, but > I can't find it: The Fine Manual has more detail, although I admit it isn

Re: cPython, IronPython, Jython, and PyPy (Oh my!)

2012-05-16 Thread Ethan Furman
Tim Delaney wrote: On 17 May 2012 07:33, Ethan Furman wrote: Just hit a snag: In cPython the deterministic garbage collection allows me a particular optimization when retrieving records from a dbf file -- namely, by using weakrefs I can tell if the record is still in memory and active, and if s

Re: non-pickle persistance for dicts?

2012-05-16 Thread Ian Kelly
On Wed, May 16, 2012 at 4:53 PM, Charles Hixson wrote: > On 05/16/2012 03:11 PM, Ian Kelly wrote: >> >> On Wed, May 16, 2012 at 3:52 PM, Charles Hixson >>  wrote: >> >>> >>> I want to persist simple dicts, but due to the security problems with >>> (un)pickle, I'd prefer to not use shelve, and the

Re: non-pickle persistance for dicts?

2012-05-16 Thread Charles Hixson
On 05/16/2012 03:11 PM, Ian Kelly wrote: On Wed, May 16, 2012 at 3:52 PM, Charles Hixson wrote: I want to persist simple dicts, but due to the security problems with (un)pickle, I'd prefer to not use shelve, and the only way I could see to persist them onto sqlite also invoked pickle. As

Re: cPython, IronPython, Jython, and PyPy (Oh my!)

2012-05-16 Thread Ethan Furman
Ian Kelly wrote: On Wed, May 16, 2012 at 3:33 PM, Ethan Furman wrote: Just hit a snag: In cPython the deterministic garbage collection allows me a particular optimization when retrieving records from a dbf file -- namely, by using weakrefs I can tell if the record is still in memory and active

Re: How to call and execute C code in Python?

2012-05-16 Thread Barry Scott
There are many choices rather then raw python C API calls. Boost, PyCXX and ctypes are worth investigating. PyCXX requires you code in C++ but hides lots of the issues of using the Python API from you. It also supports python 2 and 3. Barry - PyCXX maintainer -- http://mail.python.org/mailma

Re: cPython, IronPython, Jython, and PyPy (Oh my!)

2012-05-16 Thread Tim Delaney
On 17 May 2012 07:33, Ethan Furman wrote: > Just hit a snag: > > In cPython the deterministic garbage collection allows me a particular > optimization when retrieving records from a dbf file -- namely, by using > weakrefs I can tell if the record is still in memory and active, and if so > not hit

Re: non-pickle persistance for dicts?

2012-05-16 Thread Ian Kelly
On Wed, May 16, 2012 at 3:52 PM, Charles Hixson wrote: > I want to persist simple dicts, but due to the security problems with > (un)pickle, I'd prefer to not use shelve, and the only way I could see to > persist them onto sqlite also invoked pickle. > > As (un)pickle allows arbitrary system comma

Re: cPython, IronPython, Jython, and PyPy (Oh my!)

2012-05-16 Thread Ian Kelly
On Wed, May 16, 2012 at 3:33 PM, Ethan Furman wrote: > Just hit a snag: > > In cPython the deterministic garbage collection allows me a particular > optimization when retrieving records from a dbf file -- namely, by using > weakrefs I can tell if the record is still in memory and active, and if so

non-pickle persistance for dicts?

2012-05-16 Thread Charles Hixson
I want to persist simple dicts, but due to the security problems with (un)pickle, I'd prefer to not use shelve, and the only way I could see to persist them onto sqlite also invoked pickle. As (un)pickle allows arbitrary system commands to be issued, I'd really rather just use a simple convert

Re: Difference between str.isdigit() and str.isdecimal() in Python 3

2012-05-16 Thread Ian Kelly
On Wed, May 16, 2012 at 3:07 PM, Thomas 'PointedEars' Lahn wrote: > RTFM. > > $ python3 -c 'print("42".isdecimal.__doc__ + "\n"); > print("42".isdigit.__doc__)' > S.isdecimal() -> bool > > Return True if there are only decimal characters in S, > False otherwise. > > S.isdigit() -> bool > > Return

cPython, IronPython, Jython, and PyPy (Oh my!)

2012-05-16 Thread Ethan Furman
Just hit a snag: In cPython the deterministic garbage collection allows me a particular optimization when retrieving records from a dbf file -- namely, by using weakrefs I can tell if the record is still in memory and active, and if so not hit the disk to get the data; with PyPy (and probably

Re: Difference between str.isdigit() and str.isdecimal() in Python 3

2012-05-16 Thread Thomas 'PointedEars' Lahn
Marco wrote: > Hi all, because > > "There should be one-- and preferably only one --obvious way to do it", > > there should be a difference between the two methods in the subject, but > I can't find it: > > >>> '123'.isdecimal(), '123'.isdigit() > (True, True) > >>> print('\u0660123') > ٠123

Re: which book?

2012-05-16 Thread Ashraf Fouda
I recommend this book :- "beginning python from novice to professional" On Wed, May 9, 2012 at 4:13 PM, Miki Tebeka wrote: > > I am going to learn python for some plot issues. which book or sources, > do you recommend please? > The tutorial is pretty good if you already know how to program. > I

Re: Difference between str.isdigit() and str.isdecimal() in Python 3

2012-05-16 Thread jmfauth
On 16 mai, 17:48, Marco wrote: > Hi all, because > > "There should be one-- and preferably only one --obvious way to do it", > > there should be a difference between the two methods in the subject, but > I can't find it: > >  >>> '123'.isdecimal(), '123'.isdigit() > (True, True) >  >>> print('\u06

Re: Difference between str.isdigit() and str.isdecimal() in Python 3

2012-05-16 Thread Marco
On 05/16/2012 06:24 PM, Ulrich Eckhardt wrote: Marco wrote: >>>> '123'.isdecimal(), '123'.isdigit() > (True, True) >>>> print('\u0660123') > ٠123 >>>> '\u0660123'.isdigit(), '\u0660123'.isdecimal() > (True, True) >>>> print('\u216B') > Ⅻ >>>> '\u216B'.isdecimal(), '

Re: How to embed python2 into python3?

2012-05-16 Thread Ian Kelly
On Wed, May 16, 2012 at 8:59 AM, ytj wrote: > Hello, all: > > I have two programs, one is written in py3k, the other is written in > python 2. I am wondering how to make them work together except port > the python 2 code to py3k? Is that possible to expose python2's > function to py3k? In other wo

Re: How to embed python2 into python3?

2012-05-16 Thread Chris Rebert
On Wed, May 16, 2012 at 7:59 AM, ytj wrote: > Hello, all: > > I have two programs, one is written in py3k, the other is written in > python 2. I am wondering how to make them work together except port > the python 2 code to py3k? Porting the Python 3 code to Python 2 is also an option: http://pyp

Re: Difference between str.isdigit() and str.isdecimal() in Python 3

2012-05-16 Thread Ian Kelly
On Wed, May 16, 2012 at 10:24 AM, Ulrich Eckhardt wrote: > Marco wrote: >>  >>> '123'.isdecimal(), '123'.isdigit() >> (True, True) >>  >>> print('\u0660123') >> ٠123 >>  >>> '\u0660123'.isdigit(), '\u0660123'.isdecimal() >> (True, True) >>  >>> print('\u216B') >> Ⅻ >>  >>> '\u216B'.isdecimal(), '\

Re: Difference between str.isdigit() and str.isdecimal() in Python 3

2012-05-16 Thread Ulrich Eckhardt
Marco wrote: > >>> '123'.isdecimal(), '123'.isdigit() > (True, True) > >>> print('\u0660123') > ٠123 > >>> '\u0660123'.isdigit(), '\u0660123'.isdecimal() > (True, True) > >>> print('\u216B') > Ⅻ > >>> '\u216B'.isdecimal(), '\u216B'.isdigit() > (False, False) [chr(a) for a in range(0x2) if

Re: Difference between str.isdigit() and str.isdecimal() in Python 3

2012-05-16 Thread MRAB
On 16/05/2012 16:48, Marco wrote: Hi all, because "There should be one-- and preferably only one --obvious way to do it", there should be a difference between the two methods in the subject, but I can't find it: >>> '123'.isdecimal(), '123'.isdigit() (True, True) >>> print('\u0660123') ٠

Re: Difference between str.isdigit() and str.isdecimal() in Python 3

2012-05-16 Thread Ian Kelly
On Wed, May 16, 2012 at 9:48 AM, Marco wrote: > Hi all, because > > "There should be one-- and preferably only one --obvious way to do it", > > there should be a difference between the two methods in the subject, but I > can't find it: > '123'.isdecimal(), '123'.isdigit() > (True, True)

what does newP = func(code,p) do?

2012-05-16 Thread e-mail mgbg25171
It's been a long time since I did any Python and I've never done that In C I'm used to storing function ptrs and then having to use some other constructs to call them. To be able to store func and then use func to call itself like that threw me...it's very elegant. Thank you very much for your very

Difference between str.isdigit() and str.isdecimal() in Python 3

2012-05-16 Thread Marco
Hi all, because "There should be one-- and preferably only one --obvious way to do it", there should be a difference between the two methods in the subject, but I can't find it: >>> '123'.isdecimal(), '123'.isdigit() (True, True) >>> print('\u0660123') ٠123 >>> '\u0660123'.isdigit(), '\u06601

Re: what does newP = func(code,p) do?

2012-05-16 Thread Ian Kelly
On Wed, May 16, 2012 at 8:08 AM, e-mail mgbg25171 wrote: > def execute (code) : >     p = 0 >     while p < len(code) : >     func = code[p] >     p += 1 >     newP = func(code,p) >     if newP != None : >     p = newP > > I'm trying to work out what this does > > code

How to embed python2 into python3?

2012-05-16 Thread ytj
Hello, all: I have two programs, one is written in py3k, the other is written in python 2. I am wondering how to make them work together except port the python 2 code to py3k? Is that possible to expose python2's function to py3k? In other words, I want to embed the Python 2 interpreter into my py

Re: python and xml

2012-05-16 Thread Stefan Behnel
Hi, please don't top-post (I fixed the citation order below). Nibin V M, 16.05.2012 16:30: > On Wed, May 16, 2012 at 7:53 PM, Stefan Behnel wrote: >> Nibin V M, 16.05.2012 16:16: >>> I am trying to use cPanel XML-API and every API call return data in XML >>> format. I would like to know how to m

Re: python and xml

2012-05-16 Thread Nibin V M
thank you Stefan. but the XML output is assigned to a variable; how to process the variable with XML contents? On Wed, May 16, 2012 at 7:53 PM, Stefan Behnel wrote: > Nibin V M, 16.05.2012 16:16: > > I am trying to use cPanel XML-API and every API call return data in XML > > format. I would like

Wing IDE 4.1.6 released

2012-05-16 Thread Wingware
Hi, Wingware has released version 4.1.6 of Wing IDE, an integrated development environment designed specifically for the Python programming language. Wing IDE is a cross-platform Python IDE that provides a professional code editor with vi, emacs, and other key bindings, auto-completion, call tip

Re: python and xml

2012-05-16 Thread Stefan Behnel
Nibin V M, 16.05.2012 16:16: > I am trying to use cPanel XML-API and every API call return data in XML > format. I would like to know how to manipulate the data here. > > For eg: How can I read the CPU load data from the below output > > > > 0.000.000.00 Here's some untested code to print the

python and xml

2012-05-16 Thread Nibin V M
Hi, I am trying to use cPanel XML-API and every API call return data in XML format. I would like to know how to manipulate the data here. For eg: How can I read the CPU load data from the below output 0.000.000.00 Thank you, -- Regards Nibin. -- http://mail.python.org/mailman/listinfo/

what does newP = func(code,p) do?

2012-05-16 Thread e-mail mgbg25171
def execute (code) : p = 0 while p < len(code) : func = code[p] p += 1 newP = func(code,p) if newP != None : p = newP I'm trying to work out what this does code is a list of function addresses and numbers What on earth is funct(code,p) doing

Re: Good data structure for finding date intervals including a given date

2012-05-16 Thread Jean-Daniel
On Sun, May 13, 2012 at 2:29 PM, Alec Taylor wrote: > There is an ordered dict type since Python 3.1[1] and Python 2.7.3[2]. Ordered dict are useful, but they only remember the ordered in which they were added, you can not order them a on key. Thanks for the links. > > If you are looking for th

Re: ucs2 and ucs4 python

2012-05-16 Thread Dave Angel
On 05/16/2012 05:20 AM, zayatzz wrote: > On May 16, 11:50 am, Matej Cepl wrote: >> On 16.5.2012 10:36, zayatzz wrote: >> >>> /opt/bin/python^M: bad interpreter: No such file or directory >> Your script has CRLF end-of-lines. Change it to plain Unix LF. >> >> Matěj > Thanks :) but i have no idea wh

Re: ucs2 and ucs4 python

2012-05-16 Thread zayatzz
On May 16, 11:50 am, Matej Cepl wrote: > On 16.5.2012 10:36, zayatzz wrote: > > > /opt/bin/python^M: bad interpreter: No such file or directory > > Your script has CRLF end-of-lines. Change it to plain Unix LF. > > Matěj Thanks :) but i have no idea what that means or how to achieve that. Alan -

Re: ucs2 and ucs4 python

2012-05-16 Thread Chris Angelico
On Wed, May 16, 2012 at 6:36 PM, zayatzz wrote: > There is one problem though... > > when i start script with shebang like > #!/opt/bin/python > > and then try to run the script i get: > > /opt/bin/python^M: bad interpreter: No such file or directory You have a Windows end-of-line \r\n instead of

Re: ucs2 and ucs4 python

2012-05-16 Thread Matej Cepl
On 16.5.2012 10:36, zayatzz wrote: /opt/bin/python^M: bad interpreter: No such file or directory Your script has CRLF end-of-lines. Change it to plain Unix LF. Matěj -- http://mail.python.org/mailman/listinfo/python-list

Re: ucs2 and ucs4 python

2012-05-16 Thread Stefan Behnel
zayatzz, 16.05.2012 10:22: > On May 15, 7:42 pm, Miki Tebeka wrote: >>> Can someone point me towards a resource or two which will tell me how >>> to do this - im not very good with whole linux/servers stuff. Im using >>> ubuntu linux - if that makes any difference. >> >> Did not test, but this is t

Re: ucs2 and ucs4 python

2012-05-16 Thread zayatzz
There is one problem though... when i start script with shebang like #!/opt/bin/python and then try to run the script i get: /opt/bin/python^M: bad interpreter: No such file or directory /opt/bin/python /opt/bin/python2 /opt/bin/python2.7 all start this new version of python, but none of those

Re: ucs2 and ucs4 python

2012-05-16 Thread zayatzz
On May 15, 7:42 pm, Miki Tebeka wrote: > > Can someone point me towards a resource or two which will tell me how > > to do this - im not very good with whole linux/servers stuff. Im using > > ubuntu linux - if that makes any difference. > > Did not test, but this is the direction I would take: > *

ANN: eGenix pyOpenSSL Distribution 0.13.0-1.0.0j

2012-05-16 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com pyOpenSSL Distribution Version 0.13.0-1.0.0j An easy-to-install and easy-to-use distribution of the pyOpenSSL Python interface for