Re: Suggestion Reqd for Designing a Website in Python

2011-02-24 Thread Tim Roberts
joy99 wrote: > >Dear Group, >I have developed one big Machine Learning software a Machine >Translation system in Python. >Now, I am thinking to make a User Interface of it and upload it in a >web site. Do you mean you want people to download this from a web site as an executable, and then run it

Re: wxPython SQLite and Reportlab demo

2011-02-24 Thread Tim Roberts
Beppe wrote: > >I would recommend this my little work on sourceforge. > > http://sourceforge.net/projects/pyggybank/ > >you can download an exe (pyggy_w32.7z) make with py2exe >and the source (pyggy_source.7z) >the project is named Pyggy Bank. Nowhere, in either this announcement or your source

Re: py3k: converting int to bytes

2011-02-24 Thread Terry Reedy
On 2/24/2011 9:25 PM, John Machin wrote: On Feb 25, 4:39 am, Terry Reedy wrote: Note: an as yet undocumented feature of bytes (at least in Py3) is that bytes(count) == bytes()*count == b'\x00'*count. Python 3.1.3 docs for bytes() say same constructor args as for bytearray(); this says about t

Re: Is this a safe use of eval?

2011-02-24 Thread Nobody
On Thu, 24 Feb 2011 15:24:51 +0200, Frank Millman wrote: > Thanks, Christian. I had a look at that recipe, but I must say that Paul's > suggestion is much simpler - > >from ast import literal_eval >method_name = 'calc_area' >args = literal_eval('(100,200)') >result = getattr(my_i

Re: py3k: converting int to bytes

2011-02-24 Thread John Machin
On Feb 25, 4:39 am, Terry Reedy wrote: > Note: an as yet undocumented feature of bytes (at least in Py3) is that > bytes(count) == bytes()*count == b'\x00'*count. Python 3.1.3 docs for bytes() say same constructor args as for bytearray(); this says about the source parameter: """If it is an integ

Re: Python fails on math

2011-02-24 Thread Westley Martínez
On Fri, 2011-02-25 at 00:57 +, Grant Edwards wrote: > On 2011-02-25, Westley Mart?nez wrote: > > > Maybe I'm wrong, but wouldn't compiling Python with a compiler that > > supports extended precision for intermediates allow Python to use > > extended precision for its immediates? > > I'm not

Re: Python fails on math

2011-02-24 Thread Grant Edwards
On 2011-02-25, Westley Mart?nez wrote: > Maybe I'm wrong, but wouldn't compiling Python with a compiler that > supports extended precision for intermediates allow Python to use > extended precision for its immediates? I'm not sure what you mean by "immediates", but I don't think so. For the C c

Re: Python fails on math

2011-02-24 Thread Grant Edwards
On 2011-02-25, Steven D'Aprano wrote: >> C double *variables* are, but as John suggests, C compilers are allowed >> (to my knowledge) to keep intermediate results of an expression in the >> larger-precision FPU registers. The final result does get shoved back >> into a 64-bit double when it is at

Re: Python fails on math

2011-02-24 Thread Westley Martínez
On Fri, 2011-02-25 at 00:33 +, Steven D'Aprano wrote: > On Thu, 24 Feb 2011 10:40:45 -0600, Robert Kern wrote: > > > On 2/24/11 5:55 AM, Steven D'Aprano wrote: > >> On Wed, 23 Feb 2011 13:26:05 -0800, John Nagle wrote: > >> > >>> The IEEE 754 compliant FPU on most machines today, though, has a

Re: lxml

2011-02-24 Thread alex23
On Feb 24, 6:20 pm, Stefan Behnel wrote: > MRAB, 24.02.2011 01:25: > > The latest stable release is here: > > >http://pypi.python.org/pypi/lxml/2.2.8 > > Not quite the latest "stable release" (that would be 2.3), but at least one > that's pre-built for Windows. Christoph Gohlke has an 'unofficial

Re: Newbie...

2011-02-24 Thread Steven D'Aprano
On Thu, 24 Feb 2011 19:22:52 +, wisecracker wrote: > As I know of no other way to give my Python code away I thought I`d join > here. It would be far more appropriate to *ask* where to put your code *first* rather than to just dump 350+ lines of double-spaced(!) code into people's inboxes,

Re: Python fails on math

2011-02-24 Thread Steven D'Aprano
On Thu, 24 Feb 2011 10:40:45 -0600, Robert Kern wrote: > On 2/24/11 5:55 AM, Steven D'Aprano wrote: >> On Wed, 23 Feb 2011 13:26:05 -0800, John Nagle wrote: >> >>> The IEEE 754 compliant FPU on most machines today, though, has an >>> 80-bit internal representation. If you do a sequence of operati

Re: Why this difference?

2011-02-24 Thread Steven D'Aprano
On Thu, 24 Feb 2011 13:58:28 +0100, Paul Anton Letnes wrote: > Den 24.02.11 13.41, skrev n00m: >> The 1st "False" is not surprising for me. It's the 2nd "True" is a bit >> hmmm... ok, it doesn't matter == >> Have a nice day! > > I am no expert, but I think python re-uses some

Re: n00b formatting

2011-02-24 Thread Tim Chase
On 02/24/2011 04:46 PM, Verde Denim wrote: On Thu, Feb 24, 2011 at 12:49 PM, MRAB wrote: On 24/02/2011 16:41, Verde Denim wrote: x = '0D' y = '0x' + x print "%d" % int(y,0) TypeError: 'int' object is not callable what am i not seeing here?? I can only assume that at some point you assign

Re: n00b formatting

2011-02-24 Thread Verde Denim
On Thu, Feb 24, 2011 at 12:23 PM, Chris Rebert wrote: > On Thu, Feb 24, 2011 at 8:41 AM, Verde Denim wrote: > > hi, all > > i can't believe i don't see this, but > > python from the command line: > x = '0D' > y = '0x' + x > print "%d" % int(y,0) > > 13 > > > > content of testme.py

Re: n00b formatting

2011-02-24 Thread Verde Denim
On Thu, Feb 24, 2011 at 12:49 PM, MRAB wrote: > On 24/02/2011 16:41, Verde Denim wrote: > >> hi, all >> i can't believe i don't see this, but >> python from the command line: >> >>> x = '0D' >> >>> y = '0x' + x >> >>> print "%d" % int(y,0) >> 13 >> >> content of testme.py: >> x = '0D' >> y = '

Windows 7 Environment Setup - Python, R, mySQL

2011-02-24 Thread grobs456
I am following along with this tutorial/post: http://www.walkerjeff.com/2011/02/python-to-r-via-mysql-on-windows-7-x64/ I am visualizing trying to setup some type of real world data/ interactions and stumbled upon this article. I am also on a 64bit Windows 7 machine. I am rusty in a sense as I ha

Suggestion Reqd for Designing a Website in Python

2011-02-24 Thread joy99
Dear Group, I have developed one big Machine Learning software a Machine Translation system in Python. Now, I am thinking to make a User Interface of it and upload it in a web site. My questions are: (i) For Designing an interface I am choosing Tkinter. Is it fine? (ii) How to connect this interfa

Re: Why this difference?

2011-02-24 Thread n00m
@nn, @Terry Reedy: Good reading. Thanks. In fact now the case is closed. -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie...

2011-02-24 Thread wisecracker
Hi Martin... >> I am new to this list so treat me gently... ;o) > I for one welcome you :-) Many thanks... > Thanks for sharing and happy sharing! Now working on a simple home made seismometer and single channel audio oscilloscope using the recording technique previously posted, all in standar

share info between methods in a Class

2011-02-24 Thread Garcia, Paul D
What is the best way to access/change list or dictionary information between methods in the same class? Note : I would normally have the input_list originally populate by reading in a file. Currently I have: class Action: def __init__(self): self.input_List = list()

Re: How can I define __getattr__ to operate on all items of container and pass arguments?

2011-02-24 Thread Jeremy
On Tuesday, February 15, 2011 2:58:11 PM UTC-7, Jeremy wrote: > > > So the arguments haven't yet been passed when __getattr__() is > > invoked. Instead, you must return a function from __getattr__(); this > > function will then get called with the arguments. Thus (untested): > > > > def __getattr

Re: Newbie...

2011-02-24 Thread Martin P. Hellwig
On 02/24/11 19:22, wisecrac...@tesco.net wrote: Hi all... I am new to this list so treat me gently... ;o) I for one welcome you :-) I use Python almost totally differently to the vast majority of people. I like "banging the metal". Well I can assure you that although you might be indeed i

Re: 2to3 chokes on bad character

2011-02-24 Thread John Machin
On Feb 25, 12:00 am, Peter Otten <__pete...@web.de> wrote: > John Machin wrote: > > Your Python 2.x code should be TESTED before you poke 2to3 at it. In > > this case just trying to run or import the offending code file would > > have given an informative syntax error (you have declared the .py fi

Newbie...

2011-02-24 Thread wisecracker
Hi all... I am new to this list so treat me gently... ;o) I use Python almost totally differently to the vast majority of people. I like "banging the metal". As I know of no other way to give my Python code away I thought I`d join here. I only use STANDARD Python, no extras... Here are a coup

Re: What is the preferred way to sort/compare custom objects?

2011-02-24 Thread Jeremy
On Thursday, February 24, 2011 10:09:53 AM UTC-7, Chris Rebert wrote: > On Thu, Feb 24, 2011 at 8:27 AM, Jeremy wrote: > > I just discovered the wiki page on sorting > > (http://wiki.python.org/moin/HowTo/Sorting/).  This describes the new way > > of sorting a container instead of using the cmp

Re: n00b formatting

2011-02-24 Thread MRAB
On 24/02/2011 16:41, Verde Denim wrote: hi, all i can't believe i don't see this, but python from the command line: >>> x = '0D' >>> y = '0x' + x >>> print "%d" % int(y,0) 13 content of testme.py: x = '0D' y = '0x' + x print "%d" % int(y,0) TypeError: 'int' object is not callable what am i n

Re: Python C Extensions

2011-02-24 Thread MRAB
On 24/02/2011 16:46, aken8...@yahoo.com wrote: Thank you very much, it worked. I thought the PyDict_SetItem should assume ownership of the passed object and decrease it's reference count (I do not know why). Does this also go for the Lists ? Should anything inserted into list also be DECRED-ed ?

Re: Preferred method of sorting/comparing custom objects

2011-02-24 Thread Ian Kelly
On Thu, Feb 24, 2011 at 9:41 AM, Jeremy wrote: > I recently found the wiki page on sorting > (http://wiki.python.org/moin/HowTo/Sorting/).  This page describes the new > key parameter to the sort and sorted functions. > > What about custom objects?  Can I just write __lt__, __gt__, etc. function

Re: py3k: converting int to bytes

2011-02-24 Thread Terry Reedy
On 2/24/2011 11:19 AM, s...@uce.gov wrote: Is there a better way to convert int to bytes then going through strings: x=5 str(x).encode() (This being Py3) If 0 <= x <= 9, bytes((ord('0')+n,)) will work. Otherwise, no. You would have to do the same thing str(int) does, which is to reverse the

Re: Python C Extensions

2011-02-24 Thread Carl Banks
On Feb 24, 8:46 am, "aken8...@yahoo.com" wrote: > Thank you very much, it worked. > I thought the PyDict_SetItem should assume ownership > of the passed object and decrease it's reference count (I do not know > why). > > Does this also go for the Lists ? Should anything inserted into list > also >

Re: n00b formatting

2011-02-24 Thread Chris Rebert
On Thu, Feb 24, 2011 at 8:41 AM, Verde Denim wrote: > hi, all > i can't believe i don't see this, but > python from the command line: x = '0D' y = '0x' + x print "%d" % int(y,0) > 13 > > content of testme.py: Is this the *entire* contents of the file? I suspect not, and that somewh

Re: Preferred method of sorting/comparing custom objects

2011-02-24 Thread Chris Rebert
On Thu, Feb 24, 2011 at 8:41 AM, Jeremy wrote: > I recently found the wiki page on sorting > (http://wiki.python.org/moin/HowTo/Sorting/).  This page describes the new > key parameter to the sort and sorted functions. > > What about custom objects?  Can I just write __lt__, __gt__, etc. function

Re: Why this difference?

2011-02-24 Thread Terry Reedy
On 2/24/2011 7:19 AM, n00m wrote: file my.txt: === 0 beb 1 qwe 2 asd 3 hyu 4 zed 5 asd 6 oth = py script: === import sys sys.stdin = open('88.txt', 'r') t = sys.stdin.readlines() t = map(lambda rec: rec.split()

Re: What is the preferred way to sort/compare custom objects?

2011-02-24 Thread Chris Rebert
On Thu, Feb 24, 2011 at 8:27 AM, Jeremy wrote: > I just discovered the wiki page on sorting > (http://wiki.python.org/moin/HowTo/Sorting/).  This describes the new way of > sorting a container instead of using the cmp function.  But what do I do for > custom objects? > If I write __lt__, __gt__

Re: 2to3 chokes on bad character

2011-02-24 Thread Terry Reedy
On 2/24/2011 8:11 AM, Frank Millman wrote: future I will run some tests when betas are released, just in case I come up with something. Please do, perhaps more than once. The test suite coverage is being improved but is not 100%. The day *after* 3.2.0 was released, someone reported an unplea

Re: Preferred method of sorting/comparing custom objects

2011-02-24 Thread Jeremy
Sorry for double posting. Google Groups was acting funny this morning. -- http://mail.python.org/mailman/listinfo/python-list

Re: Running Scripts vs Interactive mode

2011-02-24 Thread grobs456
On Feb 24, 11:32 am, Dave Angel wrote: > On 01/-10/-28163 02:59 PM, grobs456 wrote: > > > > > #I set my system environment variables to: > > > VARIABLE           VALUE > > PYTHON_HOME                c:\python27\python.exe > > PATH                       ...;%PYTHON_HOME% > > > #after also trying t

Re: What is the preferred way to sort/compare custom objects?

2011-02-24 Thread Jeremy
Sorry for double posting. Google Groups was acting funny this morning. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python C Extensions

2011-02-24 Thread aken8...@yahoo.com
Thank you very much, it worked. I thought the PyDict_SetItem should assume ownership of the passed object and decrease it's reference count (I do not know why). Does this also go for the Lists ? Should anything inserted into list also be DECRED-ed ? Thank you again for reply. On Feb 24, 11:33 am

Preferred method of sorting/comparing custom objects

2011-02-24 Thread Jeremy
I recently found the wiki page on sorting (http://wiki.python.org/moin/HowTo/Sorting/). This page describes the new key parameter to the sort and sorted functions. What about custom objects? Can I just write __lt__, __gt__, etc. functions and not have to worry about the key parameter? Is t

n00b formatting

2011-02-24 Thread Verde Denim
hi, all i can't believe i don't see this, but python from the command line: >>> x = '0D' >>> y = '0x' + x >>> print "%d" % int(y,0) 13 content of testme.py: x = '0D' y = '0x' + x print "%d" % int(y,0) TypeError: 'int' object is not callable what am i not seeing here?? -- http://mail.python.org/m

Re: Python fails on math

2011-02-24 Thread Robert Kern
On 2/24/11 5:55 AM, Steven D'Aprano wrote: On Wed, 23 Feb 2011 13:26:05 -0800, John Nagle wrote: The IEEE 754 compliant FPU on most machines today, though, has an 80-bit internal representation. If you do a sequence of operations that retain all the intermediate results in the FPU registers, y

What is the preferred way to sort/compare custom objects?

2011-02-24 Thread Jeremy
I just discovered the wiki page on sorting (http://wiki.python.org/moin/HowTo/Sorting/). This describes the new way of sorting a container instead of using the cmp function. But what do I do for custom objects? If I write __lt__, __gt__, etc. functions for my objects, will these be used? Is

Re: Python C Extensions

2011-02-24 Thread MRAB
On 24/02/2011 16:01, aken8...@yahoo.com wrote: Hi, I have a memory leak problem with my "C" extension module. My C module returns large dictionaries to python, and the dictionaries never get deleted, so the memory for my program keeps growing. I do not know how to delete the dictionary object a

Re: Running Scripts vs Interactive mode

2011-02-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, grobs456 wrote: #I set my system environment variables to: VARIABLEVALUE PYTHON_HOME c:\python27\python.exe PATH...;%PYTHON_HOME% #after also trying this: VARIABLEVALUE PYTHON_HOME c:\python2

py3k: converting int to bytes

2011-02-24 Thread spam
Is there a better way to convert int to bytes then going through strings: x=5 str(x).encode() Thanks. -- Yves. http://www.SollerS.ca/ http://blog.zioup.org/ -- http://mail.python.org/mailma

Re: pattern matching

2011-02-24 Thread Jon Clements
On Feb 24, 2:11 am, monkeys paw wrote: > if I have a string such as '01/12/2011' and i want > to reformat it as '20110112', how do i pull out the components > of the string and reformat them into a DDMM format? > > I have: > > import re > > test = re.compile('\d\d\/') > f = open('test.html')  

Python C Extensions

2011-02-24 Thread aken8...@yahoo.com
Hi, I have a memory leak problem with my "C" extension module. My C module returns large dictionaries to python, and the dictionaries never get deleted, so the memory for my program keeps growing. I do not know how to delete the dictionary object after it becomes irrelevant. I do not know if the

Re: Unload a DLL

2011-02-24 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Sathish S wrote: Hi Ppl, I'm loading a dll using the *cdll.LoadLibrary *function. How can I release the dll after I'm done with it. Are there any functions to do this. Thanks, Sathish In Windows, the FreeLibrary() call will decrement the load count, and unload the

Re: Running Scripts vs Interactive mode

2011-02-24 Thread Benjamin Kaplan
On Thu, Feb 24, 2011 at 10:34 AM, grobs456 wrote: > c:\dev\python>python HelloWorld.py > 'python' is not recognized as an internal or external command, > operable program or batch file. > > #I then tried this for a success!: > > c:\dev\python>c:\python27\python.exe HelloWorld.py > Hello WOrld! > >

Re: Running Scripts vs Interactive mode

2011-02-24 Thread grobs456
c:\dev\python>python HelloWorld.py 'python' is not recognized as an internal or external command, operable program or batch file. #I then tried this for a success!: c:\dev\python>c:\python27\python.exe HelloWorld.py Hello WOrld! c:\dev\python>python HelloWorld.py 'python' is not recognized as an

Re: Python fails on math

2011-02-24 Thread Mel
D'Arcy J.M. Cain wrote: > On Thu, 24 Feb 2011 04:56:46 -0800 > Ethan Furman wrote: >> > That's a big if though. Which languages support such a thing? C doubles >> > are 64 bit, same as Python. >> >> Assembly! :) > > Really? Why would you need that level of precision just to gather all > the s

Re: [PySIL] Securing files

2011-02-24 Thread Software-Develop Philippines
Greetings, > The problem isn't so much the database itself, > as I can think of a number of way to encrypt the data it contains, > but some of the data is simply names of image and video files > contained elsewhere in the file-system. Actually, this is something like I had to think through with a

Today's Hottest actresses

2011-02-24 Thread Ashraf Ali
Hello friends. Would you like to know about bollywood hot and beautiful actresses?You can fine a lot of information about bollywood actresses.Just visit www.hotpics00.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Python fails on math

2011-02-24 Thread D'Arcy J.M. Cain
On Thu, 24 Feb 2011 04:56:46 -0800 Ethan Furman wrote: > >> The IEEE 754 compliant FPU on most machines today, though, has an 80-bit > >> internal representation. If you do a sequence of operations that retain > >> all the intermediate results in the FPU registers, you get 16 more bits > >> of pr

Re: Why this difference?

2011-02-24 Thread n00m
> Don't rely on it. Hmm I never was about to rely on it. Simply sorta my academic curiosity. -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a safe use of eval?

2011-02-24 Thread Frank Millman
"Christian Heimes" wrote Am 24.02.2011 10:01, schrieb Peter Otten: How do you prevent that a malicious source sends you my_string = 'calc_area(__import__("os").system("rm important_file") or 100, 200)' instead? By using something like http://code.activestate.com/recipes/496746-restricted

Re: 2to3 chokes on bad character

2011-02-24 Thread Frank Millman
"Peter Otten" <__pete...@web.de> wrote John Machin wrote: Your Python 2.x code should be TESTED before you poke 2to3 at it. In this case just trying to run or import the offending code file would have given an informative syntax error (you have declared the .py file to be encoded in UTF-8 but

Re: 2to3 chokes on bad character

2011-02-24 Thread Frank Millman
"John Machin" wrote: On Feb 23, 7:47 pm, "Frank Millman" wrote: [snip lots of valuable info] The issue is not that 2to3 should handle this correctly, but that it should give a more informative error message to the unsuspecting user. Your Python 2.x code should be TESTED before you poke 2

Re: 2to3 chokes on bad character

2011-02-24 Thread Peter Otten
John Machin wrote: > On Feb 23, 7:47 pm, "Frank Millman" wrote: >> Hi all >> >> I don't know if this counts as a bug in 2to3.py, but when I ran it on my >> program directory it crashed, with a traceback but without any indication >> of which file caused the problem. >> > [traceback snipped] > >>

Re: Why this difference?

2011-02-24 Thread Paul Anton Letnes
Den 24.02.11 13.41, skrev n00m: The 1st "False" is not surprising for me. It's the 2nd "True" is a bit hmmm... ok, it doesn't matter == Have a nice day! I am no expert, but I think python re-uses some integer and string objects. For instance, if you create the object int(2)

Re: Python fails on math

2011-02-24 Thread Ethan Furman
Steven D'Aprano wrote: On Wed, 23 Feb 2011 13:26:05 -0800, John Nagle wrote: The IEEE 754 compliant FPU on most machines today, though, has an 80-bit internal representation. If you do a sequence of operations that retain all the intermediate results in the FPU registers, you get 16 more bits

Re: lxml

2011-02-24 Thread Colin J. Williams
On 24-Feb-11 03:20 AM, Stefan Behnel wrote: MRAB, 24.02.2011 01:25: On 24/02/2011 00:10, Colin J. Williams wrote: Could someone please let me know whether lxml is available for Windows XP?. If so, is it available for Python 2.7? The latest stable release is here: http://pypi.python.org/pypi/

Re: Why this difference?

2011-02-24 Thread n00m
The 1st "False" is not surprising for me. It's the 2nd "True" is a bit hmmm... ok, it doesn't matter == Have a nice day! -- http://mail.python.org/mailman/listinfo/python-list

Re: pattern matching

2011-02-24 Thread John S
On Feb 23, 9:11 pm, monkeys paw wrote: > if I have a string such as '01/12/2011' and i want > to reformat it as '20110112', how do i pull out the components > of the string and reformat them into a DDMM format? > > I have: > > import re > > test = re.compile('\d\d\/') > f = open('test.html')  

Why this difference?

2011-02-24 Thread n00m
file my.txt: === 0 beb 1 qwe 2 asd 3 hyu 4 zed 5 asd 6 oth = py script: === import sys sys.stdin = open('88.txt', 'r') t = sys.stdin.readlines() t = map(lambda rec: rec.split(), t) print t print t[2][1] == t[5][1

Re: 2to3 chokes on bad character

2011-02-24 Thread John Machin
On Feb 23, 7:47 pm, "Frank Millman" wrote: > Hi all > > I don't know if this counts as a bug in 2to3.py, but when I ran it on my > program directory it crashed, with a traceback but without any indication of > which file caused the problem. > [traceback snipped] > UnicodeDecodeError: 'utf8' codec

Re: Python fails on math

2011-02-24 Thread Steven D'Aprano
On Wed, 23 Feb 2011 13:26:05 -0800, John Nagle wrote: > The IEEE 754 compliant FPU on most machines today, though, has an 80-bit > internal representation. If you do a sequence of operations that retain > all the intermediate results in the FPU registers, you get 16 more bits > of precision than

Re: Is this a safe use of eval?

2011-02-24 Thread Christian Heimes
Am 24.02.2011 10:01, schrieb Peter Otten: > How do you prevent that a malicious source sends you > > my_string = 'calc_area(__import__("os").system("rm important_file") or 100, > 200)' > > instead? By using something like http://code.activestate.com/recipes/496746-restricted-safe-eval/ . With a

Unload a DLL

2011-02-24 Thread Sathish S
Hi Ppl, I'm loading a dll using the *cdll.LoadLibrary *function. How can I release the dll after I'm done with it. Are there any functions to do this. Thanks, Sathish -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes inheritance issue

2011-02-24 Thread Carl Banks
On Feb 23, 9:38 am, Steve wrote: > After looking at some metaclass examples it appears this information > is readily available. A metaclass gets a dictionary containing > information about the parent class (or should, at least). What examples did you look at? > It seems > like it must have thi

Re: Running Scripts vs Interactive mode

2011-02-24 Thread scattered
On Feb 23, 5:22 pm, grobs456 wrote: > Hi, > > I am trying to work through the tutorial at:http://docs.python.org/tutorial/ > > The issue I am facing is with regards to the discussion about > "Invoking the Interpreter" and "Executable Python Scripts". It was > rather hazy in my opinion. > > see:htt

Re: Struggling to convert a mysql datetime object to a python string of a different format

2011-02-24 Thread Corey Richardson
On 02/24/2011 04:34 AM, rahul mishra wrote: > try this > > test = time.time(2011, 2, 1, 2, 4, 10) > # this is your datetime object from mysql > > print time.mktime(test.timetuple()) > > hope this would help you > > You do realize that email was sent over four months ago, correct? See: >> On

Re: Struggling to convert a mysql datetime object to a python string of a different format

2011-02-24 Thread rahul mishra
try this test = time.time(2011, 2, 1, 2, 4, 10) # this is your datetime object from mysql print time.mktime(test.timetuple()) hope this would help you > On Wednesday, August 04, 2010 7:40 PM ? wrote: > Okey, i have many hours now struggling to convert a mysql datetime > field that i retr

Re: Is this a safe use of eval?

2011-02-24 Thread Ryan Kelly
On Thu, 2011-02-24 at 20:13 +1100, Ryan Kelly wrote: > On Thu, 2011-02-24 at 10:48 +0200, Frank Millman wrote: > > Hi all > > > > I know that the use of 'eval' is discouraged because of the dangers of > > executing untrusted code. > > > > Here is a variation that seems safe to me, but I could be

Re: Is this a safe use of eval?

2011-02-24 Thread Ryan Kelly
On Thu, 2011-02-24 at 10:48 +0200, Frank Millman wrote: > Hi all > > I know that the use of 'eval' is discouraged because of the dangers of > executing untrusted code. > > Here is a variation that seems safe to me, but I could be missing something. > > I have a class, and the class has one or m

Re: Is this a safe use of eval?

2011-02-24 Thread Frank Millman
Thanks, Paul and Peter. It seemed like a good idea at the time. Thank you for straightening me out. Frank -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a safe use of eval?

2011-02-24 Thread Peter Otten
Frank Millman wrote: > Hi all > > I know that the use of 'eval' is discouraged because of the dangers of > executing untrusted code. > > Here is a variation that seems safe to me, but I could be missing > something. > > I have a class, and the class has one or more methods which accept various

Re: Python for embedded systems?

2011-02-24 Thread Joachim Strömbergson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Aloha! On 2011:02:24 08:04 , Rafe Kettler wrote: > It's not a matter of language maturity, Python is very mature, it's a > matter of design. Python is a high-level, garbage-collected, > interpreted language, and that's not the ideal type of language f

Re: Is this a safe use of eval?

2011-02-24 Thread Paul Rubin
"Frank Millman" writes: > I then receive my_string = 'calc_area(100, 200)'. result = eval('my_inst.{0}'.format(my_string)) > This will only work if the string contains a valid method name with > valid arguments. > > Can anyone see anything wrong with this? Um, yes. What are valid arguments

Is this a safe use of eval?

2011-02-24 Thread Frank Millman
Hi all I know that the use of 'eval' is discouraged because of the dangers of executing untrusted code. Here is a variation that seems safe to me, but I could be missing something. I have a class, and the class has one or more methods which accept various arguments and return a result. I w

Re: lxml

2011-02-24 Thread Stefan Behnel
MRAB, 24.02.2011 01:25: On 24/02/2011 00:10, Colin J. Williams wrote: Could someone please let me know whether lxml is available for Windows XP?. If so, is it available for Python 2.7? The latest stable release is here: http://pypi.python.org/pypi/lxml/2.2.8 Not quite the latest "stable rel