Re: basic threading question

2007-10-31 Thread [david]
[EMAIL PROTECTED] wrote: > On Oct 30, 7:58 pm, "bambam" <[EMAIL PROTECTED]> wrote: >> Are function variables thread safe? >> >> def f(a): >> # whatever >> return float(a) >> >> Is that OK? >> >> def f(a): >> #whatever >> b=a: >> #whatever: >> return float(b) >> >> Is that OK

Re: Python Interview Questions

2007-10-31 Thread konryd
> - string building...do they use "+=" or do they build a list >and use .join() to recombine them efficiently I'm not dead sure about that, but I heard recently that python's been optimized for that behaviour. That means: using += is almost as fast as joining list. Besides, "+=" is more obvi

Re: jpeg image read class

2007-10-31 Thread Marc 'BlackJack' Rintsch
On Wed, 31 Oct 2007 06:48:18 +, [EMAIL PROTECTED] wrote: > i am new to python and PIL and was trying to write a class to read and > write RGB color model jpeg images.. PIL already offers such a class. > i came up with this class below..i want to know if this is the way to > read/write the RG

Re: Readline and record separator

2007-10-31 Thread Johny
On Oct 30, 8:44 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Johny a écrit : > > > Is it possible to change record separator when using readline? > > As far as I know readline reads characters until found '\n' and it is > > the end of record for readline. > > This is not a "record" separato

Re: object inheritance

2007-10-31 Thread praddy
On Oct 31, 8:26 am, Anand <[EMAIL PROTECTED]> wrote: > On Oct 28, 1:16 am, Pradeep Jindal <[EMAIL PROTECTED]> wrote: > > > > > On Friday 26 Oct 2007 6:21:57 pm Anand wrote: > > > > On Oct 26, 5:31 pm, "Pradeep Jindal" <[EMAIL PROTECTED]> wrote: > > > > Can you tell any specific use case for doing t

Re: basic threading question

2007-10-31 Thread Bryan Olson
[david] wrote: > If I have 37 threads, all calling a large function 'f', are the formal > parameters thread safe? > > That is, will the formal parameters be trashed? Do you need to use > locks or semaphores before using formal parameters? Are the labels for > formal parameters static? > > If I

dynamically generating temporary files through python/cgi

2007-10-31 Thread Miss Pfeffe
How do you make a python out of a banana?!-- http://mail.python.org/mailman/listinfo/python-list

Re: Readline and record separator

2007-10-31 Thread Bruno Desthuilliers
Johny a écrit : > On Oct 30, 8:44 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: >> Johny a écrit : >> >>> Is it possible to change record separator when using readline? >>> As far as I know readline reads characters until found '\n' and it is >>> the end of record for readline. >> This is no

Re: why did these companies choose Tcl over Python

2007-10-31 Thread Eddie Corns
chewie54 <[EMAIL PROTECTED]> writes: >Hello, >As an electronics engineer I use some very expensive EDA CAD tool >programs that are scriptable using Tcl. I was wondering why these >companies have choose to use Tcl instead of Python. Some of these >are: > Mentor Graphics ModelTech VHDL and Ve

Re: Python and SQLite release cycles

2007-10-31 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hi, > > Official Python distro is very stable, with release cycle of around 1 > year. However, to include the new version of SQLite, which has a much > shorter release cycle, one has to rebuild the main Python distribution > (to compile with the new SQLite headers) - th

Re: setting variables in outer functions

2007-10-31 Thread Dustan
On Oct 30, 11:29 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Neil Cerutti <[EMAIL PROTECTED]> wrote: > > It's allows a standard programming idiom which provides a > > primitive form of object oriented programming using closures to > > represent state. > > > def account(opening_balance): > > bal

help with pyparsing

2007-10-31 Thread Neal Becker
I'm just trying out pyparsing. I get stack overflow on my first try. Any help? #/usr/bin/python from pyparsing import Word, alphas, QuotedString, OneOrMore, delimitedList first_line = '[' + delimitedList (QuotedString) + ']' def main(): string = '''[ 'a', 'b', 'cdef']''' greeting = fi

py2exe (or other exe builder) on Vista system for Vista/XP install targets.

2007-10-31 Thread Michael
I'm trying to build a exe on a vista system using py2exe. It will deploy to vista and XP systems. If it matters, the application uses pyserial, as well. I have VS Studio 2005 installed on this laptop as well. I've found this so far that seems to be identical to what I'm seeing (for non-python progr

Re: setting variables in outer functions

2007-10-31 Thread Duncan Booth
Dustan <[EMAIL PROTECTED]> wrote: > On Oct 30, 11:29 am, Duncan Booth <[EMAIL PROTECTED]> > wrote: >> Neil Cerutti <[EMAIL PROTECTED]> wrote: >> > It's allows a standard programming idiom which provides a >> > primitive form of object oriented programming using closures to >> > represent state. >>

Re: Creating a temporary file in Python

2007-10-31 Thread Diez B. Roggisch
looping wrote: > Hi, > > I want to create a temporary file, read it in an external command and > finally delete it (in Windows XP). > > I try to use tempfile module but it doesn't work, the file couldn't be > open by my other process (error like: SP2-0310: unable to open file "c: > \docume~1\loo

Creating a temporary file in Python

2007-10-31 Thread looping
Hi, I want to create a temporary file, read it in an external command and finally delete it (in Windows XP). I try to use tempfile module but it doesn't work, the file couldn't be open by my other process (error like: SP2-0310: unable to open file "c: \docume~1\looping\locals~1\temp\tmpau81-s.sql

Re: A Python 3000 Question

2007-10-31 Thread Neil Cerutti
On 2007-10-30, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Tue, 30 Oct 2007 15:25:54 GMT, Neil Cerutti <[EMAIL PROTECTED]> wrote: >>On 2007-10-30, Eduardo O. Padoan <[EMAIL PROTECTED]> wrote: >>> This is a FAQ: >>> http://effbot.org/pyfaq/why-does-python-use-methods-for-some-functionality-e

Re: A Python 3000 Question

2007-10-31 Thread Neil Cerutti
On 2007-10-30, George Sakkis <[EMAIL PROTECTED]> wrote: > On Oct 30, 11:25 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> On 2007-10-30, Eduardo O. Padoan <[EMAIL PROTECTED]> wrote: >> >> > This is a FAQ: >> >http://effbot.org/pyfaq/why-does-python-use-methods-for-some-function... >> >> Holy Airy P

Re: Creating a temporary file in Python

2007-10-31 Thread looping
On Oct 31, 2:16 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > I'm not an expert, but I think you need to close the file first - you under > windows here, which can be picky about such stuff AFAIK. Or maybe there is > some other mode-specifier. > > Diez Actually closing the file delete it wi

Re: A Python 3000 Question

2007-10-31 Thread George Sakkis
On Oct 31, 8:44 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-10-30, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > On Oct 30, 11:25 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > >> On 2007-10-30, Eduardo O. Padoan <[EMAIL PROTECTED]> wrote: > > >> > This is a FAQ: > >> >http://effbot.o

Re: Creating a temporary file in Python

2007-10-31 Thread Diez B. Roggisch
looping wrote: > On Oct 31, 2:16 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> I'm not an expert, but I think you need to close the file first - you >> under windows here, which can be picky about such stuff AFAIK. Or maybe >> there is some other mode-specifier. >> >> Diez > > Actually

Re: py2exe (or other exe builder) on Vista system for Vista/XP install targets.

2007-10-31 Thread Bjoern Schliessmann
Michael wrote: [py2exe on Vista and XP] > When I attempt to run, I get "The procedure entry point > _except_handler4_common could not be located in the dynamic link > library mscvrt.dll." Apparently vista has one more > _except_handler#_common function than XP does. Strange -- it works for me. I

Re: Creating a temporary file in Python

2007-10-31 Thread Sion Arrowsmith
looping <[EMAIL PROTECTED]> wrote: >I want to create a temporary file, read it in an external command and >finally delete it (in Windows XP). > >I try to use tempfile module but it doesn't work, the file couldn't be >open by my other process (error like: SP2-0310: unable to open file "c: >\docume~

Re: marshal vs pickle

2007-10-31 Thread Bjoern Schliessmann
Evan Klitzke wrote: > Can anyone elaborate more on the difference between marshal and > pickle. In what conditions would using marshal be unsafe? If one > can guarantee that the marshalled objects would be created and > read by the same version of Python, is that enough? Just use pickle. From the

Re: marshal vs pickle

2007-10-31 Thread Aaron Watters
On Oct 31, 3:31 am, "Evan Klitzke" <[EMAIL PROTECTED]> wrote: > Can anyone elaborate more on the difference between marshal and > pickle. In what conditions would using marshal be unsafe? If one can > guarantee that the marshalled objects would be created and read by the > same version of Python, i

Re: python in academics?

2007-10-31 Thread Floris Bruynooghe
On Oct 30, 3:39 am, sandipm <[EMAIL PROTECTED]> wrote: > seeing posts from students on group. I am curious to know, Do they > teach python in academic courses in universities? In Southampton Uni (UK) they do teach (some) Python to Engineering undergrads (aero, mech, ship, maybe more) thanks to one

Re: A Python 3000 Question

2007-10-31 Thread Duncan Booth
Neil Cerutti <[EMAIL PROTECTED]> wrote: > But if I'm wrong about the performance benefits then I guess I'm > still in the dark about why len is a builtin. The only compelling > thing in the linked explation was the signatures of the guys who > wrote the artible. (Guido does admit he would, "hate t

Re: A Python 3000 Question

2007-10-31 Thread Neil Cerutti
On 2007-10-31, George Sakkis <[EMAIL PROTECTED]> wrote: > On Oct 31, 8:44 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> On 2007-10-30, George Sakkis <[EMAIL PROTECTED]> wrote: >> >> >> >> > On Oct 30, 11:25 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> >> On 2007-10-30, Eduardo O. Padoan <[EMAIL

Namespace question

2007-10-31 Thread Frank Aune
Hello, Is it possible writing custom modules named the same as modules in the standard library, which in turn use the same module from the standard library? Say I want my application to have a random.py module, which in turn must import the standard library random.py module also, to get hold o

Re: A Python 3000 Question

2007-10-31 Thread Neil Cerutti
On 2007-10-31, Duncan Booth <[EMAIL PROTECTED]> wrote: > Obviously it isn't an absolute thing: lists and dictionaries do > have other methods in the user namespace, so the decision to > keep len out of that namespace is partly a judgement call, and > partly historical (I think tuples didn't used to

shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread jelle
the subject pretty much says it all. if I check a string for for a substring, and this substring isn't found, should't the .find method return 0 rather than -1? this breaks the if check.find('something'): do(somethingElse) idiom, which is a bit of a pity I think. cheers, -jelle -- http:

Fwd: Namespace question

2007-10-31 Thread Andrii V. Mishkovskyi
2007/10/31, Frank Aune <[EMAIL PROTECTED]>: > Hello, > > Is it possible writing custom modules named the same as modules in the > standard library, which in turn use the same module from the standard > library? > > Say I want my application to have a random.py module, which in turn must > import th

Re: _tkinter installation in python 2.5 on mandriva with a default 2.4

2007-10-31 Thread Martin v. Löwis
> however make still complains of the non existance of the the Tcl/Tk > libs and/or headers So where it tk.h located? Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread Martin Marcher
2007/10/31, jelle <[EMAIL PROTECTED]>: > the subject pretty much says it all. > if I check a string for for a substring, and this substring isn't found, > should't the .find method return 0 rather than -1? > this breaks the IMHO "0" would mean the substring starts at index 0 of the iterable. If t

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread Andrii V. Mishkovskyi
2007/10/31, jelle <[EMAIL PROTECTED]>: > the subject pretty much says it all. > if I check a string for for a substring, and this substring isn't found, > should't the .find method return 0 rather than -1? > this breaks the > > if check.find('something'): > do(somethingElse) > > idiom, which is

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread jelle feringa
> > What's your point? :/ that of making sure before you post and cause public emberassement? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Interview Questions

2007-10-31 Thread Steven Bethard
konryd wrote: >> - string building...do they use "+=" or do they build a list >>and use .join() to recombine them efficiently > > > I'm not dead sure about that, but I heard recently that python's been > optimized for that behaviour. That means: using += is almost as fast > as joining list.

Re: A Python 3000 Question

2007-10-31 Thread Duncan Booth
Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-10-31, Duncan Booth <[EMAIL PROTECTED]> wrote: >> Obviously it isn't an absolute thing: lists and dictionaries do >> have other methods in the user namespace, so the decision to >> keep len out of that namespace is partly a judgement call, and >> p

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread Luis Zarrabeitia
> the subject pretty much says it all. > if I check a string for for a substring, and this substring isn't found, > should't the .find method return 0 rather than -1? I belive str.find should return the first position where the substring appears. If "string".find("ugh") were to return 0, how wou

Re: why did these companies choose Tcl over Python

2007-10-31 Thread Roy Smith
chewie54 <[EMAIL PROTECTED]> wrote: > I would prefer to use Python but can't deny how popular Tcl is, as > mentioned above, so my question is why wasn't Python selected by > these companies as the choice of scripting languages for their > product? > > Are there any obvious advantages like: > >

Python bug tracker now secret?

2007-10-31 Thread John Nagle
I'm now getting messages like this from the Python bug tracker on SourceForge: Artifact: This Artifact Has Been Made Private. Only Group Members Can View Private ArtifactTypes. I'm being denied access to bug reports I submitted, such as https://sourceforge.net/tracker/?func=detail&aid=16519

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread Simon Brunning
On 10/31/07, jelle <[EMAIL PROTECTED]> wrote: > the subject pretty much says it all. > if I check a string for for a substring, and this substring isn't found, > should't the .find method return 0 rather than -1? > this breaks the > > if check.find('something'): > do(somethingElse) print 'ughu

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread Marc 'BlackJack' Rintsch
On Wed, 31 Oct 2007 13:31:06 +, jelle wrote: > if I check a string for for a substring, and this substring isn't found, > should't the .find method return 0 rather than -1? > this breaks the > > if check.find('something'): > do(somethingElse) > > idiom, which is a bit of a pity I think

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread Carsten Haese
On Wed, 2007-10-31 at 13:31 +, jelle wrote: > the subject pretty much says it all. > if I check a string for for a substring, and this substring isn't found, > should't the .find method return 0 rather than -1? > this breaks the > > if check.find('something'): > do(somethingElse) > > id

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread Hrvoje Niksic
jelle <[EMAIL PROTECTED]> writes: > the subject pretty much says it all. > if I check a string for for a substring, and this substring isn't found, > should't the .find method return 0 rather than -1? How would you treat the case of 'something' being at the beginning of the string? After all, f

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread jelle feringa
There is a subtle point though. If the substring is not found '_'.find(' '), will return -1 Semanticly, I was expecting the that if the substring was not found, the conditional statement would not be found. However, python evaluates -1 to True, so that is what I do find confusing. So, I was arguing

Re: Python bug tracker now secret?

2007-10-31 Thread Jean-Paul Calderone
On Wed, 31 Oct 2007 07:53:01 -0700, John Nagle <[EMAIL PROTECTED]> wrote: >I'm now getting messages like this from the Python bug tracker on >SourceForge: > > Artifact: This Artifact Has Been Made Private. Only Group Members Can > View Private ArtifactTypes. > >I'm being denied access to bug rep

capturing output of command line in an array

2007-10-31 Thread amjadcsu
Hi I am trying to execute a command using os.system. this command lists the number of nodes alive in a cluster. I would like to capture the output in list/array in python. IS it possible.?/ Here is my command gstat -a node13 2 (0/ 56) [ 0.00, 0.00, 0.00] [ 0.0, 0.0, 0.1, 99.9,

dictionary

2007-10-31 Thread Beema shafreen
hi everybody, I have a file 2709852 2709911A_16_P21360207405-59 2710316 2710367A_14_P136880-42-51 2710325 2710384A_16_P21360209876-59 2711260 2711319A_16_P21360210-22-59 2711297 2711356A_16_P0364

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread Tim Chase
> if I check a string for for a substring, and this substring isn't found, > should't the .find method return 0 rather than -1? > this breaks the > > if check.find('something'): > do(somethingElse) > > idiom, which is a bit of a pity I think. That idiom is spelled: if 'something' in ch

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread J. Clifford Dyer
On Wed, Oct 31, 2007 at 03:55:49PM +0100, jelle feringa wrote regarding Re: shouldn't 'string'.find('ugh') return 0, not -1 ?: > >There is a subtle point though. > >If the substring is not found '_'.find(' '), will return -1 > >Semanticly, I was expecting the that if the substring w

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread Carl Banks
On Oct 31, 9:31 am, jelle <[EMAIL PROTECTED]> wrote: > the subject pretty much says it all. > if I check a string for for a substring, and this substring isn't found, > should't the .find method return 0 rather than -1? > this breaks the > > if check.find('something'): > do(somethingElse) > > i

Re: help with pyparsing

2007-10-31 Thread Paul McGuire
On Oct 31, 6:59 am, Neal Becker <[EMAIL PROTECTED]> wrote: > I'm just trying out pyparsing. I get stack overflow on my first try. Any > help? > > #/usr/bin/python > > from pyparsing import Word, alphas, QuotedString, OneOrMore, delimitedList > > first_line = '[' + delimitedList (QuotedString) + '

Re: A Python 3000 Question

2007-10-31 Thread Carl Banks
On Oct 31, 8:44 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-10-30, George Sakkis <[EMAIL PROTECTED]> wrote: > > > > > On Oct 30, 11:25 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > >> On 2007-10-30, Eduardo O. Padoan <[EMAIL PROTECTED]> wrote: > > >> > This is a FAQ: > >> >http://effbot.o

RE: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread Looney, James B
I believe most programming languages evaluate 0 to mean False, and anything else to be True (for the purposes of boolean evaluation). Python is no exception. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jelle feringa Sent: Wednes

Re: Python bug tracker now secret?

2007-10-31 Thread John Nagle
Jean-Paul Calderone wrote: > On Wed, 31 Oct 2007 07:53:01 -0700, John Nagle <[EMAIL PROTECTED]> wrote: >> I'm now getting messages like this from the Python bug tracker on >> SourceForge: >> >> Artifact: This Artifact Has Been Made Private. Only Group Members Can >> View Private ArtifactTypes. >

shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread jelle feringa
Hi Tim, Well, I this is another idiom in itself, right? Your checking if something is part of an iterable. I'm checking truth before entering a conditional expression. The latter is considered to be pythonic, right? -jelle On 10/31/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > > if I check a st

Re: why did these companies choose Tcl over Python

2007-10-31 Thread Kevin Walzer
chewie54 wrote: > Hello, > > As an electronics engineer I use some very expensive EDA CAD tool > programs that are scriptable using Tcl. I was wondering why these > companies have choose to use Tcl instead of Python. Some of these > are: > >Mentor Graphics ModelTech VHDL and Verilog simula

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread jelle feringa
> The statement that you want to test the truth of is s.find(q) >= 0. In > other words, you want to see that the substring was found at a valid > (non-negative) location. As someone else pointed out, it would make more > sense to use None instead of -1. I agree, that would be nice. You still

Re: Python bug tracker now secret?

2007-10-31 Thread Martin v. Löwis
> I don't know why they chose to make the sf tracker private. Maybe that > was the only way to remove write access. That, plus removing it means that people won't browse outdated information. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Creating a temporary file in Python

2007-10-31 Thread looping
On Oct 31, 2:16 pm, Sion Arrowsmith <[EMAIL PROTECTED]> wrote: > " [ ... ] Whether the name can be used to open the file a second time, > while the named temporary file is still open, varies across platforms > (it can be so used on Unix; it cannot on Windows NT or later)." I didn't notice this lim

Re: why did these companies choose Tcl over Python

2007-10-31 Thread Paddy
On Oct 30, 10:47 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > I would prefer to use Python but can't deny how popular Tcl is, as > > mentioned above, so my question is why wasn't Python selected by > > these companies as the choice of scripting languages for their > > product? > > I think

Re: Python bug tracker now secret?

2007-10-31 Thread Martin v. Löwis
> There are bug reports in the SourceForge tracker that aren't in the > "bugs.python.org" tracker, so that move was botched. Which one in particular? Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with pyparsing and dealing with null values

2007-10-31 Thread avidfan
On Mon, 29 Oct 2007 05:45:26 -0700, Paul McGuire <[EMAIL PROTECTED]> wrote: >On Oct 29, 1:11 am, avidfan <[EMAIL PROTECTED]> wrote: >> Help with pyparsing and dealing with null values >> >> I am trying to parse a log file (web.out) similar to this: >> >> ---

Re: Python bug tracker now secret?

2007-10-31 Thread Jean-Paul Calderone
On Wed, 31 Oct 2007 08:26:06 -0700, John Nagle <[EMAIL PROTECTED]> wrote: >Jean-Paul Calderone wrote: >> On Wed, 31 Oct 2007 07:53:01 -0700, John Nagle <[EMAIL PROTECTED]> wrote: >>> I'm now getting messages like this from the Python bug tracker on >>> SourceForge: >>> >>> Artifact: This Artifact

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread jelle
>if 'something' in check: > do(somethingElse) Tim, you're absolutely right that the above makes far more sense in my case. Thanks for pointing that out. -jelle -- http://mail.python.org/mailman/listinfo/python-list

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread Tim Chase
> Well, I this is another idiom in itself, right? > Your checking if something is part of an iterable. > I'm checking truth before entering a conditional expression. I'm not sure I follow. I simply replaced your if check.find('something') with if 'something' in check: which (1) is more

Re: Python bug tracker now secret?

2007-10-31 Thread Jean-Paul Calderone
On Wed, 31 Oct 2007 16:42:48 +0100, "\"Martin v. Löwis\"" <[EMAIL PROTECTED]> wrote: >> I don't know why they chose to make the sf tracker private. Maybe that >> was the only way to remove write access. > >That, plus removing it means that people won't browse outdated information. > Though it al

Re: capturing output of command line in an array

2007-10-31 Thread Lee Capps
On Oct 31, 2007, at 11:01 AM, [EMAIL PROTECTED] wrote: > I am trying to execute a command using os.system. this command lists > the number of nodes alive in a cluster. I would like to capture the > output in list/array in python. IS it possible.?/ > > Here is my command > gstat -a > node13 2

Re: why did these companies choose Tcl over Python

2007-10-31 Thread Hrvoje Niksic
Roy Smith <[EMAIL PROTECTED]> writes: > We also had lots of hooks into C code. Doing that is trivial in Tcl. Yes, > I know you can extend/embed Python, but it's a LOT easier in Tcl. > Embedding a Tcl interpreter in a C program is literally one line of > code. Have you tried both or just Tcl?

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread jelle feringa
Thanks for your in-depth explanation Tim. Which is impossible to disagree with! On 10/31/07, Tim Chase <[EMAIL PROTECTED]> wrote: > > > Well, I this is another idiom in itself, right? > > Your checking if something is part of an iterable. > > I'm checking truth before entering a conditional expre

PyCon 2008 - Call for Tutorials

2007-10-31 Thread Greg Lindstrom
PyCon 2008 is being held in Chicago this year. The general conference is March 14-16 with the proceeding day, March 13th, being the traditional "tutorial day". We have had a lot of input on topics to cover and now we are looking for qualified instructors to sign up to present the sessions. Tutoria

Re: _tkinter installation in python 2.5 on mandriva with a default 2.4

2007-10-31 Thread wyleu
> So where it tk.h located? tk.h is now in just about every directory called include that could in anyway be connected with this and indeed it does appear in the make file printout: /usr/bin/install -c -m 644 ./Include/sysmodule.h /usr/local/include/ python2.5 /usr/bin/install -c -m 644 ./Inclu

Re: why did these companies choose Tcl over Python

2007-10-31 Thread Robin Becker
Martin v. Löwis wrote: ... > I think this question needs to be answered on a case-by-case basis, > but my guess is that it is in most cases historical. Work on Tcl > started in 1988, and it was the first (major?) embeddable scripting > language (that is also free software etc). Python wasn't re

Re: _tkinter installation in python 2.5 on mandriva with a default 2.4

2007-10-31 Thread Martin v. Löwis
> tk.h is now in just about every directory called include that could in > anyway be connected with this and indeed it does appear in the make > file printout: > > /usr/bin/install -c -m 644 ./Include/tk.h /usr/local/include/python2.5 How did you get tk.h into the Include directory? You shouldn't

Re: Python bug tracker now secret?

2007-10-31 Thread Martin v. Löwis
> Though it also means all old links are broken and there's no obvious > pointer to the new information. Not all of them, no. For a long time, people could use links of the form www.python.org/sf/, and these links continue to work. Most other links on www.python.org have been fixed. I believe mos

Re: Fwd: Namespace question

2007-10-31 Thread Frank Aune
On Wednesday 31 October 2007 15:19:25 Andrii V. Mishkovskyi wrote: > You mean something like this: > >>>import random > >>>def foo(): > > ...print '42' > > >>>random.randit = foo > >>>random.randit() > > 42 > > am I right? > -- I was thinking more of the line: random.py: (my custom random.py

Re: simple? embedding question

2007-10-31 Thread Farshid Lashkari
[EMAIL PROTECTED] wrote: > it works! > could i cache maindict pointer in a global var or am i condemned to > call > PyObject* mainmod = PyImport_AddModule("__main__"); > assert(mainmod); > PyObject* maindict = PyModule_GetDict(mainmod); >

Method needed for skipping lines

2007-10-31 Thread Gustaf
Hi all, Just for fun, I'm working on a script to count the number of lines in source files. Some lines are auto-generated (by the IDE) and shouldn't be counted. The auto-generated part of files start with "Begin VB.Form" and end with "End" (first thing on the line). The "End" keyword may appear

Building libraries that my extensions can use. [distutils]

2007-10-31 Thread [EMAIL PROTECTED]
Hello all, I want to create a shared object that my extension modules can dynamically load with intact symbols across modules. Searching the documentation lead me to distutils.ccompiler. Quite frankly comprehending this has been difficult for the newbie in me. I did google (..and krugle) for setup

permuting over nested dicts?

2007-10-31 Thread Christian Meesters
Hoi, I have the following data structure (of variable size actually, to make things simple, just that one): d = {'a': {'x':[1,2,3], 'y':[4,5,6]}, 'b': {'x':[7,8,9], 'y':[10,11,12]}} This can be read as a dict of possibilities: The entities 'a' and 'b' have the parameters 'x' and 'y', each. An

Re: Method needed for skipping lines

2007-10-31 Thread Marc 'BlackJack' Rintsch
On Wed, 31 Oct 2007 18:02:26 +0100, Gustaf wrote: > Just for fun, I'm working on a script to count the number of lines in > source files. Some lines are auto-generated (by the IDE) and shouldn't be > counted. The auto-generated part of files start with "Begin VB.Form" and > end with "End" (first t

Re: marshal vs pickle

2007-10-31 Thread Raymond Hettinger
On Oct 31, 6:45 am, Aaron Watters <[EMAIL PROTECTED]> wrote: > I like to use > marshal a lot because it's the absolutely fastest > way to store and load data to/from Python. Furthermore > because marshal is "stupid" the programmer has complete > control. A lot of the overhead you get with the > p

Re: Python bug tracker now secret?

2007-10-31 Thread Terry Reedy
"John Nagle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | I'm now getting messages like this from the Python bug tracker on | SourceForge: | | Artifact: This Artifact Has Been Made Private. Only Group Members Can | View Private ArtifactTypes. This message actually comes from

Re: Metaclass vs Class factory

2007-10-31 Thread [EMAIL PROTECTED]
On Oct 30, 10:46 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > The same as the difference between a class and a function that returns > an instance. Thanks Bruno. Lorenzo -- http://mail.python.org/mailman/listinfo/python-list

Re: _tkinter installation in python 2.5 on mandriva with a default 2.4

2007-10-31 Thread wyleu
> tk.h is searched-for in detect_tkinter. Check whether tklib, tcllib, > tcl_includes and tk_includes all get set. This should take only > a single print statement. > > Regards, > Martin Ok I've cleared my increasingly frantic copies out [EMAIL PROTECTED] python2.5]# find / -name tk.h /usr/inclu

Re: py2exe (or other exe builder) on Vista system for Vista/XP install targets.

2007-10-31 Thread Michael
Björn, what library files end up being in your dist directory for that project? Would you mind posting a copy of the output of dir? I'm curious to see if there is a discrepancy. --Michael On Oct 31, 9:22 am, Bjoern Schliessmann wrote: > Michael wrote: > > [py2exe on Vista and XP] > > >

Re: permuting over nested dicts?

2007-10-31 Thread Paddy
On Oct 31, 5:21 pm, Christian Meesters <[EMAIL PROTECTED]> wrote: > Hoi, > > I have the following data structure (of variable size actually, to make > things simple, just that one): > d = {'a': {'x':[1,2,3], 'y':[4,5,6]}, > 'b': {'x':[7,8,9], 'y':[10,11,12]}} > This can be read as a dict of po

PyCon 2008 - Tutorial HowTo

2007-10-31 Thread Greg Lindstrom
Thinking about presenting a tutorial at PyCon 2008? Here's a link with everything you would ever want to know. http://us.pycon.org/2008/tutorials/proposals/ PyCon simply would not exist without volunteers like YOU. Get involved today! --greg -- http://mail.python.org/mailman/listinfo/python-

Re: _tkinter installation in python 2.5 on mandriva with a default 2.4

2007-10-31 Thread Martin v. Löwis
> Those TK libraries tcllib=None tklib=None tcl_includes=None > tk_includes=None This also contradicts your earlier statement that you have libtk8.4.so on your machine. > I don't understand why the headers report None as the file tk.h is > in /usr/include ... or is the lack of the word gener

Dictionary help

2007-10-31 Thread Steve
I'm currently working on a little database type program is which I'm using a dictionary to store the information. The key is a component a and the definition is a list of parts that make up the component. My problem is I need to list out several components, but not all, and there associated par

Re: why did these companies choose Tcl over Python

2007-10-31 Thread chewie54
On Oct 31, 3:06 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > chewie54 <[EMAIL PROTECTED]> wrote: > > >As an electronics engineer I use some very expensive EDA CAD tool > >programs that are scriptable using Tcl. I was wondering why these > >companies have choose to use Tcl instead of Python. Some

Re: marshal vs pickle

2007-10-31 Thread Aaron Watters
On Oct 31, 1:37 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > On Oct 31, 6:45 am, Aaron Watters <[EMAIL PROTECTED]> wrote: > > > I like to use > > marshal a lot because it's the absolutely fastest > > way to store and load data to/from Python > > I believe this FUD is somewhat out-of-date

Re: why did these companies choose Tcl over Python

2007-10-31 Thread Chris Mellon
On Oct 31, 2007 2:01 PM, chewie54 <[EMAIL PROTECTED]> wrote: > On Oct 31, 3:06 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > > chewie54 <[EMAIL PROTECTED]> wrote: > > > > >As an electronics engineer I use some very expensive EDA CAD tool > > >programs that are scriptable using Tcl. I was wondering

3 number and dot..

2007-10-31 Thread Abandoned
Hi.. I want to do this: for examle: 12332321 ==> 12.332.321 How can i do? -- http://mail.python.org/mailman/listinfo/python-list

Re: Namespace question

2007-10-31 Thread Chris M
On Oct 31, 10:06 am, Frank Aune <[EMAIL PROTECTED]> wrote: > Hello, > > Is it possible writing custom modules named the same as modules in the > standard library, which in turn use the same module from the standard > library? > > Say I want my application to have a random.py module, which in turn m

Re: 3 number and dot..

2007-10-31 Thread Paul McNett
Abandoned wrote: > Hi.. > I want to do this: > for examle: > 12332321 ==> 12.332.321 > > How can i do? Assuming that the dots are always in the 3rd and 7th position in the string: def conv(s, sep="."): l = [s[0:3], s[3:6], s[6:]] return sep.join(l) print conv("12332321") -- pkm ~ htt

Re: 3 number and dot..

2007-10-31 Thread Abandoned
On Oct 31, 10:18 pm, Paul McNett <[EMAIL PROTECTED]> wrote: > Abandoned wrote: > > Hi.. > > I want to do this: > > for examle: > > 12332321 ==> 12.332.321 > > > How can i do? > > Assuming that the dots are always in the 3rd and 7th position in the string: > > def conv(s, sep="."): >l = [s[0:3],

XML DOM, but in chunks

2007-10-31 Thread Sean Davis
I have some very large XML files that are basically recordsets. I would like to access each record, one-at-a-time, and I particularly like the ElementTree library for accessing the data. Is there a way to have ElementTree read only one record of the data at a time? Alternatively, are there other

Re: 3 number and dot..

2007-10-31 Thread Paul McGuire
On Oct 31, 2:58 pm, Abandoned <[EMAIL PROTECTED]> wrote: > Hi.. > I want to do this: > for examle: > 12332321 ==> 12.332.321 > > How can i do? >>> x = (12332321,) >>> while (x[0]>0): x=divmod(x[0],1000)+x[1:] ... >>> x (0, 12, 332, 321) >>> ".".join(map(str,x[1:])) '12.332.321' -- Paul -- http:

  1   2   >