Re: what does 64-bit python mean?

2009-03-19 Thread Christian Heimes
Chris Rebert wrote: > It's been compiled for 64-bit processors, so it uses 64-bit pointers > and 64-bit small integers. And I would think it would only work w/ C > extension libraries also compiled for 64-bit CPUs. So, the same > meaning 64-bit has for anything else really. A 64bit build of Python

Re: what does 64-bit python mean?

2009-03-19 Thread Martin v. Löwis
> Could someone help me in understanding what 64-bit python means? While Chris' answer is correct, it doesn't show the consequences of using a 64-bit Python. Primarily, these are: - strings, Unicode objects, lists, dicts, and tuples can have more than 2**31 elements. - you can load 64-bit DLLs i

Re: REDIRECT

2009-03-19 Thread Jeremiah Dodds
On Thu, Mar 19, 2009 at 4:30 AM, wrote: > On Mar 18, 5:21 am, Tino Wildenhain wrote: > > gaeasian...@gmail.com wrote: > > > > 3. GoogleAppEngine, Version 1.1.9 > (webapp - framework) > > What actually I'm try to do is : > > I'm having a Login page which developed in HTML. When I click on the >

Re: Do deep inheritance trees degrade efficiency?

2009-03-19 Thread Peter Otten
Anthra Norell wrote: > Would anyone who knows the inner workings volunteer to clarify whether > or not every additional derivation of a class hierarchy adds an > indirection to the base class's method calls and attribute read-writes. > In C++, I suppose, a three-level inheritance would resolve int

Re: Do deep inheritance trees degrade efficiency?

2009-03-19 Thread Chris Rebert
On Wed, Mar 18, 2009 at 6:09 AM, Anthra Norell wrote: > Would anyone who knows the inner workings volunteer to clarify whether or > not every additional derivation of a class hierarchy adds an indirection to > the base class's method calls and attribute read-writes. In C++, I suppose, > a three-le

Re: How complex is complex?

2009-03-19 Thread Kottiyath
On Mar 19, 11:29 am, Daniel Fetchinson wrote: > > When we say readability counts over complexity, how do we define what > > level of complexity is ok? > > For example: > > Say I have dict a = {'a': 2, 'c': 4, 'b': 3} > > I want to increment the values by 1 for all keys in the dictionary. > > So, s

Re: Do deep inheritance trees degrade efficiency?

2009-03-19 Thread Christian Heimes
Chris Rebert wrote: > There's no effect on attribute read-writes as they all take place > within the single __dict__ of the instance. As for method lookup, it > doesn't add an indirection per se, but rather the list of classes to > look thru to find a method gets longer, making base-class method >

Re: Roulette wheel

2009-03-19 Thread mattia
Il Wed, 18 Mar 2009 23:31:09 -0200, Gabriel Genellina ha scritto: > En Wed, 18 Mar 2009 18:49:19 -0200, mattia escribió: >> Il Wed, 18 Mar 2009 13:20:14 -0700, Aahz ha scritto: >>> In article <49c1562a$0$1115$4fafb...@reader1.news.tin.it>, mattia >>> wrote: Yeah, and I believe that we

Re: Do deep inheritance trees degrade efficiency?

2009-03-19 Thread Peter Otten
Peter Otten wrote: > Anthra Norell wrote: > >> Would anyone who knows the inner workings volunteer to clarify whether >> or not every additional derivation of a class hierarchy adds an >> indirection to the base class's method calls and attribute read-writes. >> In C++, I suppose, a three-level i

Re: How complex is complex?

2009-03-19 Thread Jeremiah Dodds
On Thu, Mar 19, 2009 at 9:39 AM, Kottiyath wrote: > I understand that my question was foolish, even for a newbie. > I will not ask any more such questions in the future. > -- > http://mail.python.org/mailman/listinfo/python-list > I didn't think it was a foolish question, just one with a very su

Re: read web page that requires javascript on client

2009-03-19 Thread Jeremiah Dodds
On Thu, Mar 19, 2009 at 1:25 AM, Carl wrote: > Probably the easiest thing is to actually use a browser. There are > many examples of automating a browser via Python. So, you can > programmatically launch the browser, point it to the JavaScript > afflicted page, let the JS run and grab the page so

Re: read web page that requires javascript on client

2009-03-19 Thread James Matthews
You can try and use wxpythons broswer to execute the javascript On Wed, Mar 18, 2009 at 10:01 PM, Greg wrote: > Hello all, I've been trying to find a way to fetch and read a web page > that requires javascript on the client side and it seems impossible. > I've read several threads in this group

Re: python equivalent of java technologies

2009-03-19 Thread Jeremiah Dodds
On Tue, Mar 17, 2009 at 8:32 PM, Armin wrote: > You could tell her to try Jython. In that, you can just use the Java > implementations. :) Plus, you have things in Jython that Java doesn't :D > > -- > Armin Moradi > -- > http://mail.python.org/mailman/listinfo/python-list > Exactly. Her challe

Unicode problem in ucs4

2009-03-19 Thread abhi
Hi, I have a C extension, which takes a unicode or string value from python and convert it to unicode before doing more operations on it. The skeleton looks like: static PyObject *unicode_helper( PyObject *self, PyObject *args){ PyObject *sampleObj = NULL; Py_UNICODE *sample = NULL

Re: Style formating of multiline query, advise

2009-03-19 Thread someone
On Mar 19, 10:26 am, Marco Mariani wrote: > someone wrote: > >> Also, for SQL, (A) why are you using nested joins?, and > > > inner select produce smaller set which is then joined with other > > table, kind a optimization > > Did you time it? > I've done some "kind of a optimization" that slowed q

Style formating of multiline query, advise

2009-03-19 Thread someone
Hi, what is good :) style for multiline queries to database? Is that one ok? query = """ SELECT * FROM ( SELECT a.columna, a.columnb, a.iso FROM all a WHERE (a.name = LOWER(%s)) ) AS c JOIN other as b on c.gid = b.id

Re: python equivalent of java technologies

2009-03-19 Thread Tim Hoffman
Oops , for RIA there is always pyjamas (gwt for python ;-) T On Mar 19, 7:52 pm, Tim Hoffman wrote: > Hi > > Well zope has quite a few of these out of the box and have been around > for a bit longer than some of the java options. > > Specifically persistence (ZODB persistence in zope is pretty

Re: split problem if the delimiter is inside the text limiter

2009-03-19 Thread M.-A. Lemburg
On 2009-03-19 00:30, Tim Chase wrote: > Bruno Desthuilliers wrote: >> Tim Chase a écrit : >>> (if your columns in your CSV happen to match the order of your INSERT >>> statement, you can just use >>> >>> execute(sql, tuple(row)) >> >> Or more simply: >> >> cursor.execute(sql, row) > > that'

problem with Pamie (textbox editing)

2009-03-19 Thread stanislav_ziak
Hi, I try to test web aplication with using of modul Pamie and I have next problem, when I edit any textbox or textarea and consequently press the button which works the data in this textbox, so this textbox returns into the state before editing, fof example: Let I have 3 textboxes: box1, box2

lipo: can't figure out the architecture type of

2009-03-19 Thread Vijayendra Bapte
Hi, I am getting an gcc compilation error while installing FSEvents (http://pypi.python.org/packages/source/p/pyobjc-framework-FSEvents/ pyobjc-framework-FSEvents-2.2b1.tar.gz) package on my Mac (OS X 10.4.11, Intel Core Duo 32 bit processor, Python2.6.1, gcc: i686-apple- darwin8-gcc-4.0.1) gcc f

Do deep inheritance trees degrade efficiency?

2009-03-19 Thread Anthra Norell
Would anyone who knows the inner workings volunteer to clarify whether or not every additional derivation of a class hierarchy adds an indirection to the base class's method calls and attribute read-writes. In C++, I suppose, a three-level inheritance would resolve into something like *(*(*(*(b

Re: mxODBC (was "split problem if the delimiter is inside the text limiter")

2009-03-19 Thread Tim Chase
DB-API 2.0 has cursor.executemany() to make this differentiation at the API level. mxODBC will lift this requirement in the next version, promised :-) glad to hear...will executemany() take an arbitrary iterable? My (albeit somewhat-antiquated) version balked at anything that wasn't a list/t

Emulate a printf() C-statement in Python???

2009-03-19 Thread Mr. Z
I'm trying emulate a printf() c statement that does, for example char* name="Chris"; int age=30; printf("My name is %s", name); printf("My name is %s and I am %d years old.", %s, %d); In other words, printf() has a variable arguement list the we all know. I'm trying to do this in Python... clas

Re: Do deep inheritance trees degrade efficiency?

2009-03-19 Thread Chris Rebert
On Thu, Mar 19, 2009 at 2:54 AM, Christian Heimes wrote: > Chris Rebert wrote: >> There's no effect on attribute read-writes as they all take place >> within the single __dict__ of the instance. As for method lookup, it >> doesn't add an indirection per se, but rather the list of classes to >> loo

ANN: eGenix mxODBC Connect 1.0.1 - Python Database Interface

2009-03-19 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mxODBC Connect Python Database Interface Version 1.0.1 Our new client-server product for connecting Python applications

Re: Do deep inheritance trees degrade efficiency?

2009-03-19 Thread Terry Reedy
Anthra Norell wrote: Would anyone who knows the inner workings volunteer to clarify whether or not every additional derivation of a class hierarchy adds an indirection to the base class's method calls and attribute read-writes. More potential search layers rather than pointer indirection. Bu

Re: Emulate a printf() C-statement in Python???

2009-03-19 Thread Chris Rebert
On Thu, Mar 19, 2009 at 5:43 AM, Mr. Z wrote: > I'm trying emulate a printf() c statement that does, for example > > char* name="Chris"; > int age=30; > printf("My name is %s", name); > printf("My name is %s and I am %d years old.", %s, %d); > > In other words, printf() has a variable arguement li

Re: python equivalent of java technologies

2009-03-19 Thread Tim Hoffman
Hi Well zope has quite a few of these out of the box and have been around for a bit longer than some of the java options. Specifically persistence (ZODB persistence in zope is pretty much completely autmomatic) you can inplement web services with it (xmlrpc out of the box, though I assume you me

Python-URL! - weekly Python news and links (Mar 19)

2009-03-19 Thread Gabriel Genellina
QOTW: "In that case I fear Python will be far too simple ... You've been programming for way too long ..." - Steve Holden http://groups.google.com/group/comp.lang.python/msg/b8027713e674ef9d Having a function called after the constructor/__init__ is done: http://groups.

Re: Emulate a printf() C-statement in Python???

2009-03-19 Thread Andrii V. Mishkovskyi
On Thu, Mar 19, 2009 at 2:43 PM, Mr. Z wrote: > I'm trying emulate a printf() c statement that does, for example > > char* name="Chris"; > int age=30; > printf("My name is %s", name); > printf("My name is %s and I am %d years old.", %s, %d); > > In other words, printf() has a variable arguement li

Re: Do deep inheritance trees degrade efficiency?

2009-03-19 Thread Bruno Desthuilliers
Chris Rebert a écrit : On Wed, Mar 18, 2009 at 6:09 AM, Anthra Norell wrote: Would anyone who knows the inner workings volunteer to clarify whether or not every additional derivation of a class hierarchy adds an indirection to the base class's method calls and attribute read-writes. In C++, I s

Re: Roulette wheel

2009-03-19 Thread Gabriel Genellina
En Thu, 19 Mar 2009 08:06:35 -0200, mattia escribió: OK, understood. Now, as a general rule, is it correct to say: - use generator expression when I just need to iterate over the list or call a function that involve an iterator (e.g. sum) and get the result, so the list is not necessary anymore

Re: Style formating of multiline query, advise

2009-03-19 Thread Marco Mariani
someone wrote: Also, for SQL, (A) why are you using nested joins?, and inner select produce smaller set which is then joined with other table, kind a optimization Did you time it? I've done some "kind of a optimization" that slowed queries by tenfold, because postgres didn't need my advice,

Re: Uploading a file using POST

2009-03-19 Thread Vijayendra Bapte
On Mar 19, 7:20 am, Justin Ezequiel wrote: > On Mar 19, 8:50 am, Thomas Robitaille > wrote: > > > I am trying to upload a binary file (a tar.gz file to be exact) to a   > > web server using POST, from within a python script. > > > What I would like is essentially the equivalent of > > > > enctyp

Re: Emulate a printf() C-statement in Python???

2009-03-19 Thread John Machin
On Mar 19, 11:43 pm, "Mr. Z" wrote: > I'm trying emulate a printf() c statement that does, for example > > char* name="Chris"; > int age=30; > printf("My name is %s", name); > printf("My name is %s and I am %d years old.", %s, %d); > > In other words, printf() has a variable arguement list the we

Re: Emulate a printf() C-statement in Python???

2009-03-19 Thread Eric Brunel
Mr. Z wrote: > I'm trying emulate a printf() c statement that does, for example > > char* name="Chris"; > int age=30; > printf("My name is %s", name); > printf("My name is %s and I am %d years old.", %s, %d); > > In other words, printf() has a variable arguement list the we > all know. > > I'm tryi

Re: Emulate a printf() C-statement in Python???

2009-03-19 Thread John Machin
On Mar 19, 11:52 pm, Chris Rebert wrote: > On Thu, Mar 19, 2009 at 5:43 AM, Mr. Z wrote: > > I'm trying emulate a printf() c statement that does, for example > > > char* name="Chris"; > > int age=30; > > printf("My name is %s", name); > > printf("My name is %s and I am %d years old.", %s, %d); >

Python benchmarks comparing 32-bit to 64-bit performance

2009-03-19 Thread python
Are there any benchmarks (pystones or other) that compare a 32-bit and 64-bit versions of Python? Ideally I'm looking for a benchmark comparing recent Python releases (2.6.x, 3.x) on an Intel platform. I'm specifically interested in areas of the Python language where a 64-bit implementation is surp

Preferred syntax for the docstrings

2009-03-19 Thread Luis Zarrabeitia
What's the preferred style to document code in python? I usually do something like this: === def somefunction(arg1, arg2, out = sys.stdout): """ This function does blahblablha with the string arg1, using the tuple of ints arg2 as the control sequence, and prints the result to out (d

Re: Emulate a printf() C-statement in Python???

2009-03-19 Thread Chris Rebert
On Thu, Mar 19, 2009 at 6:13 AM, John Machin wrote: > On Mar 19, 11:52 pm, Chris Rebert wrote: >> On Thu, Mar 19, 2009 at 5:43 AM, Mr. Z wrote: >> > I'm trying emulate a printf() c statement that does, for example >> >> > char* name="Chris"; >> > int age=30; >> > printf("My name is %s", name); >

Re: Preferred syntax for the docstrings

2009-03-19 Thread Chris Rebert
On Thu, Mar 19, 2009 at 6:26 AM, Luis Zarrabeitia wrote: > > What's the preferred style to document code in python? I usually do something > like this: > > === > def somefunction(arg1, arg2, out = sys.stdout): >    """ This function does blahblablha with the string arg1, using >    the tuple of in

Re: How complex is complex?

2009-03-19 Thread Aahz
[posted and e-mailed] In article <033514d1-e0e9-4a1c-bca0-846781f0d...@w35g2000prg.googlegroups.com>, Kottiyath wrote: >On Mar 19, 11:29=A0am, Daniel Fetchinson >wrote: >> >> Once every nuanced detail has been carefully weighed in and a >> consensus has been reached among the Supreme Python La

Re: Preferred syntax for the docstrings

2009-03-19 Thread Luis Zarrabeitia
Quoting Chris Rebert : > > It's pretty subjective based on which documentation generator you use > (or if you don't use one at all, just your personal style), but > personally I'd recommend reStructuredText and Sphinx > (http://sphinx.pocoo.org/) since they're used for the std lib's very > spiff

Re: Do deep inheritance trees degrade efficiency?

2009-03-19 Thread Anthra Norell
Bruno Desthuilliers wrote: Chris Rebert a écrit : On Wed, Mar 18, 2009 at 6:09 AM, Anthra Norell wrote: Would anyone who knows the inner workings volunteer to clarify whether or not every additional derivation of a class hierarchy adds an indirection to the base class's method calls and attri

Re: set_process_affinity_mask problem - Python 2.5 gcc 4.3.2 (Ubuntu 4.3.2-1ubuntu12)

2009-03-19 Thread Aahz
In article , Isaac Gouy wrote: > >Now I've upgraded from Ubuntu 8.04 to Ubuntu 8.10 (from gcc 4.2.3 to >gcc 4.3.2) and set_process_affinity_mask seems to fail on the x86 >Ubuntu install. It still works fine, after upgrade, on the x64 Ubuntu >install. > [...] >Please suggest what I can do to deb

Re: Emulate a printf() C-statement in Python???

2009-03-19 Thread Mr. Z
"Andrii V. Mishkovskyi" wrote in message news:mailman.2185.1237467269.11746.python-l...@python.org... On Thu, Mar 19, 2009 at 2:43 PM, Mr. Z wrote: > I'm trying emulate a printf() c statement that does, for example > > char* name="Chris"; > int age=30; > printf("My name is %s", name); > printf("M

Re: How to do this in Python? - A "gotcha"

2009-03-19 Thread bieffe62
On Mar 18, 6:06 pm, Jim Garrison wrote: > S Arrowsmith wrote: > > Jim Garrison   wrote: > >> It's a shame the iter(o,sentinel) builtin does the > >> comparison itself, instead of being defined as iter(callable,callable) > >> where the second argument implements the termination test and returns a >

Re: Is python worth learning as a second language?

2009-03-19 Thread Aahz
In article <49b5196b$0$3514$426a7...@news.free.fr>, Bruno Desthuilliers wrote: >Grant Edwards a écrit : >> >> Knowing C++ does tend to be a bit of a handicap, but I think >> any competent programmer could learn Python. > >+2 QOTW !-) Ditto! Although I suppose you could just go for the jugular a

Re: Is python worth learning as a second language?

2009-03-19 Thread Aahz
In article <49b58b35$0$3548$426a7...@news.free.fr>, Bruno Desthuilliers wrote: >Tomasz Rola a écrit : >> >> I may not be objective (tried Java, hated it after 6 years). > >Arf - only took me 6 months !-) That long? It only took me six minutes. -- Aahz (a...@pythoncraft.com) <*>

Re: supervisor 3.0a6 and Python2.6

2009-03-19 Thread Raymond Cote
George Trojan wrote: 1. Is supervisor still developed? I note that, although the information on the site is pretty old, there have been some respository checkins in Feb and March of this year: -r -- http://mail.python.org/mailman/

can someone help me (again) stuck on ' hands on python'

2009-03-19 Thread Gary Wood
#I adjusted the 2nd main function so i test what im trying to do can someone point me in the right direction please Exercise 2.3.3.1. ** Rename the example file locationsStub.py to be locations.py, and complete the function printLocations, to print the index of each location in the string s

Re: Is python worth learning as a second language?

2009-03-19 Thread grkuntzmd
The other day one of our developers said that he thought learning assembler language in college was a total waste of time. I can't disagree more. Even if assembler language is specific to one architecture, the principles that it teaches are universal and fundamental to all other programming langua

Re: How to do this in Python? - A "gotcha"

2009-03-19 Thread Scott David Daniels
bieff...@gmail.com wrote: On Mar 18, 6:06 pm, Jim Garrison wrote: S Arrowsmith wrote: Jim Garrison wrote: It's a shame the iter(o,sentinel) builtin does the comparison itself, instead of being defined as iter(callable,callable) where the second argument implements the termination test and r

Re: python equivalent of java technologies

2009-03-19 Thread Armin
On Thursday 19 March 2009 07:45:01 Jeremiah Dodds wrote: > On Tue, Mar 17, 2009 at 8:32 PM, Armin wrote: > > You could tell her to try Jython. In that, you can just use the Java > > implementations. :) Plus, you have things in Jython that Java doesn't :D > > > > -- > > Armin Moradi > > -- > > ht

Re: supervisor 3.0a6 and Python2.6

2009-03-19 Thread George Trojan
Raymond Cote wrote: George Trojan wrote: 1. Is supervisor still developed? I note that, although the information on the site is pretty old, there have been some respository checkins in Feb and March of this year: -r I found ans

DictReader and fieldnames

2009-03-19 Thread Ted To
Is it possible to grab the fieldnames that the csv DictReader module automatically reads from the first line of the input file? Thanks, Ted To -- http://mail.python.org/mailman/listinfo/python-list

Re: mxODBC (was "split problem if the delimiter is inside the text limiter")

2009-03-19 Thread M.-A. Lemburg
On 2009-03-19 13:40, Tim Chase wrote: >> DB-API 2.0 has cursor.executemany() to make this differentiation >> at the API level. mxODBC will lift this requirement in the next >> version, promised :-) > > glad to hear...will executemany() take an arbitrary iterable? My > (albeit somewhat-antiquated

Wordpress management from Python: do you know main bindings/modules to automate Wordpress blogging from .py software?

2009-03-19 Thread Aldo Ceccarelli
Hi, Everybody! I'm a Wordpress newbie but will have need to automate posts and would like to use Python for this purpose too: can you lead the way to this target? Many thanks in advance for your kind indications! ps some times ago, I heard about a Wordpress Python Library too but I do not know

Re: Preferred syntax for the docstrings

2009-03-19 Thread Scott David Daniels
Luis Zarrabeitia wrote: What's the preferred style to document code in python? ... def somefunction(arg1, arg2, out = sys.stdout): """ This function does blahblablha with the string arg1, using the tuple of ints arg2 as the control sequence, and prints the result to out (defaults to

Re: How complex is complex?

2009-03-19 Thread Paul McGuire
On Mar 19, 4:39 am, Kottiyath wrote: > > I understand that my question was foolish, even for a newbie. > I will not ask any more such questions in the future. > Gaaah! Your question was just fine, a good question on coding style. I wish more people would ask such questions so that bad habits coul

Can I rely on...

2009-03-19 Thread Emanuele D'Arrigo
Hi everybody, I just had a bit of a shiver for something I'm doing often in my code but that might be based on a wrong assumption on my part. Take the following code: pattern = "aPattern" compiledPatterns = [ ] compiledPatterns.append(re.compile(pattern)) if(re.compile(pattern) in compiledPatte

Can I rely on...

2009-03-19 Thread Emanuele D'Arrigo
Sorry for the double-post, the first one was sent by mistake before completion. Hi everybody, I just had a bit of a shiver for something I'm doing often in my code but that might be based on a wrong assumption on my part. Take the following code: pattern = "aPattern" compiledPatterns = [ ] comp

converting pipe delimited file to fixed width

2009-03-19 Thread digz
Hi, I am trying to convert a | delimited file to fixed width by right padding with spaces, Here is how I have written the program , just get the feeling this can be done in a much better ( python functional ) way rather than the procedural code i have below . Any help appreciated #!/usr/bin/pytho

Re: Can I rely on...

2009-03-19 Thread MRAB
Emanuele D'Arrigo wrote: Hi everybody, I just had a bit of a shiver for something I'm doing often in my code but that might be based on a wrong assumption on my part. Take the following code: pattern = "aPattern" compiledPatterns = [ ] compiledPatterns.append(re.compile(pattern)) if(re.compil

Re: Can I rely on...

2009-03-19 Thread MRAB
Emanuele D'Arrigo wrote: [snip] If the answer is no, am I right to state the in the case portrayed above the only way to be safe is to use the following code instead? for item in compiledPatterns: if(item.pattern == pattern): print("The compiled pattern is stored.") break Co

Re: Can I rely on...

2009-03-19 Thread Albert Hopkins
On Thu, 2009-03-19 at 08:42 -0700, Emanuele D'Arrigo wrote: > Hi everybody, > > I just had a bit of a shiver for something I'm doing often in my code > but that might be based on a wrong assumption on my part. Take the > following code: > > pattern = "aPattern" > > compiledPatterns = [ ] > compi

Re: converting pipe delimited file to fixed width

2009-03-19 Thread MRAB
digz wrote: Hi, I am trying to convert a | delimited file to fixed width by right padding with spaces, Here is how I have written the program , just get the feeling this can be done in a much better ( python functional ) way rather than the procedural code i have below . Any help appreciated #!

Re: Do deep inheritance trees degrade efficiency?

2009-03-19 Thread Terry Reedy
Terry Reedy wrote: Anthra Norell wrote: Would anyone who knows the inner workings volunteer to clarify whether or not every additional derivation of a class hierarchy adds an indirection to the base class's method calls and attribute read-writes. More potential search layers rather than poin

Re: File Compare with difflib.context_diff

2009-03-19 Thread JohnV
Here is the latest version of the code: currentdata_file = r"C:\Users\Owner\Desktop\newdata.txt" # the latest download from the clock lastdata_file = r"C:\Users\Owner\Desktop\mydata.txt" # the prior download from the clock output_file = r"C:\Users\Owner\Desktop\out.txt" # will hold delta clock dat

Simple question about yyyy/mm/dd

2009-03-19 Thread mattia
Hi all, I need to receive in input a date represented by a string in the form "/mm/dd" (or reversed), then I need to assure that the date is >= the current date and then split the dates in variables like year, month, day. Is there some module to do this quickly? -- http://mail.python.org/mail

Re: How complex is complex?

2009-03-19 Thread Kottiyath
On Mar 19, 8:42 pm, Paul McGuire wrote: > On Mar 19, 4:39 am, Kottiyath wrote: > > > > > I understand that my question was foolish, even for a newbie. > > I will not ask any more such questions in the future. > > Gaaah! Your question was just fine, a good question on coding style. > I wish more p

Re: How complex is complex?

2009-03-19 Thread Kottiyath
On Mar 19, 9:33 pm, Kottiyath wrote: > On Mar 19, 8:42 pm, Paul McGuire wrote: > > > > > On Mar 19, 4:39 am, Kottiyath wrote: > > > > I understand that my question was foolish, even for a newbie. > > > I will not ask any more such questions in the future. > > > Gaaah! Your question was just fine

Re: Can I rely on...

2009-03-19 Thread Terry Reedy
Emanuele D'Arrigo wrote: Hi everybody, I just had a bit of a shiver for something I'm doing often in my code but that might be based on a wrong assumption on my part. Take the following code: pattern = "aPattern" compiledPatterns = [ ] compiledPatterns.append(re.compile(pattern)) if(re.compil

Re: DictReader and fieldnames

2009-03-19 Thread skip
Ted> Is it possible to grab the fieldnames that the csv DictReader Ted> module automatically reads from the first line of the input file? Like this, perhaps? >>> rdr = csv.DictReader(open("f.csv", "rb")) >>> rdr.fieldnames ['col1', 'col2', 'color'] >>> rdr.next() {'co

Re: Simple question about yyyy/mm/dd

2009-03-19 Thread skip
>> Hi all, I need to receive in input a date represented by a string in >> the form "/mm/dd" (or reversed), then I need to assure that the >> date is = the current date and then split the dates in variables like >> year, month, day. Is there some module to do this quickly? The

Threads not Improving Performance in Program

2009-03-19 Thread Ryan Rosario
I have a parser that needs to process 7 million files. After running for 2 days, it had only processed 1.5 million. I want this script to parse several files at once by using multiple threads: one for each file currently being analyzed. My code iterates through all of the directories within a dire

Re: converting pipe delimited file to fixed width

2009-03-19 Thread Terry Reedy
digz wrote: Hi, I am trying to convert a | delimited file to fixed width by right padding with spaces, Here is how I have written the program , just get the feeling this can be done in a much better ( python functional ) way rather than the procedural code i have below . Any help appreciated #!

Re: converting pipe delimited file to fixed width

2009-03-19 Thread odeits
On Mar 19, 8:51 am, digz wrote: > Hi, > I am trying to convert a | delimited  file to fixed width by right > padding with spaces, Here is how I have written the program , just get > the feeling this can be done in a much better ( python functional ) > way rather than the procedural code i have bel

cross compile Python to Linux-ARM

2009-03-19 Thread jefm
Hi, We are looking to use Python on an embedded Linux ARM system. What I gather from googling the subject is that it is not that straight forward (a fair amount of patching & hacking). Nobody out there that has done it claims it is easy, which makes me worried. I haven't seen a description on port

Missing values in tuple assignment

2009-03-19 Thread Jim Garrison
Use case: parsing a simple config file line where lines start with a keyword and have optional arguments. I want to extract the keyword and then pass the rest of the line to a function to process it. An obvious use of split(None,1) cmd,args= = line.split(None,1); if cmd in self.switch: s

Re: Threads not Improving Performance in Program

2009-03-19 Thread odeits
On Mar 19, 9:50 am, Ryan Rosario wrote: > I have a parser that needs to process 7 million files. After running > for 2 days, it had only processed 1.5 million. I want this script to > parse several files at once by using multiple threads: one for each > file currently being analyzed. > > My code i

Re: Simple question about yyyy/mm/dd

2009-03-19 Thread Scott David Daniels
mattia wrote: Hi all, I need to receive in input a date represented by a string in the form "/mm/dd" (or reversed), then I need to assure that the date is = the current date and then split the dates in variables like year, month, day. Is there some module to do this quickly? Look into tim

Re: What happened to NASA at Python? :(

2009-03-19 Thread Steve Holden
r wrote: > On Mar 12, 3:31 am, Michele Simionato > wrote: > >> That's pretty much impossible. I am sure NASA uses all programming >> languages in existence, >> plus probably many internal ones we never heard of. > > True but... > all([NASA.does_endorse(lang) for lang in NASA['languages']])

Re: Missing values in tuple assignment

2009-03-19 Thread Albert Hopkins
On Thu, 2009-03-19 at 11:57 -0500, Jim Garrison wrote: > Use case: parsing a simple config file line where lines start with a > keyword and have optional arguments. I want to extract the keyword and > then pass the rest of the line to a function to process it. An obvious > use of split(None,1) >

Re: Strange crash issue on Windows w/ PyGTK, Cairo...

2009-03-19 Thread CJ Kucera
CJ Kucera wrote: > Anyway, the issue turned out to be zlib.decompress() - for larger sets > of data, if I wasn't specifying "bufsize," the malloc()s that it was > doing behind-the-scenes must have been clobbering memory. As soon as I > specified bufsize, everything was totally kosher. Okay, I've

Re: Memory efficient tuple storage

2009-03-19 Thread psaff...@googlemail.com
In the end, I used a cStringIO object to store the chromosomes - because there are only 23, I can use one character for each chromosome and represent the whole lot with a giant string and a dictionary to say what each character means. Then I used numpy arrays for the data and coordinates. This sque

Re: What happened to NASA at Python? :(

2009-03-19 Thread Steve Holden
s...@pobox.com wrote: > >> In fact, graphics were added for several organizations. I believe > >> they will be chosen randomly. NASA is still there. > > MiO> In that case, they must be using the random number generator from > MiO> Dilbert. You know, the one that said 9, 9, 9, 9,.

Re: Can I rely on...

2009-03-19 Thread Emanuele D'Arrigo
Thank you everybody for the informative replies. I'll have to comb my code for all the instances of "item in sequence" statement because I suspect some of them are as unsafe as my first example. Oh well. One more lesson learned. Thank you again. Manu -- http://mail.python.org/mailman/listinfo/py

Re: What happened to NASA at Python? :(

2009-03-19 Thread Dotan Cohen
> There are about 40 people supporting the Mars Lander mission using > Python and aiming for a launch window this September. Wish them luck! > What, exactly, are they using Python for? -- Dotan Cohen http://what-is-what.com http://gibberish.co.il א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק

Re: How complex is complex?

2009-03-19 Thread Paul Hildebrandt
On Mar 19, 9:41 am, Kottiyath wrote: > On Mar 19, 9:33 pm, Kottiyath wrote: > > > > > On Mar 19, 8:42 pm, Paul McGuire wrote: > > > > On Mar 19, 4:39 am, Kottiyath wrote: > > > > > I understand that my question was foolish, even for a newbie. > > > > I will not ask any more such questions in th

Re: What happened to NASA at Python? :(

2009-03-19 Thread Aahz
[posted and e-mailed] In article , Dotan Cohen wrote: > >PiBUaGVyZSBhcmUgYWJvdXQgNDAgcGVvcGxlIHN1cHBvcnRpbmcgdGhlIE1hcnMgTGFuZGVyIG1p >c3Npb24gdXNpbmcKPiBQeXRob24gYW5kIGFpbWluZyBmb3IgYSBsYXVuY2ggd2luZG93IHRoaXMg >U2VwdGVtYmVyLiBXaXNoIHRoZW0gbHVjayEKPgoKV2hhdCwgZXhhY3RseSwgYXJlIHRoZXkgdXNp >bmcgU

Re: converting pipe delimited file to fixed width

2009-03-19 Thread MRAB
Terry Reedy wrote: digz wrote: Hi, I am trying to convert a | delimited file to fixed width by right padding with spaces, Here is how I have written the program , just get the feeling this can be done in a much better ( python functional ) way rather than the procedural code i have below . Any

Re: Threads not Improving Performance in Program

2009-03-19 Thread Jean-Paul Calderone
On Thu, 19 Mar 2009 09:50:51 -0700, Ryan Rosario wrote: I have a parser that needs to process 7 million files. After running for 2 days, it had only processed 1.5 million. I want this script to parse several files at once by using multiple threads: one for each file currently being analyzed. T

Re: What happened to NASA at Python? :(

2009-03-19 Thread Dotan Cohen
> Could you perhaps be persuaded to post in ASCII? Sorry, Aahz, Gmail sends the mail as base64 encoded if there are non-ascii characters. This is the first problem that I've encountered with this, what mailer are you using? -- Dotan Cohen http://what-is-what.com http://gibberish.co.il -- http:/

Re: Missing values in tuple assignment

2009-03-19 Thread MRAB
Albert Hopkins wrote: On Thu, 2009-03-19 at 11:57 -0500, Jim Garrison wrote: Use case: parsing a simple config file line where lines start with a keyword and have optional arguments. I want to extract the keyword and then pass the rest of the line to a function to process it. An obvious use of

Re: converting pipe delimited file to fixed width

2009-03-19 Thread Tim Chase
Caveat: none of the solutions (including mine) deal with the case of the field being longer than the width. You might want to throw an exception. Alternatively, you can just crop the results. Tweaking MRAB's elegant solution: field_widths = [14, 6, 18, 21, 21, 4, 6] infile = open("input.

Parallel processing on shared data structures

2009-03-19 Thread psaff...@googlemail.com
I'm filing 160 million data points into a set of bins based on their position. At the moment, this takes just over an hour using interval trees. I would like to parallelise this to take advantage of my quad core machine. I have some experience of Parallel Python, but PP seems to only really work fo

Re: converting pipe delimited file to fixed width

2009-03-19 Thread John Posner
[snip] > field_widths = [14, 6, 18, 21, 21, 4, 6] > > out = open("/home/chatdi/ouptut.csv", 'w') > for line in open("/home/chatdi/input.csv", "r"): > fields = line.rstrip().split('|') > padded_fields = [field.ljust(width) for field, width in zip(fields, > field_widths)] > out.write

Re: cross compile Python to Linux-ARM

2009-03-19 Thread Tino Wildenhain
jefm wrote: Hi, We are looking to use Python on an embedded Linux ARM system. What I gather from googling the subject is that it is not that straight forward (a fair amount of patching & hacking). Nobody out there that has done it claims it is easy, which makes me worried. Yes unfortunately its

Re: Missing values in tuple assignment

2009-03-19 Thread Terry Reedy
Jim Garrison wrote: Use case: parsing a simple config file line where lines start with a keyword and have optional arguments. I want to extract the keyword and then pass the rest of the line to a function to process it. An obvious use of split(None,1) cmd,args= = line.split(None,1); if

  1   2   >