Re: Python and CUDO

2007-09-07 Thread Paddy
On Sep 6, 10:12 pm, Robert Kern <[EMAIL PROTECTED]> wrote: > Veronika Lindstrand Kant wrote: > > Hi! > > I just wonder if there are any plans for building any support using > > NIVIDAS CUDO plattform into python? > > Not into Python itself, but we are working on interfacing with NVIDIA's CUDA, > ye

How to convert None to null value

2007-09-07 Thread pradeep kumar
Hi , i am trying to insert records from one table to another table in postgres sql using the the following code posConn.query("insert into usr(usr_id,usr_name,usr_passwd,grp_cde,usr_type,usr_chk_till_val, \ usr_active,usr_daily_auth,usr_lst_login,usr_lst_logout,usr_shift_id,usr_role_level) value

Re: unexpected behavior: did i create a pointer?

2007-09-07 Thread Wildemar Wildenburger
gu wrote: > hi to all! > after two days debugging my code, i've come to the point that the > problem was caused by an unexpected behaviour of python. or by lack of > some information about the program, of course! i've stripped down the > code to reproduce the problem: > > [snip FAQ] Yes, basic

Re: unexpected behavior: did i create a pointer?

2007-09-07 Thread Roel Schroeven
gu schreef: > copyOfA = a > > now, in the second "for" cycle and in functionA() i only 'touch' copyOfA > (altering it). copyOfA isn't a copy of a; it's a different name bound to the same object as a. You can verify that: id(a) and id(copyOfA) will return the same value. To make a copy of a (a

Re: unexpected behavior: did i create a pointer?

2007-09-07 Thread Marc 'BlackJack' Rintsch
On Fri, 07 Sep 2007 10:40:47 +, Steven D'Aprano wrote: > Nor does it include "peek" and "poke" commands for reading and writing > into random memory locations. I guess `ctypes` offers tools to write `peek()` and `poke()`. :-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.or

Re: So what exactly is a complex number?

2007-09-07 Thread Bjoern Schliessmann
Grzegorz S?odkowicz wrote: > Interesting. It appears that we are ran into a mathematical > cultural difference. Were I come from vectors *are* defined as > having four properties that I enumerated. After some research I > found that English sources (Wikipedia) indeed give the definition > you suppl

Re: Any syntactic cleanup likely for Py3? And what about doc standards?

2007-09-07 Thread Paul Boddie
On 7 Sep, 06:19, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On Sep 6, 12:56 pm, Paul Boddie <[EMAIL PROTECTED]> wrote: > > > I think there's been a widespread "kitchen sink" mentality around the > > Python language for some time, which is where the multimethods > > proposal, amongst others, fits in

Best practice prompting for password

2007-09-07 Thread GiBo
Hi, what's the best practice to securely prompt user for password on console in Python? IIRC some programs like SSH do a lot to ensure that the input comes from TTY and is not redirected from somewhere and several other checks. In the case of OpenSSH even the password prompt is always displayed re

Re: Class design (information hiding)

2007-09-07 Thread Alexander Eisenhuth
Bruno Desthuilliers schrieb: > Nope. It's either 'interface' (no leading underscore), 'implementation' > (single leading underscore), 'implementation with some protection > against accidental overriding' (two leading underscores). What do you mean with 'implementation'? What does it express? -

Re: unexpected behavior: did i create a pointer?

2007-09-07 Thread Grant Edwards
On 2007-09-07, Peter Otten <[EMAIL PROTECTED]> wrote: > Am Fri, 07 Sep 2007 10:40:47 + schrieb Steven D'Aprano: > >> Python doesn't have any pointers. > > Thinking of python variables or "names" as pointers should > get you a long way when trying to understand python's behaviour. But thinking

Re: wxPython unexpected exit

2007-09-07 Thread kyosohma
On Sep 7, 3:10 am, Jimmy <[EMAIL PROTECTED]> wrote: > Hi, wxPython is cool and easy to use, But I ran into a problem > recently when I try to write a GUI. > The thing is I want to periodically update the content of StatixText > object, so after create them, I pack them into a list...the problem > c

Re: Using s.sort([cmp[, key[, reverse]]]) to sort a list of objects based on a attribute

2007-09-07 Thread Marc 'BlackJack' Rintsch
On Fri, 07 Sep 2007 06:57:35 -0700, cjt22 wrote: > I have a step class and store in a list step instances > A step instance contains variables: name, startTime etc and startTime > is stored as a string %H:%M:%S > > What I would like to do is to be able to sort this list of objects > based on the

RE: application version checking against database

2007-09-07 Thread Hamilton, William
> From: imageguy > > We are trying to implement a system that checks the version of the > application against a version number stored in the database. We don't > want the app and the db don't become out of sync. > > We have tried setting a __version__ variable in the top most module, > however,

Re: Class design (information hiding)

2007-09-07 Thread Marc 'BlackJack' Rintsch
On Fri, 07 Sep 2007 15:17:06 +0200, Alexander Eisenhuth wrote: > Bruno Desthuilliers schrieb: > >> Nope. It's either 'interface' (no leading underscore), 'implementation' >> (single leading underscore), 'implementation with some protection >> against accidental overriding' (two leading undersc

Re: Checking if elements are empty

2007-09-07 Thread Wildemar Wildenburger
Steven D'Aprano wrote: > On Fri, 07 Sep 2007 11:12:05 +0200, Wildemar Wildenburger wrote: > >> Lawrence D'Oliveiro wrote: >>> In message <[EMAIL PROTECTED]>, Chris >>> Mellon wrote: >>> On 9/5/07, Steve Holden <[EMAIL PROTECTED]> wrote: > Doran, Harold wrote: >> Is there a way to chec

Re: exponential float formmating

2007-09-07 Thread Marc 'BlackJack' Rintsch
On Fri, 07 Sep 2007 06:08:19 -0700, zunbeltz wrote: > For compatibility reasons with an old program I have to format string > in exponential format with the following format > > 0.xE-yy > > This means that the number start always by 0 and after the exponent > there should be alway the sing a

Re: Finding specific date ranges

2007-09-07 Thread kyosohma
On Sep 7, 2:47 am, Tim Golden <[EMAIL PROTECTED]> wrote: > Zentrader wrote: > > On Sep 6, 7:56 am, [EMAIL PROTECTED] wrote: > >> December 31, 2006January 13, 2007 # doesn't earn > >> January 14, 2007January 27, 2007 # does earn > >> January 28, 2007February 10, 2007 # doesn't >

Re: Class design (information hiding)

2007-09-07 Thread Daniel Larsson
On 9/7/07, Alexander Eisenhuth <[EMAIL PROTECTED]> wrote: > > Bruno Desthuilliers schrieb: > > > Nope. It's either 'interface' (no leading underscore), 'implementation' > > (single leading underscore), 'implementation with some protection > > against accidental overriding' (two leading underscores

Re: Finding specific date ranges

2007-09-07 Thread kyosohma
On Sep 6, 6:41 pm, Zentrader <[EMAIL PROTECTED]> wrote: > On Sep 6, 7:56 am, [EMAIL PROTECTED] wrote: > > > December 31, 2006January 13, 2007 # doesn't earn > > January 14, 2007January 27, 2007 # does earn > > January 28, 2007February 10, 2007 # doesn't > > February 11, 2007

Re: py2exe - change name of exe created

2007-09-07 Thread Grant Edwards
On 2007-09-07, imageguy <[EMAIL PROTECTED]> wrote: > Note that every thing works fine with this and creates an exe > program called "myprogram.exe" > > I would like to setup program to create an output called; > "MyBestProgram.exe" > > IS that at all possible ? ADD this to the end of your script:

Re: MySQLdb: ValueError Something Stupid

2007-09-07 Thread Carsten Haese
On Fri, 2007-09-07 at 05:52 -0700, mcl wrote: > > ValueError: invalid literal for int(): 0- > > args = ('invalid literal for int(): 0-',) > > > > = > > Thanks Richard > > Sort of solved it. > > On that particular table it did not like * for all fields

Re: How to convert None to null value

2007-09-07 Thread Carsten Haese
On Fri, 2007-09-07 at 11:19 +0200, pradeep kumar wrote: > Hi , > > i am trying to insert records from one table to another table in > postgres sql using the the following code > > posConn.query("insert into > usr(usr_id,usr_name,usr_passwd,grp_cde,usr_type,usr_chk_till_val, \ > > usr_active,us

Re: wxPython unexpected exit

2007-09-07 Thread Thin Myrna
"Jimmy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, wxPython is cool and easy to use, But I ran into a problem > recently when I try to write a GUI. > The thing is I want to periodically update the content of StatixText > object, so after create them, I pack them into a list

Re: Generating a unique identifier

2007-09-07 Thread Marc 'BlackJack' Rintsch
On Fri, 07 Sep 2007 12:03:23 +, Steven D'Aprano wrote: > I have an application that will be producing many instances, using them > for a while, then tossing them away, and I want each one to have a unique > identifier that won't be re-used for the lifetime of the Python session. > > I can't

application version checking against database

2007-09-07 Thread imageguy
We are trying to implement a system that checks the version of the application against a version number stored in the database. We don't want the app and the db don't become out of sync. We have tried setting a __version__ variable in the top most module, however, it seems that this is not access

Re: unexpected behavior: did i create a pointer?

2007-09-07 Thread Peter Otten
Am Fri, 07 Sep 2007 10:40:47 + schrieb Steven D'Aprano: > Python doesn't have any pointers. Thinking of python variables or "names" as pointers should get you a long way when trying to understand python's behaviour. As long as you keep in mind that python doesn't have pointers to pointers, a

Re: Class design (information hiding)

2007-09-07 Thread Gregor Horvath
Alexander Eisenhuth schrieb: > > I'm wodering how the information hiding in python is ment. As I > understand there doesn't exist public / protected / private mechanism, > but a '_' and '__' naming convention. > > As I figured out there is only public and private possible as speakin in > "C+

Re: py2exe - change name of exe created

2007-09-07 Thread imageguy
Sorry for the double post, sent it to quickly. I have a setup script like this; setup(windows = [{"script":"myprogram.py", "icon_resources":[(0,"nabbitt.ico")], "other_resources": [(24,1,manifest)]} ], name = "My Program ver 0.1",

py2exe - change name of exe created

2007-09-07 Thread imageguy
I have a setup script like this; setup(windows = [{"script":"myprogram.py", "icon_resources":[(0,"nabbitt.ico")], "other_resources": [(24,1,manifest)]} ], name = "Nabbitt ver 0.1", data_files = [("",rootdata)],

Re: interesting puzzle......try this you will be rewarded...

2007-09-07 Thread Basilisk96
On Sep 7, 5:08 am, "Andreas Tawn" <[EMAIL PROTECTED]> wrote: > > Maybe http://www.pythonchallenge.com/? That's the one, thanks! --- -- http://mail.python.org/mailman/listinfo/python-list

Re: Class design (information hiding)

2007-09-07 Thread Bruno Desthuilliers
Alexander Eisenhuth a écrit : > Hi all, > > I'm wodering how the information hiding in python is ment. Conventions... > As I > understand there doesn't exist public / protected / private mechanism, > but a '_' and '__' naming convention. Yes. > As I figured out there is only public and pr

Re: unexpected behavior: did i create a pointer?

2007-09-07 Thread Steven D'Aprano
On Fri, 07 Sep 2007 11:46:38 +0200, Wildemar Wildenburger wrote: > gu wrote: >> hi to all! >> after two days debugging my code, i've come to the point that the >> problem was caused by an unexpected behaviour of python. or by lack of >> some information about the program, of course! i've stripped

Re: why should I learn python

2007-09-07 Thread Tim Williams
On 07/09/07, Tom Brown <[EMAIL PROTECTED]> wrote: > On Thursday 06 September 2007 16:01, windandwaves wrote: > > Hmmm, thank you all for your replies. I will do some research on the > > net (i did some already, but because I am really not much of a > > programmer, it is often too detailed for me).

Re: Checking if elements are empty

2007-09-07 Thread Steven D'Aprano
On Fri, 07 Sep 2007 11:12:05 +0200, Wildemar Wildenburger wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, Chris >> Mellon wrote: >> >>> On 9/5/07, Steve Holden <[EMAIL PROTECTED]> wrote: Doran, Harold wrote: > Is there a way to check if the first element of y is nu

Re: Using s.sort([cmp[, key[, reverse]]]) to sort a list of objects based on a attribute

2007-09-07 Thread Stefan Arentz
[EMAIL PROTECTED] writes: > Hi there > > I am fairly new to Python and have not really used regular expressions > before (I think this might be needed for my query) and wondered if you > could help > > I have a step class and store in a list step instances > A step instance contains variables: n

Re: py2exe - change name of exe created

2007-09-07 Thread Thomas Heller
imageguy schrieb: > Sorry for the double post, sent it to quickly. > > I have a setup script like this; > > setup(windows = [{"script":"myprogram.py", >"icon_resources":[(0,"nabbitt.ico")], > "other_resources": [(24,1,manifest)]} > ], > name

Re: Using s.sort([cmp[, key[, reverse]]]) to sort a list of objects based on a attribute

2007-09-07 Thread Tim Golden
[EMAIL PROTECTED] wrote: > Hi there > > I am fairly new to Python and have not really used regular expressions > before (I think this might be needed for my query) and wondered if you > could help > > I have a step class and store in a list step instances > A step instance contains variables: nam

Re: Generating a unique identifier

2007-09-07 Thread kyosohma
On Sep 7, 7:03 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I have an application that will be producing many instances, using them > for a while, then tossing them away, and I want each one to have a unique > identifier that won't be re-used for the lifetime of the Python se

Is a Borg rebellion possible? (a metaclass question)

2007-09-07 Thread André
In my application, I make use of the Borg idiom, invented by Alex Martelli. class Borg(object): '''Borg Idiom, from the Python Cookbook, 2nd Edition, p:273 Derive a class form this; all instances of that class will share the same state, provided that they don't override __new__; other

Re: Generating a unique identifier

2007-09-07 Thread Will Maier
On Fri, Sep 07, 2007 at 12:03:23PM -, Steven D'Aprano wrote: [...] > which is easy enough, but I thought I'd check if there was an existing > solution in the standard library that I missed. Also, for other > applications, I might want them to be rather less predictable. 2.5 includes the uuid

Generating a unique identifier

2007-09-07 Thread Steven D'Aprano
I have an application that will be producing many instances, using them for a while, then tossing them away, and I want each one to have a unique identifier that won't be re-used for the lifetime of the Python session. I can't use the id() of the object, because that is only guaranteed to be un

Re: Best practice prompting for password

2007-09-07 Thread Chris Mellon
On 9/7/07, GiBo <[EMAIL PROTECTED]> wrote: > Hi, > > what's the best practice to securely prompt user for password on console > in Python? IIRC some programs like SSH do a lot to ensure that the input > comes from TTY and is not redirected from somewhere and several other > checks. In the case of O

Re: MySQLdb: ValueError Something Stupid

2007-09-07 Thread mcl
On 7 Sep, 14:11, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2007-09-07 at 05:52 -0700, mcl wrote: > > > ValueError: invalid literal for int(): 0- > > > args = ('invalid literal for int(): 0-',) > > > > = > > > Thanks Richard > > > Sort of solved

Re: MySQLdb: ValueError Something Stupid

2007-09-07 Thread mcl
On 7 Sep, 12:08, mcl <[EMAIL PROTECTED]> wrote: > I have just started with python and MySQL. > > I have a simple test for each of my tables. > > The first two work as expected, but the third 'qlooks', gives a > ValueError. > > If I copy and paste the SQL in the traceback to phpMyAdmin, it works > a

Re: exponential float formmating

2007-09-07 Thread [EMAIL PROTECTED]
On Sep 7, 6:08 am, [EMAIL PROTECTED] wrote: > Hi, > > For compatibility reasons with an old program I have to format string > in exponential > format with the following format > > 0.xE-yy > > This means that the number start always by 0 and after the exponent > there should be alway the sing an

Re: interesting puzzle......try this you will be rewarded...

2007-09-07 Thread Andreas Tawn
>Basilisk96 wrote: >> I remember seeing a more elaborate puzzle that involved coding, >> cryptography knowledge, etc. to get through it. But what was the link, >> I forget now... > >There's this one http://www.inwardhellix.net/ > >I haven't played it yet so I can't vouch for its quality. (am playi

Re: platform system may be Windows or Microsoft since Vista

2007-09-07 Thread p . lavarre
> > Log a bug @ bugs.python.org > > http://bugs.python.org/issue1082 > TITLE ... platform system may be Windows or Microsoft since Vista Six days gone with no feedback. Something wrong with the input? Maybe the blank Priority field? I agree Severity Major. I'm thinking no priority because there

Re: exponential float formmating

2007-09-07 Thread zunbeltz
On 7 sep, 15:42, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Fri, 07 Sep 2007 06:08:19 -0700, zunbeltz wrote: > > For compatibility reasons with an old program I have to format string > > in exponential format with the following format > > > 0.xE-yy > > > This means that the number

Re: Generating a unique identifier

2007-09-07 Thread Wildemar Wildenburger
Will Maier wrote: > On Fri, Sep 07, 2007 at 12:03:23PM -, Steven D'Aprano wrote: > [...] >> which is easy enough, but I thought I'd check if there was an existing >> solution in the standard library that I missed. Also, for other >> applications, I might want them to be rather less predictabl

re: getting the current function

2007-09-07 Thread Gary Robinson
> This all seems a bit too complicated. Are you sure you want to do > this? Maybe you need to step back and rethink your problem. In version 2.1 Python added the ability to add function attributes -- see http://www.python.org/dev/peps/pep-0232/ for the justifications. A counter probably isn't on

Re: why should I learn python

2007-09-07 Thread JeffHua
In a message dated 2007-9-7 7:50:32, [EMAIL PROTECTED] writes: Tom Brown wrote: > On Thursday 06 September 2007 15:44, Torsten Bronger wrote: >> Hallöchen! >> >> Tom Brown writes: >> > [...] Python has been by far the easiest to develop in. Some >> > people might say it is not "real progra

Re: How to determine the bool between the strings and ints?

2007-09-07 Thread Bruno Desthuilliers
Jorgen Bodde a écrit : > Hi All, > > I have a dictionary with settings. The settinfgs can be strings, ints > or bools. I would like to write this list dynamically to disk in a big > for loop, unfortunately the bools need to be written as 0 or 1 to the > config with WriteInt, the integers also with

Re: Generating a unique identifier

2007-09-07 Thread Paul Rubin
Paul Rubin writes: > def unique_id(): >return os.urandom(10).encode('hex') Sorry, make that 32 or 40 instead of 10, if the number of id's is large, to make birthday collisions unlikely. If you don't want the id's to be that large, you can implement a Feistel cipher

Re: Organizing Code - Packages

2007-09-07 Thread Bruno Desthuilliers
xkenneth a écrit : > All, > > I apologize if this is a commonly asked question, but I didn't > find anything that answered my question while searching. > > So what I have right now is a few packages that contain some commonly > used functions and another package that contains all of my custom

Organizing Code - Packages

2007-09-07 Thread xkenneth
All, I apologize if this is a commonly asked question, but I didn't find anything that answered my question while searching. So what I have right now is a few packages that contain some commonly used functions and another package that contains all of my custom error classes. I want these erro

How to determine the bool between the strings and ints?

2007-09-07 Thread Jorgen Bodde
Hi All, I have a dictionary with settings. The settinfgs can be strings, ints or bools. I would like to write this list dynamically to disk in a big for loop, unfortunately the bools need to be written as 0 or 1 to the config with WriteInt, the integers also with WriteInt and the strings with a si

Re: Class design (information hiding)

2007-09-07 Thread Bruno Desthuilliers
Alexander Eisenhuth a écrit : > Bruno Desthuilliers schrieb: > >> Nope. It's either 'interface' (no leading underscore), >> 'implementation' (single leading underscore), 'implementation with >> some protection against accidental overriding' (two leading underscores). > > What do you mean with

Re: How to determine the bool between the strings and ints?

2007-09-07 Thread Jorgen Bodde
Awesome! Thanks you! As for why caring if they are bools or not, I write True and False to the properties, the internal mechanism works like this so I need to make that distinction. Thanks again guys, - Jorgen ps. Sorry TheFlyingDutch for mailing you personally, I keep forgetting this mailinglis

Re: concise code (beginner)

2007-09-07 Thread Rhamphoryncus
On Sep 6, 1:56 pm, Karthik Gurusamy <[EMAIL PROTECTED]> wrote: > That said, it may be a good future language enhancement to define a > reasonable consistent behavior for an iterator over a changing > collection. This occurs quite common when we walk a collection and > usually delete the current ite

Using s.sort([cmp[, key[, reverse]]]) to sort a list of objects based on a attribute

2007-09-07 Thread cjt22
Hi there I am fairly new to Python and have not really used regular expressions before (I think this might be needed for my query) and wondered if you could help I have a step class and store in a list step instances A step instance contains variables: name, startTime etc and startTime is stored

Re: why should I learn python

2007-09-07 Thread vanrpeterson
Why use Python? 1)Easy to read, debug and think. 2)Same language for batch scripting, server programming and dynamic web page creation. 3)Libraries like wxPython for desktop and Cherrypy for web development. 4)Pythonic JavaScript Library Mochikit. 5)Engineered for reality, not corporate proprietary

Re: Is a Borg rebellion possible? (a metaclass question)

2007-09-07 Thread Carsten Haese
On Fri, 2007-09-07 at 12:31 +, André wrote: > In my application, I make use of the Borg idiom, invented by Alex > Martelli. > > class Borg(object): > '''Borg Idiom, from the Python Cookbook, 2nd Edition, p:273 > > Derive a class form this; all instances of that class will share > the

exponential float formmating

2007-09-07 Thread zunbeltz
Hi, For compatibility reasons with an old program I have to format string in exponential format with the following format 0.xE-yy This means that the number start always by 0 and after the exponent there should be alway the sing and 2 number for the exponent. for example 13 shoud be 0.13000

Re: py2exe - change name of exe created

2007-09-07 Thread imageguy
On Sep 7, 11:22 am, Thomas Heller <[EMAIL PROTECTED]> wrote: > imageguy schrieb: > > > > > > > Sorry for the double post, sent it to quickly. > > > I have a setup script like this; > > > setup(windows = [{"script":"myprogram.py", > >"icon_resources":[(0,"nabbitt.ico")], > >

Re: Is a Borg rebellion possible? (a metaclass question)

2007-09-07 Thread André
On Sep 7, 10:27 am, Carsten Haese <[EMAIL PROTECTED]> wrote: > On Fri, 2007-09-07 at 12:31 +, André wrote: > > In my application, I make use of the Borg idiom, invented by Alex > > Martelli. > > > class Borg(object): > > '''Borg Idiom, from the Python Cookbook, 2nd Edition, p:273 > > >

Re: interesting puzzle......try this you will be rewarded...

2007-09-07 Thread Evil Bert
Andreas Tawn wrote: > Maybe http://www.pythonchallenge.com/ ? Fun! Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: unexpected behavior: did i create a pointer?

2007-09-07 Thread Dustan
On Sep 7, 3:07 am, gu <[EMAIL PROTECTED]> wrote: > hi to all! Hi! > after two days debugging my code, i've come to the point that the > problem was caused by an unexpected behaviour of python. or by lack of > some information about the program, of course! i've stripped down the > code to reproduc

debugging program that uses ctypes

2007-09-07 Thread marco_347
hi all, I have a python program that calls a dll through ctypes (py2.5). In some (reproducible) conditions the program crashes with an error in ctypes module. How can I trace down the problem? I have created a debug build of python but I also use pyodbc and dateutil libraries in my program and I do

Re: Generating a unique identifier

2007-09-07 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > def unique_id(): > n = 1234567890 > while True: > yield n > n += 1 unique_id = itertools.count(1234567890) > which is easy enough, but I thought I'd check if there was an existing > solution in the standard library that I miss

Re: Speed of Python

2007-09-07 Thread S bastien Boisg rault
On Sep 7, 6:42 pm, "wang frank" <[EMAIL PROTECTED]> wrote: Matlab (aka MATrix LABoratory) has been designed with numeric computations in mind (every object being natively a n-dim array). If you wish to develop that kind of applications in Python, consider using the numerical array structure provi

passing command line arguments

2007-09-07 Thread Brian McCann
Hi, when I run the script show_args2.py # ./show_args2.py 1 2 3 I get the following error Traceback (most recent call last): File "./show_args2.py", line 4, in ? print 'The arguments of %s are "%s"' %s \ NameError: name 's' is not defined #

Re: Organizing Code - Packages

2007-09-07 Thread Paul Rudin
xkenneth <[EMAIL PROTECTED]> writes: >> Ah, yes, a couple of things: >> - avoid the 'one-class-per-file' syndrom. It's perfectly ok to have tens > > Yes but i find it hard to edit classes easily when I have more than > one class per file. Why? -- http://mail.python.org/mailman/listinfo/python-li

Re: debugging program that uses ctypes

2007-09-07 Thread Thomas Heller
[EMAIL PROTECTED] schrieb: > hi all, I have a python program that calls a dll through ctypes > (py2.5). In some (reproducible) > conditions the program crashes with an error in ctypes module. You mean a segfault? > How can I trace down the problem? I have created a debug build of > python but I a

Re: Organizing Code - Packages

2007-09-07 Thread xkenneth
> Ah, yes, a couple of things: > - avoid the 'one-class-per-file' syndrom. It's perfectly ok to have tens Yes but i find it hard to edit classes easily when I have more than one class per file. Regards, Ken -- http://mail.python.org/mailman/listinfo/python-list

Re: How to convert None to null value

2007-09-07 Thread Gabriel Genellina
En Fri, 07 Sep 2007 06:19:25 -0300, pradeep kumar <[EMAIL PROTECTED]> escribi�: > i am trying to insert records from one table to another table in postgres > sql using the the following code > > posConn.query("insert into > usr(usr_id,usr_name,usr_passwd,grp_cde,usr_type,usr_chk_till_val, \ > >

Re: why should I learn python

2007-09-07 Thread [EMAIL PROTECTED]
On Sep 6, 10:32 pm, windandwaves <[EMAIL PROTECTED]> wrote: > Can someone tell me why I should learn python? I am a webdeveloper, > but I often see Python mentioned and I am curious to find out what I > am missing out on. > > Thank you > > Nicolaas - You never really have to reinvent the wheel,

Re: Class design (information hiding)

2007-09-07 Thread Daniel Larsson
On 9/7/07, Alexander Eisenhuth <[EMAIL PROTECTED]> wrote: > > Hi all, > > I'm wodering how the information hiding in python is ment. As I understand > there > doesn't exist public / protected / private mechanism, but a '_' and > '__' > naming convention. > > As I figured out there is only public

Re: Speed of Python

2007-09-07 Thread Roberto Bonvallet
On Sep 7, 12:42 pm, "wang frank" <[EMAIL PROTECTED]> wrote: > Here is the bench1.py: > import math > def bench1(n): > for i in range(n): > for j in range(1000): > m=j+1 > z=math.log(m) > z1=math.log(m+1)

Re: Changing data in an QAbstractListModel

2007-09-07 Thread exhuma.twn
On Sep 7, 12:42 am, Jonathan Gardner <[EMAIL PROTECTED]> wrote: > On Sep 6, 9:12 am, "exhuma.twn" <[EMAIL PROTECTED]> wrote: > > > I defined a simple "update" method in the model which I call on > > certain events to fetch the new data in the DB. I tried to "emit" the > > "dataChanged()" signal of

MySQL: Global Connection

2007-09-07 Thread mcl
It is tough when the grey matter is getting past it. I am starting to use MySQL and I would like to make my connection to my database a variable in my Global Variable Class, but I just can not see how to do it. Class GlobalVars : -- http://mail.python.org/mailman/listinfo/python-list

Re: Why 'class spam(object)' instead of class spam(Object)' ?

2007-09-07 Thread Carl Banks
On Fri, 07 Sep 2007 01:30:00 -0500, Sergio Correia wrote: > Hi, I'm kinda new to Python (that means, I'm a total noob here), but > have one doubt which is more about consistency that anything else. > > Why if PEP 8 says that "Almost without exception, class names use the > CapWords convention", do

wxPython unexpected exit

2007-09-07 Thread Jimmy
Hi, wxPython is cool and easy to use, But I ran into a problem recently when I try to write a GUI. The thing is I want to periodically update the content of StatixText object, so after create them, I pack them into a list...the problem comes when I later try to extract them from the list! I don't k

unexpected behavior: did i create a pointer?

2007-09-07 Thread gu
hi to all! after two days debugging my code, i've come to the point that the problem was caused by an unexpected behaviour of python. or by lack of some information about the program, of course! i've stripped down the code to reproduce the problem: a = {} for x in range(10): for y in ran

Python and Cron

2007-09-07 Thread Greg Lindstrom
This may be more of a Linux question, but I'm hoping some of you may be able to help me. I have a python (2.4) routine running on Gentoo Linux. It creates a file and, after the file is complete, renames the file using the os.rename() command. When I run the file from the command line everything

Re: Why 'class spam(object)' instead of class spam(Object)' ?

2007-09-07 Thread Bruno Desthuilliers
Sergio Correia a écrit : > Hi, I'm kinda new to Python (that means, I'm a total noob here), but > have one doubt which is more about consistency that anything else. > > Why if PEP 8 says that "Almost without exception, class names use the > CapWords convention", does the most basic class, object,

Re: interesting puzzle......try this you will be rewarded...

2007-09-07 Thread Neil Cerutti
On 2007-09-07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Thu, 06 Sep 2007 22:57:21 -0300, Basilisk96 <[EMAIL PROTECTED]> > escribi?: > >> I got to 14 :) >> >> It's rather silly. >> >> I remember seeing a more elaborate puzzle that involved coding, >> cryptography knowledge, etc. to get th

Re: unexpected behavior: did i create a pointer?

2007-09-07 Thread Wildemar Wildenburger
Steven D'Aprano wrote: > On Fri, 07 Sep 2007 11:46:38 +0200, Wildemar Wildenburger wrote: > >> gu wrote: >>> hi to all! >>> after two days debugging my code, i've come to the point that the >>> problem was caused by an unexpected behaviour of python. or by lack of >>> some information about the pr

Re: library to launch program in linux

2007-09-07 Thread Neil Cerutti
On 2007-09-07, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > In message <[EMAIL PROTECTED]>, Laszlo Nagy > wrote: > >> Grant Edwards wrote: >> >>> On 2007-09-06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>> I'm a new user. What library should I use so that I can launch program i

py2exe - change name of exe created

2007-09-07 Thread imageguy
I have a setup script like this; setup(windows = [{"script":"myprogram.py", "icon_resources":[(0,"nabbitt.ico")], "other_resources": [(24,1,manifest)]} ], name = "Nabbitt ver 0.1", data_files = [("",rootdata)],

Re: Text processing and file creation

2007-09-07 Thread Paddy
On Sep 7, 3:50 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Sep 5, 5:17 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > If this was a code golf challenge, I'd choose the Unix split solution and be both maintainable as well as concise :-) - Paddy. -- http://mail.python.org/mailman/li

Python wrapper, problem with subprocess read/write

2007-09-07 Thread NeoGregorian
Hello, I am writing a wrapper to a basic Input/Output programs (where you type a one line command at a time and then get 0 or more lines of output before you can input the next command). I'm sorry if this problem description is a bit long, but I wanted to make the problem clear. Example run of th

Speed of Python

2007-09-07 Thread wang frank
Hi, While comparing the speed of octave and matlab, I decided to do a similar test for python and matlab. The result shows that python is slower than matlab by a factor of 5. It is not bad since octave is about 30 time slower than matlab. Here is the result in matlab: Elapsed time is 0.01538

Re: Why 'class spam(object)' instead of class spam(Object)' ?

2007-09-07 Thread Steve Holden
Carl Banks wrote: > On Fri, 07 Sep 2007 01:30:00 -0500, Sergio Correia wrote: >> Hi, I'm kinda new to Python (that means, I'm a total noob here), but >> have one doubt which is more about consistency that anything else. >> >> Why if PEP 8 says that "Almost without exception, class names use the >>

Re: startswith( prefix[, start[, end]]) Query

2007-09-07 Thread Steve Holden
Bruno Desthuilliers wrote: > Steve Holden a écrit : [...] >> >> Probably not really necessary, though, and they do say that premature >> optimization is the root of all evil ... > > I wouldn't call this one "premature" optimization, since it doesn't > change the algorithm, doesn't introduce (muc

Class design (information hiding)

2007-09-07 Thread Alexander Eisenhuth
Hi all, I'm wodering how the information hiding in python is ment. As I understand there doesn't exist public / protected / private mechanism, but a '_' and '__' naming convention. As I figured out there is only public and private possible as speakin in "C++ manner". Are you all happy with

Re: library to launch program in linux

2007-09-07 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Laszlo Nagy wrote: > Grant Edwards wrote: > >> On 2007-09-06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >>> I'm a new user. What library should I use so that I can launch >>> program in linux using python? >>> >> >> subprocess >> > Hmm, there are so

Re: startswith( prefix[, start[, end]]) Query

2007-09-07 Thread Duncan Booth
"Tim Williams" <[EMAIL PROTECTED]> wrote: > Isn't slicing still faster than startswith?As you mention timeit, > then you should probably add slicing to the pot too :) > Possibly, but there are so many other factors that affect the timing that writing it clearly should be your first choice.

Re: startswith( prefix[, start[, end]]) Query

2007-09-07 Thread Bruno Desthuilliers
Steve Holden a écrit : > TheFlyingDutchman wrote: >>> Else, you could as well write your own testing function: >>> >>> def str_starts_with(astring, *prefixes): >>>startswith = astring.startswith >>>for prefix in prefixes: >>> if startswith(prefix): >>>return true >>>return

Re: py2exe - change name of exe created

2007-09-07 Thread Thomas Heller
imageguy schrieb: [...] >> > Note that every thing works fine with this and creates an exe program >> > called >> > "myprogram.exe" >> >> > I would like to setup program to create an output called; >> > "MyBestProgram.exe" >> >> > IS that at all possible ? >> >> Yes. Use a 'dest_base' key in the d

MySQLdb: ValueError Something Stupid

2007-09-07 Thread mcl
I have just started with python and MySQL. I have a simple test for each of my tables. The first two work as expected, but the third 'qlooks', gives a ValueError. If I copy and paste the SQL in the traceback to phpMyAdmin, it works as expected. Can anyone give a clue as to what I am doing wrong

  1   2   >