mindSHIFT's InterScan MSS has removed attachment(s)

2007-03-14 Thread IMSS
The advanced content filter defined by mindSHIFT Technologies has removed the attachment(s) from the following message based on attachment type. Reference Information: Message sender: python-list@python.org Message recipients: [EMAIL PROTECTED] Message subject: “Messa

Re: Python eggs and openSuse 10.2 errors

2007-03-14 Thread Robert Kern
Turd Flop Down M'leg wrote: > Heyas > > So I got all hooked on python eggs at pycon, but then I got all hooked > on openSuse 10.2 (with the xgl cube and the beryl fanciness, and some > other misc debris). Unfortunately, it doesnt appear that openSuse > 10.2, which is using python 2.5, wants to pl

Re: Python eggs and openSuse 10.2 errors

2007-03-14 Thread Turd Flop Down M'leg
Ahh bother... After messing around with yast, I realized that I didnt have the python dev packages installed. Once I installed them with yast, I just had to create a directory 'site-packages' under /usr/local/lib/ python2.5 and it all worked fine... Bah! -- http://mail.python.org/mailman/listi

Re: design question: no new attributes

2007-03-14 Thread Harold Fellermann
Hi Alan, > One last point. While I remain interested in examples of how > "late" addition ofattributesto class instances is useful, > I must note that everyone who responded agreed that it > has been a source of bugs. This seems to argue against a > general ban on "locking" objects in some way, i

Python eggs and openSuse 10.2 errors

2007-03-14 Thread Turd Flop Down M'leg
Heyas So I got all hooked on python eggs at pycon, but then I got all hooked on openSuse 10.2 (with the xgl cube and the beryl fanciness, and some other misc debris). Unfortunately, it doesnt appear that openSuse 10.2, which is using python 2.5, wants to play nicely with python eggs. When I try

what are Python equivalent to MATLAB persistent or C++ static?

2007-03-14 Thread dmitrey
Thank you in advance, Dmitrey -- http://mail.python.org/mailman/listinfo/python-list

Re: Mocking OpenOffice in python?

2007-03-14 Thread olive
On Mar 14, 9:39 am, "PaoloB" <[EMAIL PROTECTED]> wrote: > Hi everyone, Since OO is shipped with Py 2.3 only, I use Jython to drive OO through its Java API. Our app is a mix of: - ODT XML scrapping/templating based on Dom4j which, surprisingly, when use with Jython, is the most pythonic XML API I

Re: Python books?

2007-03-14 Thread Paul Hummer
Alex Martelli wrote: > BartlebyScrivener <[EMAIL PROTECTED]> wrote: > > >> On Mar 14, 3:50 pm, [EMAIL PROTECTED] (Aahz) wrote: >> >> >>> Some people prefer shorter books -- Python for Dummies (for new >>> programmers) and Python in a Nutshell (for experienced programmers) both >>> try to gi

Re: getting user id (from an arbitrary sys user)

2007-03-14 Thread Tina I
Gerardo Herzig wrote: > hi all. What i need to know is if there is some function like > os.getuid(), but taking an argument (the username, off course), so i can > do getuid('myuser') > > Thanks you dudes! > > Gerardo How about simply: import commands userid = commands.getoutput("id -u username

Re: performance question

2007-03-14 Thread Raymond Hettinger
[Eric Texier] > I need speed here. What will be the fastest method or does it matter? Follow Alex's advice and use the timeit module, but do not generalize from too small examples; otherwise, the relative timings will be thrown-off by issues like the time to lookup "write" and "a" and "str" (all of

looking for a simple crypto library

2007-03-14 Thread Pınar Yanardağ
Hi all, I'm looking for a crypto library which can simply: - extracts a public key from a (X.509) certificate, - supports public-key algorithms. Any suggestions? With love, -- Pınar "PINguAR" Yanardağ http://pinguar.org -- http://mail.python.org/mailman/listinfo/python-list

Re: Grep Equivalent for Python

2007-03-14 Thread [EMAIL PROTECTED]
Alex Martelli wrote: > tereglow <[EMAIL PROTECTED]> wrote: >... > > server using the /proc FS. For example, in order to obtain the amount > > of physical memory on the server, I would do the following in shell: > > > > grep ^MemTotal /proc/meminfo | awk '{print $2}' > > If you would indeed do

Re: performance question

2007-03-14 Thread Alex Martelli
Eric Texier <[EMAIL PROTECTED]> wrote: > I need speed here. What will be the fastest method or does it matter? > > (for the example 'a' is only 3 values for the clarity of the example) > a = [1,3,4.] ## > > > method1: > > f.write("vec %f %f %f \n" % (a[0],a[1],a[2])) > > method2: > > f.write

Re: Add readline capability to existing interactive program [OT]

2007-03-14 Thread Kushal Kumaran
Jacob Rael wrote: > Hello, > > I use an interactive simulator/data plotter called ocean. I get really > frustrated using it because it does not have basic readline > capabilities like ctrl-a for beginning of line and ctrl-k to kill the > rest of the line. > I guess the easiest way would be this:

Re: Grep Equivalent for Python

2007-03-14 Thread Alex Martelli
tereglow <[EMAIL PROTECTED]> wrote: ... > server using the /proc FS. For example, in order to obtain the amount > of physical memory on the server, I would do the following in shell: > > grep ^MemTotal /proc/meminfo | awk '{print $2}' If you would indeed do that, maybe it's also worth learnin

Re: Python books?

2007-03-14 Thread Alex Martelli
BartlebyScrivener <[EMAIL PROTECTED]> wrote: > On Mar 14, 3:50 pm, [EMAIL PROTECTED] (Aahz) wrote: > > > Some people prefer shorter books -- Python for Dummies (for new > > programmers) and Python in a Nutshell (for experienced programmers) both > > try to give a thorough survey of Python while k

Re: Python books?

2007-03-14 Thread [EMAIL PROTECTED]
The Python Cookbook is still relevant, and is excellent. I have used it to improve the quality of my solutions to several complex problems. It helps to explain many of the more advanced tricks to Python development. -T -- http://mail.python.org/mailman/listinfo/python-list

Re: Circular Class Logic

2007-03-14 Thread Gabriel Genellina
gmail.com> writes: > That's not exactly what I'm doing, but your comment still might help. > I actually want to include an instance of a subclass in it's > superclass like this: Move the initialization to another function. > > = foo.py = > # import Baz Remove the line above > > class

performance question

2007-03-14 Thread Eric Texier
I need speed here. What will be the fastest method or does it matter? (for the example 'a' is only 3 values for the clarity of the example) a = [1,3,4.] ## method1: f.write("vec %f %f %f \n" % (a[0],a[1],a[2])) method2: f.write("vec " + str(a[0]) + " " + str(a[1]) + " " + str(a[2]) + "\n") a

Re: Returning other instance from __init__

2007-03-14 Thread Alex Martelli
Paulo da Silva <[EMAIL PROTECTED]> wrote: > I would like to implement something like this: > > class C1: > def __init__(self,xxx): > if ... : > self.foo = foo > self.bar = bar > else: > self=C1.loa

Returning other instance from __init__

2007-03-14 Thread Paulo da Silva
I would like to implement something like this: class C1: def __init__(self,xxx): if ... : self.foo = foo self.bar = bar else: self=C1.load(xxx) def load(xxx): ..

Box plot in Python

2007-03-14 Thread Sebastian Bassi
Hello, Is there a graphic package for Python that provides support for box plots? (see http://en.wikipedia.org/wiki/Box_plot and http://en.wikipedia.org/wiki/Image:R-speed_of_light_boxplot.png for information on box plots). I have N sets of data, each with X "points". Example: Set 1: Point 1: 0.

Re: distributing python software in jar like fashion

2007-03-14 Thread Shane Geiger
Hi, I have a small app which consist of a few .py files. Is there any way to distribute it in jar like fashion as a single file I can just run python on. I obviously look for platform independent solution. Thx in advance, A. """ Author: Shane Geiger <[EMAIL PROTECTED]> Wed Mar 14 21

Re: spawn process in a new console window

2007-03-14 Thread [EMAIL PROTECTED]
On Mar 14, 9:56 pm, [EMAIL PROTECTED] wrote: > Hello, > > I have a script that launches a sequence of other programs, some GUI, > some console. I'd like the console programs to launch in their own > console window, instead of all of them sharing the script's console. > How do I do that? > Would t

Re: windows blinds

2007-03-14 Thread Bill Mill
On Mar 14, 4:58 pm, lled <[EMAIL PROTECTED]> wrote: > i am new to python and wanted to know > could i use it to write a programme so when i double click on a windoz > window it collapses (like in linux)? You probably could, but you would basically be writing C, because you're going to need to use

Re: Too slow to read an entire table from Microsoft Access

2007-03-14 Thread fumanchu
On Mar 14, 7:34 pm, lialie <[EMAIL PROTECTED]> wrote: > I read a table with 4500 rows and 12 columns using win32com.client. > Reading and updating records are OK, but cost too much time.Especially > making a dict as line(***). > All follows done may take nearly 90s! > Is there any good idea? Thanks

Re: distributing python software in jar like fashion

2007-03-14 Thread Ben Finney
alf <[EMAIL PROTECTED]> writes: > I have a small app which consist of a few .py files. Is there any > way to distribute it in jar like fashion as a single file I can just > run python on. I obviously look for platform independent solution. Python eggs are the platform-independent distributable si

Re: distributing python software in jar like fashion

2007-03-14 Thread ce
On Mar 15, 10:23 am, alf <[EMAIL PROTECTED]> wrote: > Hi, > > I have a small app which consist of a few .py files. Is there any way to > distribute it in jar like fashion as a single file I can just run python > on. I obviously look for platform independent solution. > > Thx in advance, A. You can

Re: Python books?

2007-03-14 Thread Jim Hill
wesley chun wrote: >my book, Core Python Programming, is revised to 2.5, but focuses on >teaching you the core part of the language, features, objects, memory >management, development, good practices, some advanced topic coverage, >and presents lots of exercises. however, it is not an exhaustive

Too slow to read an entire table from Microsoft Access

2007-03-14 Thread lialie
Hi, all: I read a table with 4500 rows and 12 columns using win32com.client. Reading and updating records are OK, but cost too much time.Especially making a dict as line(***). All follows done may take nearly 90s! Is there any good idea? Thanks. conn = win32com.client.Dispatch(r'ADODB.Connection')

distributing python software in jar like fashion

2007-03-14 Thread alf
Hi, I have a small app which consist of a few .py files. Is there any way to distribute it in jar like fashion as a single file I can just run python on. I obviously look for platform independent solution. Thx in advance, A. -- http://mail.python.org/mailman/listinfo/python-list

spawn process in a new console window

2007-03-14 Thread eglaser
Hello, I have a script that launches a sequence of other programs, some GUI, some console. I'd like the console programs to launch in their own console window, instead of all of them sharing the script's console. How do I do that? I'm on Windows, and currently I'm using os.spawnl(...) to launch

Re: Circular Class Logic

2007-03-14 Thread half . italian
> > That is, each of the classes want to inherit from the others. That's not exactly what I'm doing, but your comment still might help. I actually want to include an instance of a subclass in it's superclass like this: = foo.py = import Baz class Foo: baz = Baz.Baz() def

python-list@python.org

2007-03-14 Thread lubiao
Hi I have created a simple function called 'addTheString(string& str, string appstr)' and the intension is to append the 'appstr' to 'str' and use 'str'. I tried swigging this method. My swigtest.i file is okay as I think I have added both - stl.i at top - std_string.i However, I a

Re: merits of Lisp vs Python

2007-03-14 Thread Jorge Godoy
[EMAIL PROTECTED] (John J. Lee) writes: > John Nagle <[EMAIL PROTECTED]> writes: > >> John J. Lee wrote: >> > "Graham Dumpleton" <[EMAIL PROTECTED]> writes: >> > >> >>On Mar 11, 12:31 pm, [EMAIL PROTECTED] (John J. Lee) wrote: >> >> > Is it possible to ask mod_python to start separate processes t

Re: Circular Class Logic

2007-03-14 Thread Ben Finney
[EMAIL PROTECTED] writes: > Short of making 'Disk' no longer a subclass of Folder, is there any > other way to include a subclassed instance in the base class of that > object? (this is very hard to put in to words) It's a little difficult to visualise what you're describing, but IIUC your proble

Re: merits of Lisp vs Python

2007-03-14 Thread John J. Lee
John Nagle <[EMAIL PROTECTED]> writes: > John J. Lee wrote: > > "Graham Dumpleton" <[EMAIL PROTECTED]> writes: > > > >>On Mar 11, 12:31 pm, [EMAIL PROTECTED] (John J. Lee) wrote: > > > Is it possible to ask mod_python to start separate processes to serve > > requests, rather than "separate" inter

Circular Class Logic

2007-03-14 Thread half . italian
I have a set of classes that describe Files, Folders, etc., that I use often in my scripts for moving files around, getting a files extension, converting paths, changing permissions, etc It's very similar to Jason Orendorff's 'Path' library, and is very useful to me. The base class 'Data.py' stor

Re: merits of Lisp vs Python

2007-03-14 Thread John Nagle
John J. Lee wrote: > "Graham Dumpleton" <[EMAIL PROTECTED]> writes: > >>On Mar 11, 12:31 pm, [EMAIL PROTECTED] (John J. Lee) wrote: > Is it possible to ask mod_python to start separate processes to serve > requests, rather than "separate" interpreters? We couldn't see a way. That's what CGI

Python COM called from VB/Delphi

2007-03-14 Thread Larry Bates
I have a rather large Python class that I've converted to a COM object. I can dispatch (using either Python or VB) and call the methods perfectly. Now a new client wants to call it from Delphi. Can anyone out there give me any pointers on how that would be done. Are there any "gotchas" about th

Re: Attribute monitoring in a class

2007-03-14 Thread Gabriel Genellina
En Wed, 14 Mar 2007 10:01:54 -0300, Joel Andres Granados <[EMAIL PROTECTED]> escribió: > Bruno Desthuilliers wrote: >> Joel Andres Granados a écrit : >>> I'm >>> working with code that is not of my authorship and there is a class >>> attribute that is changes by directly referencing it (object.

Re: most complete xml package for Python?

2007-03-14 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, metaperl wrote: > Well, I'm not a troll. And I am now even less impressed with > ElementTree. It does not preserve the document but reforms it in > certain cases. > > > > gets rewritten as > > > > which leads to problems when embedding Dojo Rich Text Editors. So thos

Re: question about class methods

2007-03-14 Thread Gabriel Genellina
En Wed, 14 Mar 2007 18:04:00 -0300, Darren Dale <[EMAIL PROTECTED]> escribió: > I've run across some code in a class method that I don't understand: > > def example(self, val=0) > if val and not self: > if self._exp < 0 and self._exp >= -6: 0) "Normal" methods are not cl

Re: question about class methods

2007-03-14 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Darren Dale wrote: > I've run across some code in a class method that I don't understand: > > def example(self, val=0) > if val and not self: > if self._exp < 0 and self._exp >= -6: > > I am unfamiliar with some concepts here: > > 1) Under what ci

Re: string formatting: engineering notation

2007-03-14 Thread Darren Dale
[EMAIL PROTECTED] wrote: > On Mar 14, 1:14 pm, Darren Dale <[EMAIL PROTECTED]> wrote: >> Does anyone know if it is possible to represent a number as a string with >> engineering notation (like scientific notation, but with 10 raised to >> multiples of 3: 120e3, 12e-6, etc.). I know this is possibl

Re: most complete xml package for Python?

2007-03-14 Thread metaperl
On Mar 14, 5:34 pm, "John Machin" <[EMAIL PROTECTED]> wrote: > > Given keywords like "Amara" and "Elementtree" and past history, it > looked to me like a troll of one kind trying to incite a troll of > another kind to pop out from under the bridge and chew on his > ankle :-) Well, I'm not a trol

Re: string formatting: engineering notation

2007-03-14 Thread attn . steven . kuo
On Mar 14, 1:14 pm, Darren Dale <[EMAIL PROTECTED]> wrote: > Does anyone know if it is possible to represent a number as a string with > engineering notation (like scientific notation, but with 10 raised to > multiples of 3: 120e3, 12e-6, etc.). I know this is possible with the > decimal.Decimal cl

RE: Mocking OpenOffice in python?

2007-03-14 Thread Delaney, Timothy (Tim)
"Your father was a hamster, and your mother smelled of elderberry." Oh - unit testing. Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

Re: most complete xml package for Python?

2007-03-14 Thread John Machin
On Mar 15, 3:45 am, Steve Holden <[EMAIL PROTECTED]> wrote: > Paul Boddie wrote: > > On 14 Mar, 16:15, Stefan Behnel <[EMAIL PROTECTED]> wrote: > >> metaperl wrote: > >>> Without even checking them all out, I'm thinking the Amara XML Toolkit > >>> must be the most feature-packed. > >> Please check

Re: merits of Lisp vs Python

2007-03-14 Thread Graham Dumpleton
On Mar 15, 7:22 am, [EMAIL PROTECTED] (John J. Lee) wrote: > "Graham Dumpleton" <[EMAIL PROTECTED]> writes: > > On Mar 11, 12:31 pm, [EMAIL PROTECTED] (John J. Lee) wrote: > [...] > > >mod_pythonrelies on an unsupported feature of Python, namely > > > multiple interpreters --> risk of more pain wit

Re: How to Start a (thread?) and Leave

2007-03-14 Thread Aahz
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >I'm leaning towards os.startfile right now. I also see some os.spawn >beasties in there but I don't understand those. Try the subprocess module -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft

Re: dict.items() vs dict.iteritems and similar questions

2007-03-14 Thread Paul Rubin
Laurent Pointal <[EMAIL PROTECTED]> writes: > Both work, you may prefer xrange/iteritems for iteration on large > collections, you may prefer range/items when processing of the result > value explicitly need a list (ex. calculate its length) or when you are > going to manipulate the original contai

Re: string formatting: engineering notation

2007-03-14 Thread Jorge Godoy
Steve Holden <[EMAIL PROTECTED]> writes: > Darren Dale wrote: >> Does anyone know if it is possible to represent a number as a string with >> engineering notation (like scientific notation, but with 10 raised to >> multiples of 3: 120e3, 12e-6, etc.). I know this is possible with the >> decimal.De

Re: string formatting: engineering notation

2007-03-14 Thread Grant Edwards
On 2007-03-14, Steve Holden <[EMAIL PROTECTED]> wrote: > Darren Dale wrote: >> Does anyone know if it is possible to represent a number as a string with >> engineering notation (like scientific notation, but with 10 raised to >> multiples of 3: 120e3, 12e-6, etc.). I know this is possible with the

Re: os.path.basename() - only Windows OR *nix?

2007-03-14 Thread Thomas Ploch
Bruno Desthuilliers schrieb: > > Let me guess : your cgi script is running on *n*x ?-) > Pretty hard to get this one, heh? :-D > > Probably. Good that you decided I was worth the information. > >>> fnames = "C:\\dir\\data.ext", "/dir/data.txt", "dir:data" > >>> import ntpath, posixpath, ma

Re: string formatting: engineering notation

2007-03-14 Thread Darren Dale
Steve Holden wrote: > Darren Dale wrote: >> Does anyone know if it is possible to represent a number as a string with >> engineering notation (like scientific notation, but with 10 raised to >> multiples of 3: 120e3, 12e-6, etc.). I know this is possible with the >> decimal.Decimal class, but repe

Add readline capability to existing interactive program

2007-03-14 Thread Jacob Rael
Hello, I use an interactive simulator/data plotter called ocean. I get really frustrated using it because it does not have basic readline capabilities like ctrl-a for beginning of line and ctrl-k to kill the rest of the line. I was thinking this might be easy to add with Python. Do something like

question about class methods

2007-03-14 Thread Darren Dale
I've run across some code in a class method that I don't understand: def example(self, val=0) if val and not self: if self._exp < 0 and self._exp >= -6: I am unfamiliar with some concepts here: 1) Under what circumstances would "if not self" be True? 2) If "not self" is

Re: Python books?

2007-03-14 Thread BartlebyScrivener
On Mar 14, 3:50 pm, [EMAIL PROTECTED] (Aahz) wrote: > Some people prefer shorter books -- Python for Dummies (for new > programmers) and Python in a Nutshell (for experienced programmers) both > try to give a thorough survey of Python while keeping the book easy to > carry. And other people like

Re: python/C++ wrapper

2007-03-14 Thread Frank
On Mar 14, 1:42 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 14 Mar 2007 01:55:55 -0300, Frank <[EMAIL PROTECTED]> escribió: > > > is there anyone here that calls C++ programs from python via swig? It > > I suggest you read the responses to your previous question; also search > the

Re: string formatting: engineering notation

2007-03-14 Thread Steve Holden
Darren Dale wrote: > Does anyone know if it is possible to represent a number as a string with > engineering notation (like scientific notation, but with 10 raised to > multiples of 3: 120e3, 12e-6, etc.). I know this is possible with the > decimal.Decimal class, but repeatedly instantiating Decima

Re: Converting a list to a dictionary

2007-03-14 Thread Drew
On Mar 14, 4:52 pm, "Samuel" <[EMAIL PROTECTED]> wrote: > On Mar 14, 9:48 pm, "Drew" <[EMAIL PROTECTED]> wrote: > > > This is interesting behavior, but may not be what the original poster > > intended. > > I am the original poster :). > > > If I understand correctly, this means that if more than on

windows blinds

2007-03-14 Thread lled
i am new to python and wanted to know could i use it to write a programme so when i double click on a windoz window it collapses (like in linux)? -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a list to a dictionary

2007-03-14 Thread Samuel
On Mar 14, 9:48 pm, "Drew" <[EMAIL PROTECTED]> wrote: > This is interesting behavior, but may not be what the original poster > intended. I am the original poster :). > If I understand correctly, this means that if more than one > object shares the same id, only one copy will be created in the di

Re: Setting Up SOAPpy for Python v2.5 on Windows?

2007-03-14 Thread Waldemar Osuch
On Mar 14, 10:22 am, "Steve" <[EMAIL PROTECTED]> wrote: > All, > > Thanks for the suggestions! > > I think that I will move forward with elementsoap instead of soappy... > Maybe worth checking out the new kid on the block too: http://trac.optio.webfactional.com/wiki -- http://mail.python.org/ma

Re: Python books?

2007-03-14 Thread Aahz
In article <[EMAIL PROTECTED]>, Tommy Nordgren <[EMAIL PROTECTED]> wrote: >> > I've found one interesting text book on Python: >Mark Lutz - Programming Python, 3rd Edition. >How do you rate it? > One of the reasons I find it interesting is because of it's hefty >page count >- over 15

Re: Converting a list to a dictionary

2007-03-14 Thread Steve Holden
Drew wrote: > On Mar 14, 4:52 pm, Bruno Desthuilliers > <[EMAIL PROTECTED]> wrote: > >> res_dict = dict((r.get_id(), r) for r in res_list) > > I'm using Python2.5 and it seems that this only gives me a hash with > the first id and first record. Am I doing something wrong? > class Person():

Re: Converting a list to a dictionary

2007-03-14 Thread Drew
On Mar 14, 4:43 pm, "Samuel" <[EMAIL PROTECTED]> wrote: > What this does is it maps the id to the object. In your case, you only > have one id. > > -Samuel This is interesting behavior, but may not be what the original poster intended. If I understand correctly, this means that if more than one ob

Re: is it possible to give an instance a value?

2007-03-14 Thread Aahz
In article <[EMAIL PROTECTED]>, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >manstey a écrit : >> >> Is there a way to make a have the value a.val > >Forget about the value/instance distinction - it doesn't exists in Python. Actually, I think it does. For example, int('123') has the value 12

Re: Converting a list to a dictionary

2007-03-14 Thread Samuel
On Mar 14, 9:32 pm, "Drew" <[EMAIL PROTECTED]> wrote: > I'm using Python2.5 and it seems that this only gives me a hash with > the first id and first record. Am I doing something wrong? Try this instead: >>> class Person(): ... def __init__(self): ... self.id = 5 ... >>> mylist =

Re: python/C++ wrapper

2007-03-14 Thread Gabriel Genellina
En Wed, 14 Mar 2007 01:55:55 -0300, Frank <[EMAIL PROTECTED]> escribió: > is there anyone here that calls C++ programs from python via swig? It I suggest you read the responses to your previous question; also search the list archives for this month. -- Gabriel Genellina -- http://mail.pytho

Re: Converting a list to a dictionary

2007-03-14 Thread Drew
On Mar 14, 4:52 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > res_dict = dict((r.get_id(), r) for r in res_list) I'm using Python2.5 and it seems that this only gives me a hash with the first id and first record. Am I doing something wrong? >>> class Person(): ... def __init__(self):

Re: Beginner question: difference between lists and tuples

2007-03-14 Thread Bruno Desthuilliers
KDawg44 a écrit : > Hi, > > I am trying to learn python. I am working through a tutorial on > python.org. I am trying to figure out how lists are different than > tuples other than changing values at specific indices. http://www.python.org/doc/faq/general/#why-are-there-separate-tuple-and-list-

Re: merits of Lisp vs Python

2007-03-14 Thread John J. Lee
"Graham Dumpleton" <[EMAIL PROTECTED]> writes: > On Mar 11, 12:31 pm, [EMAIL PROTECTED] (John J. Lee) wrote: [...] > > mod_python relies on an unsupported feature of Python, namely > > multiple interpreters --> risk of more pain with C extensions. > > As usual, those bashing up on mod_python tend

Re: Converting a list to a dictionary

2007-03-14 Thread Samuel
On Mar 14, 9:52 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > res_dict = dict((r.get_id(), r) for r in res_list) > > or if you have to be compatible with older python versions: > > res_dict = dict([(r.get_id(), r) for r in res_list]) Yep, that works. Strange, I was sure I had tested the lat

Re: Converting a list to a dictionary

2007-03-14 Thread Leif K-Brooks
Samuel wrote: > This does not work: > > res_dict = dict([r.get_id(), r for r in res_list]) This does: res_dict = dict([(r.get_id(), r) for r in res_list]) -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a list to a dictionary

2007-03-14 Thread Bruno Desthuilliers
Samuel a écrit : > Hi, > > is there a short version for this? > > res_dict = {} > for resource in res_list: > res_dict[resource.get_id()] = resource > > This does not work: > > res_dict = dict([r.get_id(), r for r in res_list]) res_dict = dict((r.get_id(), r) for r in res_list) or if you ha

string formatting: engineering notation

2007-03-14 Thread Darren Dale
Does anyone know if it is possible to represent a number as a string with engineering notation (like scientific notation, but with 10 raised to multiples of 3: 120e3, 12e-6, etc.). I know this is possible with the decimal.Decimal class, but repeatedly instantiating Decimals is inefficient for my ap

Re: os.path.basename() - only Windows OR *nix?

2007-03-14 Thread Bruno Desthuilliers
Thomas Ploch a écrit : > Hello, > > I have a cgi script that handles fileuploads from windows and *nix > machines. i need os.path.basename(filename) to get the pure filename. > > For *nix, thats not a problem, but for windows, it always returns the > full path: > > > > #/usr/bin/env python >

Re: Constructor of object

2007-03-14 Thread Thinker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 inline wrote: > I know it, but i don't want call constructor of parent class - I > use PyGTK and want to load window from glade file and assign it to > object, parented gtk.Window: > #!/usr/bin/env python > import gtk import gtk.glade > class Hello

Converting a list to a dictionary

2007-03-14 Thread Samuel
Hi, is there a short version for this? res_dict = {} for resource in res_list: res_dict[resource.get_id()] = resource This does not work: res_dict = dict([r.get_id(), r for r in res_list]) -Samuel -- http://mail.python.org/mailman/listinfo/python-list

Re: Grep Equivalent for Python

2007-03-14 Thread [EMAIL PROTECTED]
On Mar 14, 10:57 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > In <[EMAIL PROTECTED]>, Laurent Pointal wrote: > > > Steve Holden a écrit : > >> Regular expressions aren't really needed here. Untested code follows: > > >> for line in open('/proc/meminfo').readlines: > > for line in open(

Re: Beginner question: difference between lists and tuples

2007-03-14 Thread Jim
On Mar 14, 3:46 pm, "KDawg44" <[EMAIL PROTECTED]> wrote: > I am trying to learn python. I am working through a tutorial on > python.org. I am trying to figure out how lists are different than > tuples other than changing values at specific indices. You can change lists but not tuples. That has s

command line arguments using subprocess

2007-03-14 Thread Jim
Hello, I'm trying to use subprocess to drive a Perl script. I'm having some trouble getting it to spot the command line arguments. Basically, if I call subprocess(args).wait() where args has a second item, I can't convince the Perl script to see it. Below is a pretty small example. If someone c

Beginner question: difference between lists and tuples

2007-03-14 Thread KDawg44
Hi, I am trying to learn python. I am working through a tutorial on python.org. I am trying to figure out how lists are different than tuples other than changing values at specific indices. How are these different from arrays in other languages such as php? THanks. -- http://mail.python.org/

Re: os.path.basename() - only Windows OR *nix?

2007-03-14 Thread Steve Holden
Thomas Ploch wrote: > Steve Holden schrieb: >> Clearly if form['uploadfile'] is returning the client's path information >> you do have to remove that somehow before further processing, which also >> means you need to deduce what the client architecture is to correctly >> remove path data. Of cou

Re: Starting an external, independent process from a script

2007-03-14 Thread skam
I use ffmpeg instead of mencoder, calling it using os.popen(). You can also use the "commands" module, but I prefer the first one. Bye, Massimo -- http://mail.python.org/mailman/listinfo/python-list

Re: os.path.basename() - only Windows OR *nix?

2007-03-14 Thread Larry Bates
Thomas Ploch wrote: > Steve Holden schrieb: >> Clearly if form['uploadfile'] is returning the client's path information >> you do have to remove that somehow before further processing, which also >> means you need to deduce what the client architecture is to correctly >> remove path data. Of cou

Re: dict.items() vs dict.iteritems and similar questions

2007-03-14 Thread skip
>> I find "iter" to be extremely ugly and hope to avoid using >> them altogether until they are gone in Py3k. Drew> Ugly, maybe, but don't you take a decent performance hit when Drew> loading the entire dict into memory at once? Especially if the Drew> dict is large? Sure, but

Re: os.path.basename() - only Windows OR *nix?

2007-03-14 Thread Thomas Ploch
Steve Holden schrieb: > Clearly if form['uploadfile'] is returning the client's path information > you do have to remove that somehow before further processing, which also > means you need to deduce what the client architecture is to correctly > remove path data. Of course this also leaves open

Re: dict.items() vs dict.iteritems and similar questions

2007-03-14 Thread Drew
On Mar 14, 2:53 pm, [EMAIL PROTECTED] wrote: > >> When is it appropriate to use dict.items() vs dict.iteritems. > > Laurent> Both work, you may prefer xrange/iteritems for iteration on > Laurent> large collections... > > I find "iter" to be extremely ugly and hope to avoid using them >

Re: Questions on migrating from Numeric/Scipy to Numpy

2007-03-14 Thread Robert Kern
vj wrote: > What should I be using to replace Numeric/arrayobject.h: > > numpy/arrayobject.h > > or > > numpy/oldnumeric.h Replacing "numpy/oldnumeric.h" is the compatibility header. If you don't want to convert your code to use the new APIs (and you might; it is much improved), then that shoul

Re: Constructor of object

2007-03-14 Thread Bruno Desthuilliers
inline a écrit : > Hello! > I want to assign self to object of parent class in constructor, Isn't it the other way round ?-) > like > > def my_func(): > ... > return ParentClass() > > class MyClass (ParentClass): > def __init__(self): > self = my_func() First point : __init

Re: os.path.basename() - only Windows OR *nix?

2007-03-14 Thread Steve Holden
Thomas Ploch wrote: > Hello, > > I have a cgi script that handles fileuploads from windows and *nix > machines. i need os.path.basename(filename) to get the pure filename. > > For *nix, thats not a problem, but for windows, it always returns the > full path: > > > > #/usr/bin/env python > > i

Re: dict.items() vs dict.iteritems and similar questions

2007-03-14 Thread skip
>> When is it appropriate to use dict.items() vs dict.iteritems. Laurent> Both work, you may prefer xrange/iteritems for iteration on Laurent> large collections... I find "iter" to be extremely ugly and hope to avoid using them altogether until they are gone in Py3k. Skip -- http:/

Re: Constructor of object

2007-03-14 Thread inline
On Mar 14, 9:05 pm, Thinker <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > inline wrote: > > Hello! I want to assign self to object of parent class in > > constructor, like > > > def my_func(): ... return ParentClass() > > > class MyClass (ParentClass): def __init_

Re: Grep Equivalent for Python

2007-03-14 Thread Fabio FZero
On Mar 14, 9:37 am, "tereglow" <[EMAIL PROTECTED]> wrote: > Hello all, > > I come from a shell/perl background and have just to learn python. To > start with, I'm trying to obtain system information from a Linux > server using the /proc FS. For example, in order to obtain the amount > of physical

Re: Constructor of object

2007-03-14 Thread inline
On Mar 14, 9:05 pm, Thinker <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > inline wrote: > > Hello! I want to assign self to object of parent class in > > constructor, like > > > def my_func(): ... return ParentClass() > > > class MyClass (ParentClass): def __init_

os.path.basename() - only Windows OR *nix?

2007-03-14 Thread Thomas Ploch
Hello, I have a cgi script that handles fileuploads from windows and *nix machines. i need os.path.basename(filename) to get the pure filename. For *nix, thats not a problem, but for windows, it always returns the full path: #/usr/bin/env python import cgi, os import cgitb; cgitb.enable() fo

Re: war with china? a different approach?

2007-03-14 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Mar 11, 3:03 pm, [EMAIL PROTECTED] wrote: >> Are you there, cause I don't want to waste my time writing a response >> to that if you're not there anymore. Please respond w/ a new post if >> you do check this. > > A lot of us other than the OP would be interested in a

  1   2   3   >