Re: urllib2 performance on windows, usb connection

2009-02-05 Thread Martin v. Löwis
> So does anyone know what the deal is with this? Why is the same code so > much slower on Windows? Hope someone can tell me before a holy war > erupts :-) Only the holy war can give an answer here. It certainly has *nothing* to do with Python; Python calls the operating system functions to read

urllib2 performance on windows, usb connection

2009-02-05 Thread dq
I've googled this pretty extensively and can't find anyone who's had the same problem, so here it is: I wrote a console program in python to download podcasts, so speed is an issue. I have 1.6 M down. The key bit of downloading code is this: source = urllib2.urlopen( url ) target = open( fi

Re: web2py 1.56 is OUT

2009-02-05 Thread Markus Gritsch
Hi, when copying and pasting the example from the announcement into files, it wont run due to some errors: 2009/2/5 Massimo Di Pierro : > > Example of code (complete app) > = >## in model db.py >from gluon.tools import * >db=SQLDB() >db.define_table('puppy'

Re: Using multiprocessing from a Windows service

2009-02-05 Thread Volodymyr Orlenko
On 05/02/2009 9:54 PM, James Mills wrote: On Fri, Feb 6, 2009 at 3:21 PM, Volodymyr Orlenko wrote: [...] Maybe there's another way to fix the forking module? I believe the best way to fix this is to fix the underlying issue that Mark has pointed out (monkey-patching mp won't do).

Re: Where to host a (Python) project?

2009-02-05 Thread alex goretoy
I use google code. http://code.google.com/p/pynutbutter -Alex Goretoy http://www.alexgoretoy.com On Thu, Feb 5, 2009 at 6:55 PM, Ben Finney < bignose+hates-s...@benfinney.id.au >wrote: > a...@pythoncraft.com (Aahz) writes: > > > In article < > 6dcb8ce5-c93e-458c-9047-e5db60f27...@v18g2000pro.g

reconstruct html form in pyGTK window and create dict from pyGTK

2009-02-05 Thread alex goretoy
Hello All, What would be the best way to fetch a form/s from a webpage and then recreate it in a pygtk window? I'm doing some research on this for a project called pynutbutter. This is for jellpy actually, which handles creating option mappings for pynutbutter from a GUI. The things I know I woul

Re: Is c.l.py becoming less friendly?

2009-02-05 Thread Hendrik van Rooyen
"Steve Holden" wrote: > Yes, and I'm fine well sure this is somewhere between a silly thread and > a troll. "Fine" reads wrong - it should be fining. Silly? Us here on clp, silly? What a monstrous thought! I'll have you know this is a respectable establishment, and you should be grateful tha

Python Power Point Slides

2009-02-05 Thread Tehseen Siddiqui
-- DISCLAIMER: The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient

i have an query regarding pyodbc

2009-02-05 Thread Rahul
hello all, I have installed pyodbc on my red hat enterprise 4 linux machine but when i go to use that using statement, import pyodbc through python console it gives me error as ImportError : dynamic module does not define init function (initpyodbc) and when i do 'nm pyodbc.so' command i get ou

Re: Is c.l.py becoming less friendly?

2009-02-05 Thread Hendrik van Rooyen
"Mensanator" >On Feb 5, 4:20 pm, Terry Reedy wrote: >> mk wrote: >> >> > (duck) >> >> > 542 comp.lang.python rtfm >> >> What is so unfriendly about 'read the fine manual'? > >You've seen a fine manual? Oh Fine! - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: What is difference between ADO and RDO

2009-02-05 Thread Chris Rebert
On Thu, Feb 5, 2009 at 9:52 PM, agile wrote: > Explain ADO and RDO Take 5 seconds to Google them and find their Wikipedia pages: http://en.wikipedia.org/wiki/Remote_Data_Objects http://en.wikipedia.org/wiki/ActiveX_Data_Objects Apparently they're 2 Microsoft technology acronyms -- and they're **

What is difference between ADO and RDO

2009-02-05 Thread agile
Explain ADO and RDO -- http://mail.python.org/mailman/listinfo/python-list

Re: Using multiprocessing from a Windows service

2009-02-05 Thread James Mills
On Fri, Feb 6, 2009 at 3:21 PM, Volodymyr Orlenko wrote: > In the patch I submitted, I simply check if the name of the supposed module > ends with ".exe". It works fine for my case, but maybe this is too general. > Is there a chance that a Python module would end in ".exe"? If so, maybe we > shoul

Re: Using multiprocessing from a Windows service

2009-02-05 Thread Volodymyr Orlenko
On 05/02/2009 8:26 PM, Mark Hammond wrote: On 6/02/2009 2:50 PM, Mark Hammond wrote: On 6/02/2009 11:37 AM, Volodya wrote: Hi all, I think I've found a small bug with multiprocessing package on Windows. I'd actually argue its a bug in pythonservice.exe - it should set sys.argv[] to resembl

Re: return multiple objects

2009-02-05 Thread Vincent Davis
That is what I was missing, Thanks Vincent Davis On Thu, Feb 5, 2009 at 8:37 PM, Rhodri James wrote: > On Fri, 06 Feb 2009 03:03:01 -, Vincent Davis < > vinc...@vincentdavis.net> wrote: > > Is it correct that if I want to return multiple objects from a function I >> need to in some way com

Re: Using multiprocessing from a Windows service

2009-02-05 Thread Mark Hammond
On 6/02/2009 2:50 PM, Mark Hammond wrote: On 6/02/2009 11:37 AM, Volodya wrote: Hi all, I think I've found a small bug with multiprocessing package on Windows. I'd actually argue its a bug in pythonservice.exe - it should set sys.argv[] to resemble a normal python process with argv[0] being t

Re: Using multiprocessing from a Windows service

2009-02-05 Thread Mark Hammond
On 6/02/2009 11:37 AM, Volodya wrote: Hi all, I think I've found a small bug with multiprocessing package on Windows. I'd actually argue its a bug in pythonservice.exe - it should set sys.argv[] to resemble a normal python process with argv[0] being the script. I'll fix it... Cheers, Mar

Re: return multiple objects

2009-02-05 Thread Rhodri James
On Fri, 06 Feb 2009 03:03:01 -, Vincent Davis wrote: Is it correct that if I want to return multiple objects from a function I need to in some way combine them? def test1(): a = [1,3,5,7] b = [2,4,6,8] c=[a,b] return a, b # this does not work? return [a, b] # does not wo

Re: Converting numbers to words

2009-02-05 Thread Brian Allen Vanderburg II
todp...@hotmail.com wrote: > > I've been trying to figure this out for over 2 hours and I'm really frustrated right now. > > I first made Python to ask user to input height in meters. If user puts certain value in meter, then it converts it to feet and inches as follows: > > > Enter the hei

Re: subprocess returncode windows

2009-02-05 Thread Gabriel Genellina
En Thu, 05 Feb 2009 17:34:29 -0200, Andrew escribió: On Dec 16 2008, 5:11 pm, "Gabriel Genellina" wrote: En Tue, 16 Dec 2008 17:21:35 -0200, Andrew   escribió: > On Dec 16, 12:50 pm, Christian Heimes wrote: >> Andrew schrieb: >> > I'm running into a strange situation with getting inco

Re: return multiple objects

2009-02-05 Thread Chris Rebert
On Thu, Feb 5, 2009 at 7:03 PM, Vincent Davis wrote: > Is it correct that if I want to return multiple objects from a function I > need to in some way combine them? > def test1(): > a = [1,3,5,7] > b = [2,4,6,8] > c=[a,b] >return a, b # this does not work? >return [a, b] # does

return multiple objects

2009-02-05 Thread Vincent Davis
Is it correct that if I want to return multiple objects from a function I need to in some way combine them? def test1(): a = [1,3,5,7] b = [2,4,6,8] c=[a,b] return a, b # this does not work? return [a, b] # does not work? return c # this works but I don't like it, , is there a

Re: Flattening lists

2009-02-05 Thread Benjamin Peterson
mk gmail.com> writes: > Hmm, I'm surprised by even that! Apparently list creation is more > expensive than I thought - it seems somewhat more expensive than the > cost of interpreting bytecode for "if var is None". Either list creation > is somewhat costly, or "if var is None" is really cheap.

Re: Converting numbers to words

2009-02-05 Thread Steve Holden
todp...@hotmail.com wrote: > I've been trying to figure this out for over 2 hours and I'm really > frustrated right now. > > I first made Python to ask user to input height in meters. If user puts > certain value in meter, then it converts it to feet and inches as follows: > > > Enter the heigh

Re: MacPython 3.0 dmg installer?

2009-02-05 Thread Benjamin Peterson
Con gmail.com> writes: > > Hi, I was wondering, what's the status of the MacPython 3.0 installer > (.i.e. dmg file) ? I have been using the previous MacPython dmg > installers with great success without conflicting with other > installations on the system. There should be ones for 3.0.1 which

Re: sorting for recursive folder rename

2009-02-05 Thread ianaré
On Dec 16 2008, 7:36 pm, "Rhodri James" wrote: > On Tue, 16 Dec 2008 18:20:52 -, ianaré wrote: > > Hello all, > > > I trying to recursivelyrenamefolders and files, and am looking for > > some ideas on the best way of doing this. The problem is that the > > given list of items can be in order,

ANN: Nucular full text indexing 0.4

2009-02-05 Thread Aaron Watters
ANNOUNCING NUCULAR 0.4 == This release adds a simple "table space" wrapper which makes Nucular easier to use for some purposes. It also fixes a number of bugs. WHERE IS IT? Find documentation and downloads at http://nucular.sourceforge.net/ WHAT IS IT? Nucular is a syst

Converting numbers to words

2009-02-05 Thread todp...@hotmail.com
I've been trying to figure this out for over 2 hours and I'm really frustrated right now.I first made Python to ask user to input height in meters. If user puts certain value in meter, then it converts it to feet and inches as follows: Enter the height (in metres): 1.6It is 5 feet, 3 inches hig

MacPython 3.0 dmg installer?

2009-02-05 Thread Con
Hi, I was wondering, what's the status of the MacPython 3.0 installer (.i.e. dmg file) ? I have been using the previous MacPython dmg installers with great success without conflicting with other installations on the system. Thanks in advance, -Conrad -- http://mail.python.org/mailman/listinfo

Re: Use list name as string

2009-02-05 Thread Rhodri James
On Thu, 05 Feb 2009 03:32:59 -, Vincent Davis wrote: "The problem is you seem to be thinking in terms of objects having names. They don't. Names have objects."I agree this is my problem. This is not correct terminology then? The name of the object is anobject No. The name of the objec

Re: global name 'sqrt' is not defined

2009-02-05 Thread Robert Kern
On 2009-02-05 18:55, James Mills wrote: On Fri, Feb 6, 2009 at 10:48 AM, Nick Matzke wrote: (PS: Is there a way to force a complete reload of a module, without exiting ipython? Just doing the import command again doesn't seem to do it.) m = __import__("mymobile") reload(m) Or more straight

Re: Where to host a (Python) project?

2009-02-05 Thread Ben Finney
a...@pythoncraft.com (Aahz) writes: > In article > <6dcb8ce5-c93e-458c-9047-e5db60f27...@v18g2000pro.googlegroups.com>, > andrew cooke wrote: > >hi, just fyi, i investigated this and you can join any publicly > >readable group by sending an email to the "-subscribe" address. you > >do not need

Re: where clause

2009-02-05 Thread Rhodri James
On Thu, 05 Feb 2009 18:04:35 -, wrote: p = a / b where a = 20 / len(c) b = foo(d) You'd want to do it with paired keywords, in the manner of try/except, to avoid utterly breaking Python's syntax conventions. Perhaps something like this: do: p = a / b where: a = 20 / len(c)

Re: global name 'sqrt' is not defined

2009-02-05 Thread James Mills
On Fri, Feb 6, 2009 at 10:48 AM, Nick Matzke wrote: > (PS: Is there a way to force a complete reload of a module, without exiting > ipython? Just doing the import command again doesn't seem to do it.) m = __import__("mymobile") reload(m) cheers James -- http://mail.python.org/mailman/listinfo/p

Re: subprocess returncode windows

2009-02-05 Thread Mark Hammond
On 6/02/2009 6:34 AM, Andrew wrote: Notice how python never gets the correct returncode from asadmin.bat but I can get the correct returncode from the shell every time. Can anyone tell me why Python wouldn't be able to get the correct returncode for asadmin? I think the problem will be that cmd

Re: global name 'sqrt' is not defined

2009-02-05 Thread Nick Matzke
OK, so the problem was that I had to exit ipython, re-enter it, and then import my module to get the errors to disappear. Thanks for the help! (PS: Is there a way to force a complete reload of a module, without exiting ipython? Just doing the import command again doesn't seem to do it.) Th

Using multiprocessing from a Windows service

2009-02-05 Thread Volodya
Hi all, I think I've found a small bug with multiprocessing package on Windows. If you try to start a multiprocessing.Process from a Python- based Windows service, the child process will fail to run. When running the parent process as a regular Python program, everything works as expected. I've t

Re: Is c.l.py becoming less friendly?

2009-02-05 Thread Terry Reedy
Mensanator wrote: On Feb 5, 4:20 pm, Terry Reedy wrote: mk wrote: (duck) 542 comp.lang.python rtfm What is so unfriendly about 'read the fine manual'? You've seen a fine manual? Yes, and I and others have spent hours and hours making the Python manuals finer. -- http://mail.python.org

Re: Skipping bytes while reading a binary file?

2009-02-05 Thread Lionel
On Feb 5, 3:35 pm, Lionel wrote: > On Feb 5, 2:56 pm, Lionel wrote: > > > > > > > On Feb 5, 2:48 pm, MRAB wrote: > > > > Lionel wrote: > > > >  > Hello, > > >  > I have data stored in binary files. Some of these files are > > >  > huge...upwards of 2 gigs or more. They consist of 32-bit float co

Re: Skipping bytes while reading a binary file?

2009-02-05 Thread Lionel
On Feb 5, 2:56 pm, Lionel wrote: > On Feb 5, 2:48 pm, MRAB wrote: > > > > > > > Lionel wrote: > > >  > Hello, > >  > I have data stored in binary files. Some of these files are > >  > huge...upwards of 2 gigs or more. They consist of 32-bit float complex > >  > numbers where the first 32 bits of

Re: updating nntplib

2009-02-05 Thread Travis
On Thu, Feb 05, 2009 at 04:40:36PM -0600, Travis wrote: > 2) In some cases, it will bomb out upon receiving certain greetings > that it doesn't expect. As I understand it, it actually terminates > the connection, not allowing for catching an exception or anything. > I have not verified this myself

Re: Is the subprocess module robust enough in 2.4?

2009-02-05 Thread James Mills
On Fri, Feb 6, 2009 at 2:20 AM, wrote: > The subprocess module was added in Python 2.4. I'm running 2.4.5 at work. > I know it's seen many bugfixes since first released. Is the version in 2.4 > robust enough to use in preference to os.popen and friends? "Is xxx rubust enough" is an untangible

Re: Skipping bytes while reading a binary file?

2009-02-05 Thread Lionel
On Feb 5, 2:48 pm, MRAB wrote: > Lionel wrote: > >  > Hello, >  > I have data stored in binary files. Some of these files are >  > huge...upwards of 2 gigs or more. They consist of 32-bit float complex >  > numbers where the first 32 bits of the file is the real component, the >  > second 32bits i

updating nntplib

2009-02-05 Thread Travis
Hello all, There are some notable deficiencies in nntlib. Here are two: 1) It says it implements NNTP as defined in RFC 977, but NNTP has a newer RFC, RFC 3977, which clarifies some vagueness and has more commands defined. However, as it currently stands you cannot issue these commands, since t

Re: HOWTO for setting up a PyQt project in Eclipse ?

2009-02-05 Thread David Boddie
On Thursday 05 February 2009 18:13, Linuxguy123 wrote: > Does anyone know of a HOWTO for setting up a PyQt project in Eclipse ? > > I know about setting up a PyDev project, just wondering how to integrate > the QtDesigner parts. > > For example, should I save the QtDesigner project in the root P

Re: Skipping bytes while reading a binary file?

2009-02-05 Thread MRAB
Lionel wrote: > Hello, > I have data stored in binary files. Some of these files are > huge...upwards of 2 gigs or more. They consist of 32-bit float complex > numbers where the first 32 bits of the file is the real component, the > second 32bits is the imaginary, the 3rd 32-bits is the real compo

Re: Is c.l.py becoming less friendly?

2009-02-05 Thread Steve Holden
Mensanator wrote: > On Feb 5, 4:20 pm, Terry Reedy wrote: >> mk wrote: >> >>> (duck) >>> 542 comp.lang.python rtfm >> What is so unfriendly about 'read the fine manual'? > > You've seen a fine manual? Yes, and I'm fine well sure this is somewhere between a silly thread and a troll. regards Ste

Re: Skipping bytes while reading a binary file?

2009-02-05 Thread Lionel
On Feb 5, 2:22 pm, Lionel wrote: > Hello, > I have data stored in binary files. Some of these files are > huge...upwards of 2 gigs or more. They consist of 32-bit float complex > numbers where the first 32 bits of the file is the real component, the > second 32bits is the imaginary, the 3rd 32-bit

Re: kinterbasdb + firebird 1.5 with python 2.6 ?

2009-02-05 Thread Benjamin Kaplan
On Thu, Feb 5, 2009 at 4:42 PM, Laszlo Nagy wrote: > Uwe Grauer írta: > >> Laszlo Nagy wrote: >> >> >>> Does anyone know how to get firebird 1.5 driver (kinterbasdb) for >>> FireBird 1.5? >>> >>> My problem: >>> >>> * python 2.6 already installed on a server >>> * there is a firebird 1.5 data

Re: Is c.l.py becoming less friendly?

2009-02-05 Thread Mensanator
On Feb 5, 4:20 pm, Terry Reedy wrote: > mk wrote: > > > (duck) > > > 542 comp.lang.python rtfm > > What is so unfriendly about 'read the fine manual'? You've seen a fine manual? -- http://mail.python.org/mailman/listinfo/python-list

Skipping bytes while reading a binary file?

2009-02-05 Thread Lionel
Hello, I have data stored in binary files. Some of these files are huge...upwards of 2 gigs or more. They consist of 32-bit float complex numbers where the first 32 bits of the file is the real component, the second 32bits is the imaginary, the 3rd 32-bits is the real component of the second number

Re: Is c.l.py becoming less friendly?

2009-02-05 Thread Terry Reedy
mk wrote: (duck) 542 comp.lang.python rtfm What is so unfriendly about 'read the fine manual'? -- http://mail.python.org/mailman/listinfo/python-list

Re: Ordered dict by default

2009-02-05 Thread Terry Reedy
andrew cooke wrote: so what is happening with pep 372? http://www.python.org/dev/peps/pep-0372/ There seems to be a number of unanswered questions as to the exact behavior (see Q and A section). The author needs to promote more discussion by those interested, including here, and make a deci

Re: Ordered dict by default

2009-02-05 Thread Terry Reedy
Paul Rubin wrote: bearophileh...@lycos.com writes: Now Ruby dicts are ordered by default: http://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/ Maybe I didn't read that carefully enough, but it looks like "ordered" means the dict records come out in the same order you inserted them

Re: Extracting file from zip archive in Python 2.6.1

2009-02-05 Thread Brandon Taylor
On Feb 4, 12:16 am, "Gabriel Genellina" wrote: > En Wed, 04 Feb 2009 00:36:40 -0200, Brandon Taylor   > escribió: > > > > > On Feb 3, 1:16 pm, Brandon Taylor wrote: > >> On Feb 3, 9:45 am, "Gabriel Genellina" wrote: > >> > En Tue, 03 Feb 2009 05:31:24 -0200, Brandon Taylor   > >> > escribió: >

Re: kinterbasdb + firebird 1.5 with python 2.6 ?

2009-02-05 Thread Laszlo Nagy
Uwe Grauer írta: Laszlo Nagy wrote: Does anyone know how to get firebird 1.5 driver (kinterbasdb) for FireBird 1.5? My problem: * python 2.6 already installed on a server * there is a firebird 1.5 database on the same server * I need to access it from python 2.6 Any thoughts?

Re: database wrapper ?

2009-02-05 Thread Mike Orr
On Feb 1, 3:47 pm, Stephen Hansen wrote: > Googling, I found SQLalchemy, > which looks quit good. > SQLAlchemy is very good. I'm very slowly migrating our entire codebase to it. >   > > > But as I only want to choose once, > I googled for  "SQLalchemy alternatives", > but it didn't find many answe

Re: where clause

2009-02-05 Thread Paul Rubin
bearophileh...@lycos.com writes: > Note that where may also be designed to create a new scope (as in > Haskell, I think), that's why I have inlined the bar and p/b. In Haskell, "where" is only allowed at the outermost level of a function definition (including a nested one), not in an arbitrary exp

Python-URL! - weekly Python news and links (Feb 5)

2009-02-05 Thread Gabriel Genellina
QOTW: "Findability trumps usability. If you can't find it, you can't use it." - information architect Robert Morville Boolean expressions don't necesarily yield a boolean type - and that's very useful: http://groups.google.com/group/comp.lang.python/t/e834202d1a6a919/

Re: global name 'sqrt' is not defined

2009-02-05 Thread Diez B. Roggisch
Nick Matzke schrieb: Scott David Daniels wrote: M.-A. Lemburg wrote: On 2009-02-05 10:08, Nick Matzke wrote: ..., I can run this in the ipython shell just fine: a = ["12", "15", "16", "38.2"] dim = int(sqrt(size(a))) ...But if I move these commands to a function in another file, it freaks o

Re: tkSimpleDialog window focus problem

2009-02-05 Thread inkhorn
After much tinkering, I figured out the problem. Before the call to the ftp.login function, I had another simpledialog asking for a userid. The focus was leaving the parent Tk window altogether right after userid entry. So, right after the call to obtain the userid from the user, i called the Fr

Re: Python Integrated Parallel Pipeline EnviRonment: PIPPER

2009-02-05 Thread Kyle
PIPPER doesn't yet have a very large user base, and is still in Alpha. So if there is enough demand, syntax changes would still be possible at this stage. Kyle > I'm not a big fan of comments that change semantics. Wouldn't a modified > 'with' statement look better? > > We have a couple of other

Re: global name 'sqrt' is not defined

2009-02-05 Thread Nick Matzke
Scott David Daniels wrote: M.-A. Lemburg wrote: On 2009-02-05 10:08, Nick Matzke wrote: ..., I can run this in the ipython shell just fine: a = ["12", "15", "16", "38.2"] dim = int(sqrt(size(a))) ...But if I move these commands to a function in another file, it freaks out: You need to add:

Re: Flattening lists

2009-02-05 Thread Michele Simionato
On Feb 5, 7:24 pm, a...@pythoncraft.com (Aahz) wrote: > In article > , > Michele Simionato   wrote: > > > > >Looks fine to me. In some situations you may also use hasattr(el, > >'__iter__') instead of isinstance(el, list) (it depends if you want to > >flatten generic iterables or only lists). > >

Re: Python Installation Error

2009-02-05 Thread Benjamin Kaplan
On Thu, Feb 5, 2009 at 12:46 PM, Ahmed Majeed wrote: > Hi, > I am working over a research project and need Python 2.3 or later to > be installed on my Intel Centrino machine, running Fedora 9 as OS. I > have downloaded latest stable release Python 2.6.1 from Python.org, > but when I tried install

Re: Python Integrated Parallel Pipeline EnviRonment: PIPPER

2009-02-05 Thread Stefan Behnel
Kyle wrote: > def do_call(x,y): > print "Hello World", x, y, os.getpid() > > if __name__ == '__pipper_main__': > a_range = range( int(sys.argv[1]) ) > #pragma pipper_start > for a in a_range : > for b in a_range : > do_call(a,b) >

Re: os.system issues

2009-02-05 Thread Chris Rebert
On Thu, Feb 5, 2009 at 6:00 AM, Youri Lammers wrote: > Ok, > > I want to run a program called 'muscle' with my python script, > muscle uses the following command: > 'muscle.exe -in filename -out filename' > so far I got: > > import os > args = ['-in filename', '-out filename'] As Christian indire

Re: where clause

2009-02-05 Thread bearophileHUGS
Albert Hopkins: > One could imagine this getting "out of hand" e.g. Yes, any syntax can be abused (your example isn't abusive enough). > a = 20 / len(c) > where > c = p / b > try: > b = foo(d) > where > d = bar() >

Re: subprocess returncode windows

2009-02-05 Thread Andrew
On Dec 16 2008, 5:11 pm, "Gabriel Genellina" wrote: > En Tue, 16 Dec 2008 17:21:35 -0200, Andrew   > escribió: > > > > > On Dec 16, 12:50 pm, Christian Heimes wrote: > >> Andrew schrieb: > > >> > I'm running into a strange situation with getting incorrect > >> > returncodes / exit status from py

Re: where clause

2009-02-05 Thread Albert Hopkins
On Thu, 2009-02-05 at 10:04 -0800, bearophileh...@lycos.com wrote: > This comes after a small discussion in another Python newsgroup. > Haskell supports a where clause, that's syntactic sugar that allows > you to define things like this: > > p = a / b > where > a = 20 / len(c) > b = foo(

Re: Flattening lists

2009-02-05 Thread Tobiah
On Thu, 05 Feb 2009 11:06:39 -0800, Tobiah wrote: > >> Hello everybody, >> >> Any better solution than this? > > a = [1, 2, 3, [4, 5, 6], [[7, 8], [9, 10]]] print str(a).replace('[', > '').replace(']', '').split(', ') > > ;) Or: a = ['text', 'string', 3, [4, 5, 6], [[7, 8], [9, 10]]] print e

Re: Flattening lists

2009-02-05 Thread Tobiah
> Hello everybody, > > Any better solution than this? a = [1, 2, 3, [4, 5, 6], [[7, 8], [9, 10]]] print str(a).replace('[', '').replace(']', '').split(', ') ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: Flattening lists

2009-02-05 Thread rdmurray
Quoth J Kenneth King : > mk writes: > > > Hello everybody, > > > > Any better solution than this? > > > > def flatten(x): > > res = [] > > for el in x: > > if isinstance(el,list): > > res.extend(flatten(el)) > > else: > > res.append(el) > > retu

Re: Python Installation Error

2009-02-05 Thread Diez B. Roggisch
Ahmed Majeed schrieb: Hi, I am working over a research project and need Python 2.3 or later to be installed on my Intel Centrino machine, running Fedora 9 as OS. I have downloaded latest stable release Python 2.6.1 from Python.org, but when I tried installing it, terminal returned an error on 'ma

Re: Ordered dict by default

2009-02-05 Thread Steve Holden
bearophileh...@lycos.com wrote: > Bryan Olson: >> A few bits fuzzy. Is the following True or False if dict is insert-ordered? >> dict(a=6, b=7) == dict(b=7, a=6) > > In my odict implementation I have disallowed that syntax because if > you want to define a mydict(**kwds) function that allows a

Python Integrated Parallel Pipeline EnviRonment: PIPPER

2009-02-05 Thread Kyle
I wanted to share a Python based project which I've been working on. Python Integrated Parallel Pipeline EnviRonment (PIPPER) is an MPI based programming environment that works much like an OpenMP on Python code. It is designed to create a python programming environment where parallel computations

Re: Flattening lists

2009-02-05 Thread Aahz
In article , Michele Simionato wrote: > >Looks fine to me. In some situations you may also use hasattr(el, >'__iter__') instead of isinstance(el, list) (it depends if you want to >flatten generic iterables or only lists). Of course, once you do that, you need to special-case strings... -- Aahz

Re: Ordered dict by default

2009-02-05 Thread bearophileHUGS
Bryan Olson: > A few bits fuzzy. Is the following True or False if dict is insert-ordered? >     dict(a=6, b=7) == dict(b=7, a=6) In my odict implementation I have disallowed that syntax because if you want to define a mydict(**kwds) function that allows a syntax like: mydict(a=6, b=7) it takes

Re: How to call python from a foreign language thread (C++)

2009-02-05 Thread Philip Semanchuk
On Feb 3, 2009, at 11:37 PM, Victor Lin wrote: It does not work. But however, thanks your help. I have tired so many methods to do. But it crash...crash..deadlock...deadlock..crash...crash... I have no any tried success. I am going crazy. Could someone help me, thanks. Hi Victor, I have some

where clause

2009-02-05 Thread bearophileHUGS
This comes after a small discussion in another Python newsgroup. Haskell supports a where clause, that's syntactic sugar that allows you to define things like this: p = a / b where a = 20 / len(c) b = foo(d) That means: a = 20 / len(c) b = foo(d) p = a / b I don't know how much good t

Re: Is c.l.py becoming less friendly?

2009-02-05 Thread Bruno Desthuilliers
Tim Rowe a écrit : 2009/2/5 Tim Chase : Is this where we tell you to shut up? ;-) [snip] It would also be interesting to see how many of those posts are concentrated in certain threads And, as you have clearly demonstrated, how many of those posts also contain a smiley or some other form

Python Installation Error

2009-02-05 Thread Ahmed Majeed
Hi, I am working over a research project and need Python 2.3 or later to be installed on my Intel Centrino machine, running Fedora 9 as OS. I have downloaded latest stable release Python 2.6.1 from Python.org, but when I tried installing it, terminal returned an error on 'make', saying: "Failed to

Re: Couple of noobish question

2009-02-05 Thread Tim Rowe
2009/2/5 Bruno Desthuilliers : > Thanks for the correction - as you may have guessed, I have not used windows > for years !-) And I can't get Linux running (more precisely, I can't /keep/ X-Windows running). Isn't it a good job that Python is cross-platform -- as long as we stay clear of the os m

Re: Is c.l.py becoming less friendly?

2009-02-05 Thread Dan Upton
On Thu, Feb 5, 2009 at 12:37 PM, Tim Rowe wrote: > 2009/2/5 Tim Chase : > >> Is this where we tell you to shut up? ;-) > > [snip] > >> It would also be interesting to see how many of those posts are concentrated >> in certain threads > > And, as you have clearly demonstrated, how many of those po

Re: Ordered dict by default

2009-02-05 Thread Bryan Olson
Stephen Hansen wrote: Ooh, as an addendum... I found one case where I want insertion-and-update order: meaning that its an ordered dictionary that maintains insertion order, but an update to a particular item moves that item to the back so an update behaves like del d[key]; d[key] = value in term

Re: Is c.l.py becoming less friendly?

2009-02-05 Thread Tim Rowe
2009/2/5 Tim Chase : > Is this where we tell you to shut up? ;-) [snip] > It would also be interesting to see how many of those posts are concentrated > in certain threads And, as you have clearly demonstrated, how many of those posts also contain a smiley or some other form of hedging in a po

Re: Ordered dict by default

2009-02-05 Thread Bryan Olson
MRAB wrote: Paul Rubin wrote: bearophileh...@lycos.com writes: Now Ruby dicts are ordered by default: http://www.igvita.com/2009/02/04/ruby-19-internals-ordered-hash/ Maybe I didn't read that carefully enough, but it looks like "ordered" means the dict records come out in the same order you i

Re: sorting mesh data an from abaqus simulation

2009-02-05 Thread Gabriel Genellina
En Mon, 02 Feb 2009 10:10:15 -0200, Alessandro Zivelonghi escribió: *Ntop = odb.rootAssembly.instances['PART-1-1'].nodeSets['TOP'].nodes * Problem: 1) the list of nodes Ntop contains all the node labels [2673, 2675, 2676, 2677, 2678, 3655, 3656, 119939, 124154, 127919] already ordered

Re: Flattening lists

2009-02-05 Thread rdmurray
Quoth rdmur...@bitdance.com: > This is all premature optimization, except for the goopy code, which is > presumably used enough to make it worth optimizing. And guess what? > The goopy code wins. What the people theorizing about the speed of > extend vs list creation miss is that the things with

Re: Is c.l.py becoming less friendly?

2009-02-05 Thread Tim Chase
(duck) 542 comp.lang.python rtfm 467 comp.lang.python shut+up 263 comp.lang.perl rtfm 45 comp.lang.perl shut+up Is this where we tell you to shut up? ;-) As others mentioned, the raw numbers don't mean much without a total-volume-of-posts to demonstrate the percentage. It would also be int

Re: subprocess.Popen not creating a pipe

2009-02-05 Thread Gabriel Genellina
En Sun, 01 Feb 2009 18:00:36 -0200, Andrew Parker escribió: On Sun, Feb 1, 2009 at 1:46 PM, Andrew Parker wrote: I'm having some fun with Popen. I have the following line: process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) print process.stdout Under

HOWTO for setting up a PyQt project in Eclipse ?

2009-02-05 Thread Linuxguy123
Does anyone know of a HOWTO for setting up a PyQt project in Eclipse ? I know about setting up a PyDev project, just wondering how to integrate the QtDesigner parts. For example, should I save the QtDesigner project in the root PyDev directory ? Thanks -- http://mail.python.org/mailman/listin

Re: Structuring Modules with a Ubiquitous Base Class (Circular Dependencies)

2009-02-05 Thread Gabriel Genellina
En Wed, 04 Feb 2009 21:12:58 -0200, andrew cooke escribió: On Feb 4, 7:49 pm, andrew cooke wrote: This leads to a circular dependency - the base class wants to import the components, which in turn want to import the base class. well, to partially answer my own question, this is certainly po

Re: Scanning a file character by character

2009-02-05 Thread Gabriel Genellina
En Thu, 05 Feb 2009 04:48:13 -0200, Spacebar265 escribió: Hi. Does anyone know how to scan a file character by character and have each character so I can put it into a variable. I am attempting to make a chatbot and need this to read the saved input to look for spelling mistakes and further ana

Re: Flattening lists

2009-02-05 Thread Sion Arrowsmith
mk wrote: >Brian Allen Vanderburg II wrote: >> I think it may be just a 'little' more efficient to do this: >> >> def flatten(x, res=None): >>if res is None: >> res = [] >>for el in x: >> if isinstance(el, (tuple, list)): >> flatten(el, res) >> else: >>

Re: Flattening lists

2009-02-05 Thread J Kenneth King
mk writes: > Hello everybody, > > Any better solution than this? > > def flatten(x): > res = [] > for el in x: > if isinstance(el,list): > res.extend(flatten(el)) > else: > res.append(el) > return res > > a = [1, 2, 3, [4, 5, 6], [[7, 8], [9, 10

Re: Flattening lists

2009-02-05 Thread rdmurray
Baolong zhen wrote: > On Thu, Feb 5, 2009 at 10:17 PM, mk wrote: > > > Brian Allen Vanderburg II wrote: > > >> def flatten(x): > > >> res = [] > > >> for el in x: > > >> if isinstance(el,list): > > >> res.extend(flatten(el)) > > >> else: > > >> res.

Re: Flattening lists

2009-02-05 Thread Stephen Hansen
> Either list creation is somewhat > costly, or "if var is None" is really cheap. "if x is y" is extremely cheap, I believe. Unlike most comparisons which are (relatively) expensive, that one is just comparing simple object address. You can't override "is" so there's a whole series of checks that

Re: Flattening lists

2009-02-05 Thread mk
Brian Allen Vanderburg II wrote: Is list creation really more costly than above? Probably not. I wrote a small test program using a list several levels deep, each list containing 5 sublists at each level and finally just a list of numbers. Flattening 1000 times took about 3.9 seconds for th

Re: Is c.l.py becoming less friendly?

2009-02-05 Thread Diez B. Roggisch
mk schrieb: (duck) 542 comp.lang.python rtfm 467 comp.lang.python shut+up 263 comp.lang.perl rtfm 45 comp.lang.perl shut+up It appears to me that comp.lang.perl isn't even active anymore. Or googles interface is just crappy. c.l.perl.misc seems to be the place to search. And raw number

  1   2   >