Re: what does 64-bit python mean?

2009-03-18 Thread Chris Rebert
On Wed, Mar 18, 2009 at 11:45 PM, srinivasan srinivas wrote: > > Hi, > Could someone help me in understanding what 64-bit python means? 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 als

Re: equivalent of source command in tcl for python

2009-03-18 Thread alex23
On Mar 19, 2:42 pm, Ralf Schoenian wrote: > mark.coll...@csiro.au wrote: > > Many times I am developing a code in a file and I want to, for > > example, exit at a specific line so that I can test something. In tcl > > you can just put an exit command in and source the file. Is there an > > equival

what does 64-bit python mean?

2009-03-18 Thread srinivasan srinivas
Hi, Could someone help me in understanding what 64-bit python means? tahnks, Srini Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How complex is complex?

2009-03-18 Thread Daniel Fetchinson
> 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, should we do: for key in a: > ... a[key] = a[key] + 1

Re: [python-list] Re: Strange crash issue on Windows w/ PyGTK, Cairo...

2009-03-18 Thread CJ Kucera
bieff...@gmail.com wrote: > If you have worked with C/C++, you know that memory-related bugs can > be very tricky. > More than once - working with C code - I had crashes that disappeared > if I just added > a 'printf', because the memory allocation scheme changed and the > memory corrupted was not

pylab plot_date problem

2009-03-18 Thread Shah Sultan Alam
Hi , I am using following code to create a graph def plot_plot(): ax = pylab.subplot(111) for count in range(len(yaxes_values)): pylab.subplots_adjust(left=0.13, bottom=0.21, right=0.90, top=0.90,wspace=0.20, hspace=0.20) ax.plot_date(id_dates,yaxes_values[count],fmt='o-

RE: Python to Perl transalators

2009-03-18 Thread Abhinayaraj . Raju
Thanks Nick. The website content is impressive. Thanks Agni -Original Message- From: Nick Craig-Wood [mailto:n...@craig-wood.com] Sent: Wednesday, March 18, 2009 9:00 PM To: python-list@python.org Subject: Re: Python to Perl transalators Armin wrote: > On Wednesday 18 March 2009 1

Re: File Compare with difflib.context_diff

2009-03-18 Thread JohnV
The below code does the trick with one small problem left to be solved import shutil import string currentdata_file = r"C:\Users\Owner\Desktop\newdata.txt" # the current download from the clock lastdata_file = r"C:\Users\Owner\Desktop\mydata.txt" # the prior download from the clock output_file =

Re: Avoiding excessive writes

2009-03-18 Thread John Machin
On Mar 19, 1:20 pm, "Gabriel Genellina" wrote: > En Thu, 19 Mar 2009 00:52:54 -0200, escribió: > > > I'm aware that C, and thus Python I suppose, will cache file writes > > for efficiency and to avoid excessive disk activity, > > Python 2.X, yes, because it uses C file streams (FILE) to implement

Re: How complex is complex?

2009-03-18 Thread Tim Roberts
bearophileh...@lycos.com wrote: > >In Python 3 those lines become shorter: > >for k, v in a.items(): >{k: v+1 for k, v in a.items()} That's a syntax I have not seen in the 2-to-3 difference docs, so I'm not familiar with it. How does that cause "a" to be updated? -- Tim Roberts, t...@probo.com P

Re: equivalent of source command in tcl for python

2009-03-18 Thread Paddy3118
On Mar 19, 4:42 am, Ralf Schoenian wrote: > mark.coll...@csiro.au wrote: > > Many times I am developing a code in a file and I want to, for > > example, exit at a specific line so that I can test something. In tcl > > you can just put an exit command in and source the file. Is there an > > equival

Re: equivalent of source command in tcl for python

2009-03-18 Thread Ralf Schoenian
mark.coll...@csiro.au wrote: Many times I am developing a code in a file and I want to, for example, exit at a specific line so that I can test something. In tcl you can just put an exit command in and source the file. Is there an equivalent for python? Thanks, Hi Mark, there is: import sys s

Re: REDIRECT

2009-03-18 Thread gaeasiankom
On Mar 18, 5:21 am, Tino Wildenhain wrote: > gaeasian...@gmail.com wrote: > > Hi ! > > > I'm new to Python. I'm having some difficulties to redirect the pages > > using python. Every time when I redirect, the URL changed accordingly. > > > (Example : from  http://localhost:  to   > > http://lo

equivalent of source command in tcl for python

2009-03-18 Thread mark . collier
Many times I am developing a code in a file and I want to, for example, exit at a specific line so that I can test something. In tcl you can just put an exit command in and source the file. Is there an equivalent for python? Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Re: Candidate for a new itertool

2009-03-18 Thread George Sakkis
On Mar 7, 8:47 pm, Raymond Hettinger wrote: > The existing groupby() itertool works great when every element in a > group has the same key, but it is not so handy when groups are > determined by boundary conditions. > > For edge-triggered events, we need to convert a boundary-event > predicate to

Re: Avoiding excessive writes

2009-03-18 Thread Gabriel Genellina
En Thu, 19 Mar 2009 00:52:54 -0200, escribió: I'm aware that C, and thus Python I suppose, will cache file writes for efficiency and to avoid excessive disk activity, Python 2.X, yes, because it uses C file streams (FILE) to implement Python file objects. Python 3.x avoids that layer. Do

Avoiding excessive writes

2009-03-18 Thread prometheus235
I'm aware that C, and thus Python I suppose, will cache file writes for efficiency and to avoid excessive disk activity, causing occasional problems when forgetting to flush. How exactly this works is still somewhat of a mystery to me, but a concern because of a program I'm developing: The progra

Re: Candidate for a new itertool

2009-03-18 Thread Aahz
In article <6ca71455-2fb2-4dd0-a500-2a480d815...@v6g2000vbb.googlegroups.com>, Raymond Hettinger wrote: > >For edge-triggered events, we need to convert a boundary-event >predicate to groupby-style key function. The code below encapsulates >that process in a new itertool called split_on(). > >Wo

Re: File Compare with difflib.context_diff

2009-03-18 Thread Gabriel Genellina
En Wed, 18 Mar 2009 21:02:42 -0200, Emile van Sebille escribió: JohnV wrote: > What I want to do is compare the old data (lets day it is saved to a file called 'lastdata.txt') with the new data (lets day it is saved to a file called 'currentdata.txt') and save the new appended data to a va

Re: Roulette wheel

2009-03-18 Thread Gabriel Genellina
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 can say the same for: 1 - t = [x*2 for x in range(10)] 2 - t = list(x*2 for x in rang

Re: Uploading a file using POST

2009-03-18 Thread Justin Ezequiel
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 > > enctype="multipart/form-data"> > > have you seen http://code.ac

Re: Disable automatic interning

2009-03-18 Thread George Sakkis
On Mar 18, 4:50 pm, "andrew cooke" wrote: > this is completely normal (i do exactly this all the time), BUT you should > use "==", not "is".   Typically, but not always; for example check out the identity map [1] pattern used in SQLAlchemy [2]. George [1] http://martinfowler.com/eaaCatalog/ide

Re: Disable automatic interning

2009-03-18 Thread Daniel Fetchinson
>> > I'm working on some graph generation problem where the node identity >> > is significant (e.g. "if node1 is node2: # do something) but ideally I >> > wouldn't want to impose any constraint on what a node is (i.e. require >> > a base Node class). It's not a show stopper, but it would be >> > pr

Re: How to do this in Python?

2009-03-18 Thread Jervis Whitley
> What I was wondering > was whether a similar construct was considered for a while loop or even an > if clause, because then the above could be written like this: > >  if open(filename, 'rb') as f: >      while f.read(1000) as buf: >          # do something with 'buf' > see here, and the associat

Re: read web page that requires javascript on client

2009-03-18 Thread Carl
On Mar 18, 1:56 pm, a...@pythoncraft.com (Aahz) wrote: > In article , > R. David Murray wrote: > > > > >That said, I've heard mention here of something that can apparently be > >used for this.  I think it was some incarnation of Webkit.  I remember > >someone saying you wanted to use the one with,

Re: Python to Perl transalators

2009-03-18 Thread afriere
On Mar 18, 1:32 am, Armin wrote: > On Wednesday 18 March 2009 11:01:00 Boris Borcic wrote: > > > Armin wrote: > > >> > > >> Why on earth would you want to? That'd be like translating Shakespeare > > >> into a bad rap song! > > >> > > > > lol, actually I would prefer a rap song over Shakespeare,

Re: Disable automatic interning

2009-03-18 Thread George Sakkis
On Mar 18, 4:06 pm, Daniel Fetchinson wrote: > > I'm working on some graph generation problem where the node identity > > is significant (e.g. "if node1 is node2: # do something) but ideally I > > wouldn't want to impose any constraint on what a node is (i.e. require > > a base Node class). It's

Uploading a file using POST

2009-03-18 Thread Thomas Robitaille
Hello, 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. At the moment I am trying URL="http://www.whatever.com"; f=open(filename, 'rb') filebody = f.read() f.close() data = {'name':'userfile','file': filebody} u = urllib

Re: Mangle function name with decorator?

2009-03-18 Thread Aaron Brady
On Mar 18, 8:47 am, Adam wrote: > On Mar 17, 1:49 pm, Aaron Brady wrote: > > > > > You would need a unique attribute to look for on values in the > > dictionary, which means you'd need to detect what functions you are > > renaming; possibly by using a decorator to mark them.  (Untested:) > > > cl

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

2009-03-18 Thread imageguy
> You have to know the original encoding (I mean, the one used for the csv > file), else there's nothing you can do. Then it's just a matter of > decoding (to unicode) then encoding (to utf8), ie (if your source is in > latin1): > > utf_string = latin1_string.decode("latin1").encode("utf8") The O

Re: How to do this in Python?

2009-03-18 Thread afriere
On Mar 18, 3:05 pm, Grant Edwards wrote: > {snip] ... If it > only going to be used once, then just do the usual thing: > > f = open(...) > while True: >    buf = f.read() >    if not buf: break >    # whatever. > f.close() +1 That's the canonical way (maybe using "with ... as" nowadays). Surel

Re: Tuple passed to function recognised as string

2009-03-18 Thread Scott David Daniels
Mike314 wrote: (paraphrased) >>> test_func(val=('val1')) >>> test_func(val=('val1', 'val2')) The output is quite different. Why I have string in the first case? More natural English: "Why do I get string in the first case?" (X) is the same as X (parentheses are for grouping), to get a singl

Tuple passed to function recognised as string

2009-03-18 Thread R. David Murray
Mike314 wrote: > Hello, > >I have following code: > > def test_func(val): > print type(val) > > test_func(val=('val1')) > test_func(val=('val1', 'val2')) > > The output is quite different: > > > > > Why I have string in the first case? Because in Python the syntactic element that

Re: Tuple passed to function recognised as string

2009-03-18 Thread Terry Reedy
Mike314 wrote: Hello, I have following code: def test_func(val): print type(val) test_func(val=('val1')) test_func(val=('val1', 'val2')) The output is quite different: Why I have string in the first case? Because () == . Perhaps you meant ('val1',). "Parenthesized forms A parent

Re: Tuple passed to function recognised as string

2009-03-18 Thread Albert Hopkins
On Wed, 2009-03-18 at 16:58 -0700, Mike314 wrote: > Hello, > >I have following code: > > def test_func(val): > print type(val) > > test_func(val=('val1')) > test_func(val=('val1', 'val2')) > > The output is quite different: > > > > > Why I have string in the first case? You could h

Re: Tuple passed to function recognised as string

2009-03-18 Thread MRAB
Mike314 wrote: Hello, I have following code: def test_func(val): print type(val) test_func(val=('val1')) test_func(val=('val1', 'val2')) The output is quite different: Why I have string in the first case? It's the comma that makes the tuple, except for one special case: the empty

Tuple passed to function recognised as string

2009-03-18 Thread Mike314
Hello, I have following code: def test_func(val): print type(val) test_func(val=('val1')) test_func(val=('val1', 'val2')) The output is quite different: Why I have string in the first case? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help cleaning up some code

2009-03-18 Thread Aahz
In article <814f91a3-faa4-4473-b28f-8e0e217fb...@f33g2000vbf.googlegroups.com>, odeits wrote: > >for row in rows: >ad = dict() Micro-optimization: ad = {} -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ "Programming language design is not a rational sci

Re: How complex is complex?

2009-03-18 Thread Rhodri James
On Wed, 18 Mar 2009 17:30:45 -, Kottiyath wrote: When we say readability counts over complexity, how do we define what level of complexity is ok? We don't. There is no One True Way that defines for us what complexity is, never mind how much of it is too much. It's a judgement call tha

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

2009-03-18 Thread Tim Chase
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's always annoyed me with the mxODBC drivers I've usedthey req

Re: Smalltalk-like Python IDE ?

2009-03-18 Thread Bruno Desthuilliers
Lobo a écrit : Hi, My experience has been with Smalltalk using Object databases. I would very much appreciate your recommendations on a Python IDE closest to the Smalltalk 'image' environment, with class browsers, implementors/senders, inspectors, debuggers, etc. Well, Python is file-based, n

Re: File Compare with difflib.context_diff

2009-03-18 Thread Emile van Sebille
JohnV wrote: > What I want to do is compare the old data (lets day it is saved to a file called 'lastdata.txt') with the new data (lets day it is saved to a file called 'currentdata.txt') and save the new appended data to a variable You may get away with something like: (untested) newdata=op

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

2009-03-18 Thread Bruno Desthuilliers
rewonka a écrit : (snip) Now i stucked when i tried to pu into db. Because i have some cell that is in somekind of unicoded text, You mean "encoded in something else than utf8" ? and i'm looking a solution how to put this into db (my db in utf-8 format). (snip) but something binary in a c

Re: File Compare with difflib.context_diff

2009-03-18 Thread JohnV
Maybe something like this will work though I am not sure of my quotes and what to import import shutil f = open(r'C:\Users\Owner\Desktop\mydata.txt', 'r') read_data1 = f.read() f.close() shutil.copy('C:\Users\Owner\Desktop\newdata.txt', 'C:\Users\Owner \Desktop\out.txt') file = open(r'C:\Users\O

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

2009-03-18 Thread Bruno Desthuilliers
Tim Chase a écrit : sql = ''' INSERT INTO table (column1,column2, ...) VALUES ( %s, %s, ); ''' for row in rows: connection.cursor.execute(sql % (row[0],row[1],)) connection.corsur.commit() (snip) The first step is to use the database's quoting to prevent problems where miscreant

Re: Run on Startup

2009-03-18 Thread Gabriel Genellina
En Wed, 18 Mar 2009 15:13:32 -0300, Mike Driscoll escribió: On Mar 18, 1:09 am, "Gabriel Genellina" wrote: En Tue, 17 Mar 2009 00:16:53 -0200, MRAB   escribió: > Ian Mallett wrote: >>  I'd like to make a program that automatically runs on startup (right   >> after login).  How should I

Re: File Compare with difflib.context_diff

2009-03-18 Thread Chris Rebert
On Wed, Mar 18, 2009 at 2:30 PM, JohnV wrote: > I have a txt file that gets appended with data over a time event.  The > data comes from an RFID reader and is dumped to the file by the RFID > software.  I want to poll that file several times over the time period > of the event to capture the curre

Re: Cannot allocate memory when using os.spawn for moving files

2009-03-18 Thread Piet van Oostrum
> Andreas (A) wrote: >A> Hello there, >A> I have a problem moving files from my local harddrive to a NFS share using >A> a Python script. >A> The script is used to run a model which produces large (~500MB) binary >A> output files. The model itself is a Fortran program, and I call it from my >

File Compare with difflib.context_diff

2009-03-18 Thread JohnV
I have a txt file that gets appended with data over a time event. The data comes from an RFID reader and is dumped to the file by the RFID software. I want to poll that file several times over the time period of the event to capture the current data in the RFID reader. When I read the data I wan

Re: read web page that requires javascript on client

2009-03-18 Thread Aahz
In article , R. David Murray wrote: > >That said, I've heard mention here of something that can apparently be >used for this. I think it was some incarnation of Webkit. I remember >someone saying you wanted to use the one with, I think it was GTK >bindings, even though you were dealing with just

Re: Run on Startup

2009-03-18 Thread Mike Driscoll
On Mar 18, 2:14 pm, Tim Wintle wrote: > On Wed, 2009-03-18 at 11:13 -0700, Mike Driscoll wrote: > > On Mar 18, 1:09 am, "Gabriel Genellina" > > > Any decent installer is able to register a program so it runs on startup   > > > (InnoSetup, by example). Anyway, if you want to it it yourself, > > >

Re: Disable automatic interning

2009-03-18 Thread andrew cooke
George Sakkis wrote: > I'm working on some graph generation problem where the node identity > is significant (e.g. "if node1 is node2: # do something) but ideally I > wouldn't want to impose any constraint on what a node is (i.e. require > a base Node class). It's not a show stopper, but it would b

Re: Roulette wheel

2009-03-18 Thread mattia
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 can say the same for: 1 - t = [x*2 for x in >>range(10)] >>2 - t = list(x*2 for x in range(10)) >>or not? > > The latter requires ge

"pydoc mock" not working properly

2009-03-18 Thread skip
I just installed the latest version of mock (0.4.0) under both Python 2.6 and 2.7 (svn trunk). In both cases pydoc fails to find anything: ~% pydoc2.6 mock no Python documentation found for 'mock' ~% pydoc2.7 mock no Python documentation found for 'mock' but this works from the

Re: alias method definitions / syntactic sugar suggestion

2009-03-18 Thread R. David Murray
Terry Reedy wrote: > andrew cooke wrote: > > [sorry for dup terry; prev not to list] > > > > Terry Reedy wrote: > >> @alias('justAsFantastic') > >> def someFantasticMethod(args): ... > > > > does this exist? i read the previous post and thought "i think a > > decorator could do that", but i hav

Re: python equivalent of java technologies

2009-03-18 Thread Armin
On Wednesday 18 March 2009 15:14:30 markolopa wrote: > Hello, > > When comparing python and java with a colleague who is fan of java, > she challenged me to find in python the equivalent to the following > technologies. Could you please help telling if we have something > equivalent in python or no

read web page that requires javascript on client

2009-03-18 Thread R. David Murray
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 that say as much but I just > can't believe it to be true (I'm subscribing to the "argument of > per

Re: Roulette wheel

2009-03-18 Thread Aahz
In article <49c1562a$0$1115$4fafb...@reader1.news.tin.it>, mattia wrote: > >Yeah, and I believe that we can say the same for: >1 - t = [x*2 for x in range(10)] >2 - t = list(x*2 for x in range(10)) >or not? The latter requires generator expressions, which means it only works with Python 2.4 or h

Re: Roulette wheel

2009-03-18 Thread mattia
Il Wed, 18 Mar 2009 09:34:57 -0700, Aahz ha scritto: > In article , Peter Otten > <__pete...@web.de> wrote: >>mattia wrote: >>> >>> cpop += [nchromosome1] + [nchromosome2] >> >>I'd write that as >> >>cpop.append(nchromosome1) >>cpop.append(nchromosome2) >> >>thus avoiding the intermediate

Re: Disable automatic interning

2009-03-18 Thread Daniel Fetchinson
>> > Is there a way to turn off (either globally or explicitly per >> > instance) the automatic interning optimization that happens for small >> > integers and strings (and perhaps other types) ? I tried several >> > workarounds but nothing worked: >> >> No. It's an implementation detail. >> >> Wh

read web page that requires javascript on client

2009-03-18 Thread Greg
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 that say as much but I just can't believe it to be true (I'm subscribing to the "argument of personal incredulity " her

Re: Disable automatic interning

2009-03-18 Thread Terry Reedy
George Sakkis wrote: On Mar 18, 2:13 pm, "R. David Murray" wrote: George Sakkis wrote: Is there a way to turn off (either globally or explicitly per instance) the automatic interning optimization that happens for small integers and strings (and perhaps other types) ? I tried several workaroun

Re: alias method definitions / syntactic sugar suggestion

2009-03-18 Thread Aahz
In article , andrew cooke wrote: >Terry Reedy wrote: >> >> @alias('justAsFantastic') >> def someFantasticMethod(args): ... > >does this exist? i read the previous post and thought "i think a >decorator could do that", but i haven't written one. > >the reason i ask is that for 3->2 backwards compa

Smalltalk-like Python IDE ?

2009-03-18 Thread Lobo
Hi, My experience has been with Smalltalk using Object databases. I would very much appreciate your recommendations on a Python IDE closest to the Smalltalk 'image' environment, with class browsers, implementors/senders, inspectors, debuggers, etc. I am planning to use the following technologies

Re: Disable automatic interning

2009-03-18 Thread Martin v. Löwis
>>> Is there a way to turn off (either globally or explicitly per >>> instance) the automatic interning optimization that happens for small >>> integers and strings (and perhaps other types) ? I tried several >>> workarounds but nothing worked: >> No. It's an implementation detail. >> >> What use

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

2009-03-18 Thread Tim Chase
sql = ''' INSERT INTO table (column1,column2, ...) VALUES ( %s, %s, ); ''' for row in rows: connection.cursor.execute(sql % (row[0],row[1],)) connection.corsur.commit() but something binary in a cell, the pgdb says it is not in utf-8 format, or something like this. I know it's a newbi

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

2009-03-18 Thread rewonka
On márc. 18, 14:10, Peter Otten <__pete...@web.de> wrote: > rewonka wrote: > > I had a problem, i would like to process a file into a PSQL, but in > > the file the delimiter char is ':' > > and i have the same charater inside the text field also. > > something like this: > > text = 1:23:34:"sample:

Re: Run on Startup

2009-03-18 Thread Tim Wintle
On Wed, 2009-03-18 at 11:13 -0700, Mike Driscoll wrote: > On Mar 18, 1:09 am, "Gabriel Genellina" > > Any decent installer is able to register a program so it runs on startup > > (InnoSetup, by example). Anyway, if you want to it it yourself, > > see:http://msdn.microsoft.com/en-us/library/bb77

Re: Disable automatic interning

2009-03-18 Thread George Sakkis
On Mar 18, 2:13 pm, "R. David Murray" wrote: > George Sakkis wrote: > > Is there a way to turn off (either globally or explicitly per > > instance) the automatic interning optimization that happens for small > > integers and strings (and perhaps other types) ? I tried several > > workarounds but

Re: python equivalent of java technologies

2009-03-18 Thread Mike Driscoll
On Mar 18, 1:14 pm, markolopa wrote: > Hello, > > When comparing python and java with a colleague who is fan of java, > she challenged me to find in python the equivalent to the following > technologies. Could you please help telling if we have something > equivalent in python or not and how they

Re: Openings for Python Programmer at CA

2009-03-18 Thread Mike Driscoll
On Mar 18, 1:09 pm, Paul Rudin wrote: > Aniket M writes: > > Note: Communication MUST be perfect!, Plus submit with 3 professional > > references > > Irony :) I have yet to meet anyone with perfect communication. I think this is an "unfillable" position. Mike -- http://mail.python.org/mailman/l

python equivalent of java technologies

2009-03-18 Thread markolopa
Hello, When comparing python and java with a colleague who is fan of java, she challenged me to find in python the equivalent to the following technologies. Could you please help telling if we have something equivalent in python or not and how they compare to the java solutions? - persistance fra

Re: Run on Startup

2009-03-18 Thread Mike Driscoll
On Mar 18, 1:09 am, "Gabriel Genellina" wrote: > En Tue, 17 Mar 2009 00:16:53 -0200, MRAB   > escribió: > > > Ian Mallett wrote: > >>  I'd like to make a program that automatically runs on startup (right   > >> after login).  How should I do that? > > > Put it in the folder: > > > C:\Documents an

Re: How complex is complex?

2009-03-18 Thread Paul McGuire
You realize of course that these two alternatives are not equivalent. The first does what your problem statement describes, for each key in a given dict, increments the corresponding value. The second creates an entirely new dict with the modified values. Even if you were to write the second one

Re: Openings for Python Programmer at CA

2009-03-18 Thread Paul Rudin
Aniket M writes: > Note: Communication MUST be perfect!, Plus submit with 3 professional > references Irony :) -- http://mail.python.org/mailman/listinfo/python-list

Disable automatic interning

2009-03-18 Thread R. David Murray
George Sakkis wrote: > Is there a way to turn off (either globally or explicitly per > instance) the automatic interning optimization that happens for small > integers and strings (and perhaps other types) ? I tried several > workarounds but nothing worked: No. It's an implementation detail. Wh

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

2009-03-18 Thread Luis Zarrabeitia
Quoting Jim Garrison : > Jim Garrison wrote: > > Luis Zarrabeitia wrote: > >> On Tuesday 17 March 2009 06:04:36 pm Jim Garrison wrote: > >> with open(filename, "rb") as f: > >> for buf in iter(lambda: f.read(1000),''): > >> do_something(buf) > > > > This is the most pythonic solution

Re: How complex is complex?

2009-03-18 Thread George Sakkis
On Mar 18, 1:30 pm, Kottiyath 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, should we do:>>> for

Re: How complex is complex?

2009-03-18 Thread Casey Webster
On Mar 18, 1:30 pm, Kottiyath 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, should we do:>>> for k

Re: How complex is complex?

2009-03-18 Thread bearophileHUGS
Kottiyath: > How do we decide whether a level of complexity is Ok or not? I don't understand your question, but here are better ways to do what you do: >>> a = {'a': 2, 'c': 4, 'b': 3} >>> for k, v in a.iteritems(): ... a[k] = v + 1 ... >>> a {'a': 3, 'c': 5, 'b': 4} >>> b = dict((k, v+1) for k

Disable automatic interning

2009-03-18 Thread George Sakkis
Is there a way to turn off (either globally or explicitly per instance) the automatic interning optimization that happens for small integers and strings (and perhaps other types) ? I tried several workarounds but nothing worked: >>> 'x' is 'x' True >>> 'x' is 'x'+'' True >>> 'x' is ''+'x' True >>>

Openings for Python Programmer at CA

2009-03-18 Thread Aniket M
Hello , This is Aniket from Techclique, a New Jersey based software development and IT consulting firm providing top quality technical and software professionals on a permanent and contractual basis to Government and commercial customer including fortune 500 companies and most of states and federal

How complex is complex?

2009-03-18 Thread Kottiyath
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, should we do: >>> for key in a: ... a[key] = a[key] + 1 or is it Ok to

Re: Mangle function name with decorator?

2009-03-18 Thread R. David Murray
Adam wrote: > David, would you believe that I just posted about this very idea, It > doesn't seem to have shown up yet, though. This idea works from the > perspective of being trivially easy to implement. I can easily write > a metaclass that looks in the namespace for methods with names that >

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

2009-03-18 Thread andrew cooke
sorry, ignore that. hit send before thinking properly. > have you looked in operators? that might avoid the need for a class. -- http://mail.python.org/mailman/listinfo/python-list

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

2009-03-18 Thread andrew cooke
have you looked in operators? that might avoid the need for a class. 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

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

2009-03-18 Thread Jim Garrison
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 boolean. This would seem to add much more generality... is

Re: Style formating of multiline query, advise

2009-03-18 Thread someone
On Mar 18, 5:56 pm, Scott David Daniels wrote: > someone wrote: > > what is good :) style for multiline queries to database?... > > query = """ SELECT * FROM ( > >                    SELECT a.columna, a.columnb, a.iso > >                       FROM all a > >                       WHERE (a.name = L

Re: Style formating of multiline query, advise

2009-03-18 Thread Steve Holden
Scott David Daniels wrote: > someone wrote: >> what is good :) style for multiline queries to database?... >> query = """ SELECT * FROM ( >>SELECT a.columna, a.columnb, a.iso >> FROM all a >> WHERE (a.name = LOWER(%s)) ) AS c >>

Re: Style formating of multiline query, advise

2009-03-18 Thread Scott David Daniels
someone wrote: what is good :) style for multiline queries to database?... 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: How to do this in Python? - A "gotcha"

2009-03-18 Thread S Arrowsmith
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 >boolean. This would seem to add much more generality... is >it worthy of a PEP

Re: Roulette wheel

2009-03-18 Thread Aahz
In article , Peter Otten <__pete...@web.de> wrote: >mattia wrote: >> >> cpop += [nchromosome1] + [nchromosome2] > >I'd write that as > >cpop.append(nchromosome1) >cpop.append(nchromosome2) > >thus avoiding the intermediate lists. You could also write it as cpop += [nchromosome1, nchromo

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

2009-03-18 Thread Jim Garrison
Andrii V. Mishkovskyi wrote: Just before you start writing a PEP, take a look at `takewhile' function in `itertools' module. ;) OK, after reading the itertools docs I'm not sure how to use it in this context. takewhile() requires a sequence, and turning f.read(bufsize) into an iterable require

Re: objectoriented -?- functional

2009-03-18 Thread Piet van Oostrum
> Walther Neuper (WN) wrote: >WN> Hi, >WN> loving Java (oo) as well as SML (fun) I use to practice both of them >WN> separately. >WN> Now, with Python I would like to combine 'oo.extend()' with 'functional >WN> map': >WN> Python 2.4.4 (#2, Oct 22 2008, 19:52:44) >WN> [GCC 4.1.2 20061115 (pre

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

2009-03-18 Thread Andrii V. Mishkovskyi
On Wed, Mar 18, 2009 at 5:51 PM, Jim Garrison wrote: > Jim Garrison wrote: >> >> Luis Zarrabeitia wrote: >>> >>> On Tuesday 17 March 2009 06:04:36 pm Jim Garrison wrote: >>> with open(filename, "rb") as f: >>>    for buf in iter(lambda: f.read(1000),''): >>>        do_something(buf) >> >> This is

Re: array next pointer

2009-03-18 Thread R. David Murray
Duncan Booth wrote: > Armin wrote: > > > Could you give an example of next() with a sentinel and describe its > > use case please? I have a little trouble understanding what you guys > > mean! > > It means you don't have to worry about next() throwing StopIteration. > > e.g. > >>> def pairs

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

2009-03-18 Thread Jim Garrison
Jim Garrison wrote: Luis Zarrabeitia wrote: On Tuesday 17 March 2009 06:04:36 pm Jim Garrison wrote: with open(filename, "rb") as f: for buf in iter(lambda: f.read(1000),''): do_something(buf) This is the most pythonic solution yet. Thanks to all the responders who took time to po

Re: Mangle function name with decorator?

2009-03-18 Thread andrew cooke
Adam wrote: > Hey, Cliff. Thanks for sharing this idea. Unfortunately, providing a > way to actually call the method with the mangled name is relatively > easy, and there are options there. The real issue, to me, seems to be > finding a way to prevent Python from eating all but the last version

Re: SOAPpy help needed

2009-03-18 Thread Piet van Oostrum
> somemilk (D) wrote: >D> Hi everyone. >D> I have a PHP script which works and i need to write the same in Python >D> but SOAPpy generates a slightly different request and i'm not sure how >D> to fix it so the server likes it. >D> The request generated by php script looks like this (removed

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

2009-03-18 Thread bieffe62
On Mar 18, 2:33 pm, CJ Kucera wrote: > bieff...@gmail.com wrote: > > It looks like some of the C extension you are using is causing a > > segfault or similar in python > > interpreter (or it could be a bug in the interpreter itself, but it is > > a lot less likely). > > Okay...  I assume by "C ext

  1   2   >