RE: String slices work only for first string character ?

2008-12-16 Thread Barak, Ron
Thanks to all who pointed my wrong understanding of how string slices are defined. Bye, Ron. From: Barak, Ron [mailto:ron.ba...@lsi.com] Sent: Tuesday, December 16, 2008 15:35 To: python-list@python.org Subject: String slices work only for first string character ?

Re: How to modify a program while it's running?

2008-12-16 Thread Aaron Brady
On Dec 16, 11:47 pm, Paul Rubin wrote: > Joe Strout writes: > > So I'd like to restructure my app so that it can stay running and stay > > logged in, yet I can still update and reload at least most of the > > code.  But I'm not sure what's the best way to do this.  S

Re: Can anyone suggest a good HTTP/1.1 web client?

2008-12-16 Thread Saju Pillai
On Dec 17, 1:18 am, Kottiyath wrote: > Hi all, >     I have to connect to a secure website every second to get the data > and then post to it. I have been investigating on many web clients in > python, but nothing fits the bill properly. >     The ones I tried implementing are: >     1. httplib ba

Re: How to modify a program while it's running?

2008-12-16 Thread Paul Rubin
Joe Strout writes: > So I'd like to restructure my app so that it can stay running and stay > logged in, yet I can still update and reload at least most of the > code. But I'm not sure what's the best way to do this. Should I move > the reloadable code into its own module, and then when I give m

Re: The rule of literal string

2008-12-16 Thread Chris Rebert
On Tue, Dec 16, 2008 at 9:32 PM, Li Han wrote: > Hi! I just began to read the tutorial of python3.0 and I just can't > figure out the rule of literal string. There is a example in the > tuotrial: '"Isn\'t," she said.' > '"Isn\'t," she said.' > It is not what I want, I just want '"Isn't," she

The rule of literal string

2008-12-16 Thread Li Han
Hi! I just began to read the tutorial of python3.0 and I just can't figure out the rule of literal string. There is a example in the tuotrial: >>> '"Isn\'t," she said.' '"Isn\'t," she said.' It is not what I want, I just want '"Isn't," she said.' be printed, why the backslash failed? These don't wo

Re: Does Python3 offer a FrozenDict?

2008-12-16 Thread Johannes Bauer
bearophileh...@lycos.com schrieb: > Johannes Bauer: >> is there anything like a frozen dict in Python3, so I could do a >> foo = { FrozenDict({"a" : "b"}): 3 } > > You can adapt this code to Python3 (and post a new recipe? It may be > positive to create a new section of the Cookbook for Py3 only):

Re: Does Python3 offer a FrozenDict?

2008-12-16 Thread Johannes Bauer
Steven D'Aprano schrieb: > On Tue, 16 Dec 2008 17:59:30 +0100, Johannes Bauer wrote: > >> Hello group, >> >> is there anything like a frozen dict in Python3, so I could do a >> >> foo = { FrozenDict({"a" : "b"}): 3 } >> >> or something like that? > > > If *all* you want is to use it as a key, th

Re: How to modify a program while it's running?

2008-12-16 Thread Aaron Brady
On Dec 16, 7:54 pm, "James Mills" wrote: > @Aaron > > Your code and suggestion is way too complicated. > Just register your objects. When you need to > reload your module, destroy the existing > objects and re-creat them. > > This works well assuming you have a stable > running core that maintains

Re: Can anyone suggest a good HTTP/1.1 web client?

2008-12-16 Thread Jean-Paul Calderone
On Tue, 16 Dec 2008 18:47:41 -0800 (PST), Kottiyath wrote: If you'd like to help out with the new Twisted HTTP client, that would be wonderful.  Even if you can just try it out and report any problems you run into, that would be immensely helpful. Jean-Paul I would love to help out with th

Re: Need help improving number guessing game

2008-12-16 Thread r . drew . davis
On Dec 15, 1:29 pm, feba wrote: > 6; can anyone think of anything else to add on to/do with this game? > With the minr/maxr display, multiplayer, score keeping, and > automation, I'm just about all of ideas. All I can think of left to > add is 3 and 4 player modes, or a fork where player 2 can't

unsubscribe

2008-12-16 Thread Mark Jordaan
> From: p.f.mo...@gmail.com> Subject: Re: Does Python3 offer a FrozenDict?> > Date: Tue, 16 Dec 2008 09:56:57 -0800> To: python-list@python.org> > On 16 > Dec, 17:28, bearophileh...@lycos.com wrote:> > Johannes Bauer:> >> > > is > there anything like a frozen dict in Python3, so I could do a> >

Re: Can anyone suggest a good HTTP/1.1 web client?

2008-12-16 Thread Kottiyath
> If you'd like to help out with the new Twisted HTTP client, that would be > wonderful.  Even if you can just try it out and report any problems you run > into, that would be immensely helpful. > > Jean-Paul I would love to help out with the client. But, I am extremely tied up at the current mom

Re: WinMerge--B/W Shading of Printed Copy to Show Differences?

2008-12-16 Thread W. eWatson
Jason Scheirer wrote: On Dec 16, 3:56 pm, "W. eWatson" wrote: Is there a way to highlight differences between the two files when printing in b/w? Help suggests there may be some texturing, but all I see is color choices. -- W. eWatson (121.015 Deg.

Re: Free place to host python files?

2008-12-16 Thread Robert Kern
feba wrote: Stuff like code.google, sf.net, are more oriented towards serious development, not just holding random apps, aren't they? There are plenty of "projects" on them which are just personal sandboxes like you are asking for. I recommend code.google.com. -- Robert Kern "I have come to

Re: How to modify a program while it's running?

2008-12-16 Thread James Mills
@Aaron Your code and suggestion is way too complicated. Just register your objects. When you need to reload your module, destroy the existing objects and re-creat them. This works well assuming you have a stable running core that maintains the connection and that code doesn't change much. --Jame

Re: weird dict problem, how can this even happen?

2008-12-16 Thread Steven D'Aprano
On Wed, 17 Dec 2008 02:10:31 +0100, Joel Hedlund wrote: > Scott David Daniels wrote: >> Perhaps your hash function could be something like: > > I'm not sure I understand what you're suggesting. Neither am I, since you've removed the hash function which might have given readers a clue. *wink*

Re: How to modify a program while it's running?

2008-12-16 Thread Aaron Brady
On Dec 16, 7:26 pm, Steven D'Aprano wrote: > On Tue, 16 Dec 2008 13:25:17 -0700, Joe Strout wrote: > > So I'd like to restructure my app so that it can stay running and stay > > logged in, yet I can still update and reload at least most of the code. > > But I'm not sure what's the best way to do t

Re: How to modify a program while it's running?

2008-12-16 Thread James Mills
On Wed, Dec 17, 2008 at 11:26 AM, Steven D'Aprano wrote: >> So I'd like to restructure my app so that it can stay running and stay >> logged in, yet I can still update and reload at least most of the code. >> But I'm not sure what's the best way to do this. Should I move the >> reloadable code in

Re: weird dict problem, how can this even happen?

2008-12-16 Thread Steven D'Aprano
On Tue, 16 Dec 2008 14:32:39 +0100, Joel Hedlund wrote: > Duncan Booth wrote: >> I think you probably are correct. The only thing I can think that might >> help is if you can catch all the situations where changes to the >> dependent values might change the hash and wrap them up: before >> changin

Re: Does Python3 offer a FrozenDict?

2008-12-16 Thread Steven D'Aprano
On Tue, 16 Dec 2008 17:59:30 +0100, Johannes Bauer wrote: > Hello group, > > is there anything like a frozen dict in Python3, so I could do a > > foo = { FrozenDict({"a" : "b"}): 3 } > > or something like that? If *all* you want is to use it as a key, then: tuple(sorted(some_dict.items)) ma

Re: How to modify a program while it's running?

2008-12-16 Thread Steven D'Aprano
On Tue, 16 Dec 2008 13:25:17 -0700, Joe Strout wrote: > Here's my situation: I'm making an AIM bot, but the AIM server will get > annoyed if you log in too frequently (and then lock you out for a > while). So my usual build-a-little, test-a-little methodology doesn't > work too well. Ouch! What

Re: weird dict problem, how can this even happen?

2008-12-16 Thread Joel Hedlund
Scott David Daniels wrote: Perhaps your hash function could be something like: I'm not sure I understand what you're suggesting. /Joel -- http://mail.python.org/mailman/listinfo/python-list

Re: WinMerge--B/W Shading of Printed Copy to Show Differences?

2008-12-16 Thread Jason Scheirer
On Dec 16, 3:56 pm, "W. eWatson" wrote: > Is there a way to highlight differences between the two files when printing > in b/w? Help suggests there may be some texturing, but all I see is color > choices. > -- >                                 W. eWatson > >               (121.015 Deg. W, 39.262 D

Re: sorting for recursive folder rename

2008-12-16 Thread Rhodri James
On Tue, 16 Dec 2008 18:20:52 -, ianaré wrote: Hello all, I trying to recursively rename folders 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, and one to all items may be renamed. Here is some preliminary

Re: Free place to host python files?

2008-12-16 Thread James Mills
On Wed, Dec 17, 2008 at 10:25 AM, Chris Rebert wrote: > I'll plug Bitbucket (http://bitbucket.org/). It gives you 150MB of > Mercurial hosting for free, along with a bug tracker and wiki. And I > hear it's implemented using Django. FreeHG (http://freehg.org) is pretty good too :) cheers James --

Re: eval() and global variables

2008-12-16 Thread Juan Pablo Romero Méndez
P 2008/12/16 : > Quoth "=?ISO-8859-1?Q?Juan_Pablo_Romero_M=E9ndez?=" : >> Hello, >> >> Suppose this function is given: >> >> def f(x,y): >> return x+y+k >> >> Is it possible to somehow assign a value to k without resorting to >> making k global? >> >> I'm thinking something like this: >> >> eva

Re: Python is slow

2008-12-16 Thread r
On Dec 16, 5:47 pm, "James Mills" wrote: > On Wed, Dec 17, 2008 at 9:08 AM, r wrote: > > What about all the crap you had to go through just to get output? > > Python wins > > Yes I can't say I really enjoy writing C (at all!) > _except_ in the case where I may need to > optimise some heavy comput

Re: Free place to host python files?

2008-12-16 Thread Chris Rebert
On Tue, Dec 16, 2008 at 6:10 AM, feba wrote: > I'm getting started in python, and it would be helpful to have a place > to put up various code snippets I've made, so I don't have to send > them individually to each person I want to show it to. I'd prefer to > use something that would give me a dir

Re: mod_python resources

2008-12-16 Thread Дамјан Георгиевски
> I'm trying again because I'm stubborn. Maybe the fourth time will be > the charm... > > Are there any good tutorials out there for setting up Apache with > mod_python? mod_python is depreceated, nobody uses it. use mod_wsgi http://www.modwsgi.org/ -- дамјан ( http://softver.org.mk/damjan/

Re: ethical questions about global variables

2008-12-16 Thread Дамјан Георгиевски
> By "per-class-instance variables", you are talking > about instance attributes? I.e. "self.use_gmt_times"? > I don't see much difference between global variables > and instance attributes. using global variable in modules makes the module not Thread-safe Using a instance attribute allows more

WinMerge--B/W Shading of Printed Copy to Show Differences?

2008-12-16 Thread W. eWatson
Is there a way to highlight differences between the two files when printing in b/w? Help suggests there may be some texturing, but all I see is color choices. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 3

eval() and global variables

2008-12-16 Thread rdmurray
Quoth "=?ISO-8859-1?Q?Juan_Pablo_Romero_M=E9ndez?=" : > Hello, > > Suppose this function is given: > > def f(x,y): > return x+y+k > > Is it possible to somehow assign a value to k without resorting to > making k global? > > I'm thinking something like this: > > eval("f(1,1)", {"f":f, "k":1})

eval() and global variables

2008-12-16 Thread Juan Pablo Romero Méndez
Hello, Suppose this function is given: def f(x,y): return x+y+k Is it possible to somehow assign a value to k without resorting to making k global? I'm thinking something like this: eval("f(1,1)", {"f":f, "k":1}) Or even better, something like: def g(k): return f g(1)(1,1) ==> 3 Rega

Re: Python is slow

2008-12-16 Thread James Mills
On Wed, Dec 17, 2008 at 9:08 AM, r wrote: > What about all the crap you had to go through just to get output? > Python wins Yes I can't say I really enjoy writing C (at all!) _except_ in the case where I may need to optimise some heavy computation. But then again with multi-core CPUs these days a

Re: subprocess returncode windows

2008-12-16 Thread Gabriel Genellina
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 python subprocess.call. I'm using a > python script (runtime 2.6.1 on windows) to a

Re: Python is slow

2008-12-16 Thread r
What about all the crap you had to go through just to get output? Python wins PS. cm_gui try this piece of code >>> print 'hello world'.replace('world', 'idiot') -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is slow

2008-12-16 Thread Stef Mientki
r wrote: On Dec 15, 7:15 am, Luis M. González wrote: On Dec 15, 1:38 am, cm_gui wrote: hahaha, do you know how much money they are spending on hardware to make youtube.com fast??? By the way... I know of a very slow Python site called YouTube.com. In fact, it is so slow that

Re: AIM client code for Python?

2008-12-16 Thread Jason Scheirer
On Dec 16, 9:54 am, Joe Strout wrote: > I'd like to write an AIM bot in Python.  I found and tried > , but it doesn't work for me: > > Connecting... > Traceback (most recent call last): >    File "aimbot-1.py", line 17, in >      bot.go() >    File "/Users/jstrout/Do

Re: Python is slow

2008-12-16 Thread James Mills
n Wed, Dec 17, 2008 at 8:24 AM, r wrote: >> What kind of performance problem have you find in python that makes >> you so unhappy? >> What are you going to do with all the extra speed provided by c++ (a >> Hello World! ?)... > > Still no reply from cm_gui, he must have googled "C hello world" :D

Re: Python is slow

2008-12-16 Thread r
On Dec 15, 7:15 am, Luis M. González wrote: > On Dec 15, 1:38 am, cm_gui wrote: > > > hahaha, do you know how much money they are spending on hardware to > > make > > youtube.com fast??? > > > > By the way... I know of a very slow Python site called YouTube.com. In > > > fact, it is so slow that

Re: Need help improving number guessing game

2008-12-16 Thread D'Arcy J.M. Cain
On Tue, 16 Dec 2008 13:59:24 -0800 Scott David Daniels wrote: >> > def yesno(s): > >s = s.strip().lower() > >if not s in ("y", "n"): You could also do this to be a little more user friendly: if not (s and s[0] in ("y", "n")): Or reverse the test for clarity. -- D'Arcy J.M. Cain

Re: weird dict problem, how can this even happen?

2008-12-16 Thread Scott David Daniels
Joel Hedlund wrote: Duncan Booth wrote: I think you probably are correct. The only thing I can think that might help is if you can catch all the situations where changes to the dependent values might change the hash and wrap them up: before changing the hash pop the item out of the dict, then

Re: mod_python resources

2008-12-16 Thread Aleksandar Radulovic
On Tue, Dec 16, 2008 at 8:22 PM, tmallen wrote: > Are there any good tutorials out there for setting up Apache with > mod_python? Apart from the (clear and concise) information in the mod_python documentation? Starts here: http://www.modpython.org/live/current/doc-html/installation.html Compilin

Re: What does the at sign do?

2008-12-16 Thread Martin v. Löwis
> I'm reading a lot of python code lately, django code to be exact, and > I keep bumping into expressions that look like this > @register.filter > > I see nothing importing @register, so I assume it's not just a > function name. That can't be. register must be a bound name - not necessarily an i

Re: Problem Python 2.6.1 vs 2.6 & pyWin32

2008-12-16 Thread Martin v. Löwis
> Sorry for not being explicit. With "installer" I meant the binary > Windows installer you create with command "python setup.py > bdist_wininst". In the past we've been able to use > "package-version.win32.exe" files created with Python 2.5 on older > version, but that doesn't seem to be case with

Re: What does the at sign do?

2008-12-16 Thread r
Google "python decorators" -- http://mail.python.org/mailman/listinfo/python-list

Re: Need help improving number guessing game

2008-12-16 Thread Scott David Daniels
Bruno Desthuilliers wrote: The generic version of your above code could be: def safeinput(prompt, convert): while True: x = input(prompt) try: x = convert(x) except ValueError, e: print("Bad input : %s" % e) else:

What does the at sign do?

2008-12-16 Thread guruyaya
I'm reading a lot of python code lately, django code to be exact, and I keep bumping into expressions that look like this @register.filter I see nothing importing @register, so I assume it's not just a function name. Yet I cannot figure where this @ sign came from. I hope I'm not just forgetting s

Re: Using Mechanize to Fill Out a Form

2008-12-16 Thread KDawg44
On Dec 16, 3:44 pm, KDawg44 wrote: > Hi, > > I am trying to use the Mechanize module to browse to a site, fill out > a form, and login.  However, it hangs on the opening of the URL.  The > URL is https, will this cause the open from mechanize to fail? > > Thanks. > > Kevin Apparently, the HTTPS d

Re: How to modify a program while it's running?

2008-12-16 Thread Ivan Illarionov
On Dec 16, 11:25 pm, Joe Strout wrote: > Here's my situation: I'm making an AIM bot, but the AIM server will   > get annoyed if you log in too frequently (and then lock you out for a   > while).  So my usual build-a-little, test-a-little methodology doesn't   > work too well. > > So I'd like to re

Re: How to modify a program while it's running?

2008-12-16 Thread Arnaud Delobelle
Joe Strout writes: > Here's my situation: I'm making an AIM bot, but the AIM server will > get annoyed if you log in too frequently (and then lock you out for a > while). So my usual build-a-little, test-a-little methodology doesn't > work too well. > > So I'd like to restructure my app so that

Python-URL! - weekly Python news and links (Dec 16)

2008-12-16 Thread Gabriel Genellina
QOTW: "... Python isn't a major software company - it's better!" - David LeBlanc `timeit` is the right tool to measure execution time of code snippets: http://groups.google.com./group/comp.lang.python/t/9f35d4bde7304ab7/ "Intentionally backward non-compatible" 3.0 is

Re: sorting for recursive folder rename

2008-12-16 Thread ianaré
On Dec 16, 2:00 pm, MRAB wrote: > ianaré wrote: > > Hello all, > > > I trying to recursively rename folders 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, and one to all items may be > > renamed. Here is

Re: Problem Python 2.6.1 vs 2.6 & pyWin32

2008-12-16 Thread Pekka Klärck
2008/12/16 "Martin v. Löwis" : >>> Try installing Python 2.6.1 "for all users". >> >> Could you clarify why that's needed? > > I didn't say it's needed. I said that he should try that, perhaps it > helps. > >> One thing we noticed (I'm not sure has this been yet submitted to >> bugs.python.org yet)

Re: Python is slow

2008-12-16 Thread Craig Allen
On Dec 14, 6:38 pm, cm_gui wrote: > hahaha, do you know how much money they are spending on hardware to > make > youtube.com fast??? > > > By the way... I know of a very slow Python site called YouTube.com. In > > fact, it is so slow that nobody ever uses it. less than they'd spend to implement i

Using Mechanize to Fill Out a Form

2008-12-16 Thread KDawg44
Hi, I am trying to use the Mechanize module to browse to a site, fill out a form, and login. However, it hangs on the opening of the URL. The URL is https, will this cause the open from mechanize to fail? Thanks. Kevin -- http://mail.python.org/mailman/listinfo/python-list

Re: How to modify a program while it's running?

2008-12-16 Thread Craig Allen
On Dec 16, 10:25 am, Joe Strout wrote: > Here's my situation: I'm making an AIM bot, but the AIM server will > get annoyed if you log in too frequently (and then lock you out for a > while). So my usual build-a-little, test-a-little methodology doesn't > work too well. > > So I'd like to restruct

Re: Can anyone suggest a good HTTP/1.1 web client?

2008-12-16 Thread Jean-Paul Calderone
On Tue, 16 Dec 2008 12:18:17 -0800 (PST), Kottiyath wrote: Hi all, I have to connect to a secure website every second to get the data and then post to it. I have been investigating on many web clients in python, but nothing fits the bill properly. The ones I tried implementing are: 1.

Re: Memory leak when using a C++ module for Python

2008-12-16 Thread Ivan Illarionov
On Dec 11, 8:35 pm, Jaume Bonet wrote: >         //Here we take the info coming from python and transform it > into a vector (will allow us to work with numbers instead of >         // strings) and shareInt which is an array of sets (form > std::set) >         vector translator = string2int > (sh

How to modify a program while it's running?

2008-12-16 Thread Joe Strout
Here's my situation: I'm making an AIM bot, but the AIM server will get annoyed if you log in too frequently (and then lock you out for a while). So my usual build-a-little, test-a-little methodology doesn't work too well. So I'd like to restructure my app so that it can stay running and s

mod_python resources

2008-12-16 Thread tmallen
I'm trying again because I'm stubborn. Maybe the fourth time will be the charm... Are there any good tutorials out there for setting up Apache with mod_python? Thanks, Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.maxint in Python 2.6.1 (amd64) on Windows XP x64

2008-12-16 Thread Christian Heimes
Lin schrieb: > Ah, this makes sense. Thanks.. The main reason I'm trying 64-bit > Python is that I want to write files bigger than 4GB. This should work > on Windows x64, right? (i.e., are the pointers bona fide 64 bit?) You can create files with more than 4GB on a 32bit OS, too. It depends on

Can anyone suggest a good HTTP/1.1 web client?

2008-12-16 Thread Kottiyath
Hi all, I have to connect to a secure website every second to get the data and then post to it. I have been investigating on many web clients in python, but nothing fits the bill properly. The ones I tried implementing are: 1. httplib based - I created myself. (I cannot use urllib2 sinc

Re: subprocess.Popen inheriting

2008-12-16 Thread Aaron Brady
On Dec 16, 4:15 am, "Gabriel Genellina" wrote: > En Tue, 16 Dec 2008 07:29:19 -0200, Aaron Brady   > escribió: > > > I have a file handle I want to inherit in a child process.  I am > > looking at '_make_inheritable' in 'Popen', but it needs an instance, > > and by the time I have one, the subpro

Re: Where is a good open source python project to be used as example?

2008-12-16 Thread D'Arcy J.M. Cain
On Tue, 16 Dec 2008 20:03:21 GMT Andrea Francia wrote: > >> Did you know where are such projects? > > > > http://www.PyGreSQL.org/. > > > > Thanks! But I can't find any unit test in the code. Look again. They are in the files named TEST_PyGreSQL_classic.py and TEST_PyGreSQL_dbapi20.py. -- D

Re: Where is a good open source python project to be used as example?

2008-12-16 Thread Andrea Francia
D'Arcy J.M. Cain wrote: On Tue, 16 Dec 2008 19:13:00 GMT Andrea Francia wrote: I'm looking for a python project to use as example to learning python. The project should have these features: 1. is almost fully unit tested 2. use consistently the code convention recommended by PEP 8

Re: Free place to host python files?

2008-12-16 Thread Mr . SpOOn
2008/12/16 feba : > Stuff like code.google, sf.net, are more oriented towards serious > development, not just holding random apps, aren't they? > > Anyway, I found MediaFire, which looks like it will suffice for now. Take a look to Dropbox (http://www.getdropbox.com/). You can use it to directly

Re: Generator slower than iterator?

2008-12-16 Thread Arnaud Delobelle
Arnaud Delobelle writes: > match_total = dict((key, val()) for key, val in match_counter.iteritems()) Sorry I meant match_total = dict((key, val.next()) for key, val in match_counter.iteritems()) -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Where is a good open source python project to be used as example?

2008-12-16 Thread D'Arcy J.M. Cain
On Tue, 16 Dec 2008 19:13:00 GMT Andrea Francia wrote: > I'm looking for a python project to use as example to learning python. > > The project should have these features: > > 1. is almost fully unit tested > 2. use consistently the code convention recommended by PEP 8 > 3. it's elem

Re: sys.maxint in Python 2.6.1 (amd64) on Windows XP x64

2008-12-16 Thread Lin
> > > I installed the amd64 version of Python 2.6.1 on my Windows XP x64 > > system. I was expecting sys.maxint to be 9223372036854775807 (or 2 ^63 > > -1), but instead I got 2147483647 (i.e., 2^31-1) just like what I got > > from a 32-bit version of Python. Is this by design or does it indicate >

Re: subprocess returncode windows

2008-12-16 Thread Andrew
On Dec 16, 12:50 pm, Christian Heimes wrote: > Andrew schrieb: > > > > > Hello, > > > I'm running into a strange situation with getting incorrect > > returncodes / exit status from python subprocess.call. I'm using a > > python script (runtime 2.6.1 on windows) to automate the deploy of > > java a

executables no longer executing on PC's without Python installed

2008-12-16 Thread jefm
Hi, I recently figured out a problem that came up with the latest versions of Python and cx_Freeze. I thought I post it here so that it might be usefull to someone. The problem was that, when I switched to Python 2.6.x and cx_Freeze-4.0.1.win32-py2.6.msi, the executables that were produced ran per

Where is a good open source python project to be used as example?

2008-12-16 Thread Andrea Francia
I'm looking for a python project to use as example to learning python. The project should have these features: 1. is almost fully unit tested 2. use consistently the code convention recommended by PEP 8 3. it's elements are almost fully documented Extra point features are: 4. build

Re: Memory leak when using a C++ module for Python

2008-12-16 Thread Jaume Bonet
When I tried the C++ function with a C++ main() (skipping the Python part) it didn't show any memory problem, but I'll re-check it anyway, thanks... On Dec 16, 9:16 am, "Gabriel Genellina" wrote: > En Thu, 11 Dec 2008 15:35:58 -0200, Jaume Bonet   > escribió: > > > This is the function that is v

Re: sorting for recursive folder rename

2008-12-16 Thread MRAB
ianaré wrote: Hello all, I trying to recursively rename folders 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, and one to all items may be renamed. Here is some preliminary code I have, but which does not work

Re: subprocess returncode windows

2008-12-16 Thread Christian Heimes
Andrew schrieb: > Hello, > > I'm running into a strange situation with getting incorrect > returncodes / exit status from python subprocess.call. I'm using a > python script (runtime 2.6.1 on windows) to automate the deploy of > java applications to glassfish application server. Below is an exampl

Re: sys.maxint in Python 2.6.1 (amd64) on Windows XP x64

2008-12-16 Thread Christian Heimes
Lin schrieb: > Hi, > > I installed the amd64 version of Python 2.6.1 on my Windows XP x64 > system. I was expecting sys.maxint to be 9223372036854775807 (or 2 ^63 > -1), but instead I got 2147483647 (i.e., 2^31-1) just like what I got > from a 32-bit version of Python. Is this by design or does it

Re: Does Python3 offer a FrozenDict?

2008-12-16 Thread bearophileHUGS
Paul Moore: > Moral - don't assume that all code needs to be rewritten for Python > 3.0 :-) In practice this time your moral is of little use: having a place that allows you to choose Py3 OR Py2 code is much better and tidier, helps you save time, helps you avoid wasting some time, etc. Bye, bear

Re: Python Dictionary Algorithm Question

2008-12-16 Thread Steve Holden
Brigette Hodson wrote: > Hello! I am in a beginning algorithms class this semester and I am > working on a presentation. I want to discuss in some detail the > algorithm python uses to determine the hash function for python > dictionaries. Does anyone know what this algorithm is? Or where I can go

sys.maxint in Python 2.6.1 (amd64) on Windows XP x64

2008-12-16 Thread Lin
Hi, I installed the amd64 version of Python 2.6.1 on my Windows XP x64 system. I was expecting sys.maxint to be 9223372036854775807 (or 2 ^63 -1), but instead I got 2147483647 (i.e., 2^31-1) just like what I got from a 32-bit version of Python. Is this by design or does it indicate a bug or an ins

Re: ethical questions about global variables

2008-12-16 Thread Giampaolo Rodola'
On 16 Dic, 18:01, ianaré wrote: > For anything more complicated than a simple script, I find it easier > to use some sort of config object. This could be a simple dictionnary > type class, where the values can be set/retrieved by the other classes > directly, or a more elaborate class including fu

subprocess returncode windows

2008-12-16 Thread Andrew
Hello, I'm running into a strange situation with getting incorrect returncodes / exit status from python subprocess.call. I'm using a python script (runtime 2.6.1 on windows) to automate the deploy of java applications to glassfish application server. Below is an example of using a subprocess call

sorting for recursive folder rename

2008-12-16 Thread ianaré
Hello all, I trying to recursively rename folders 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, and one to all items may be renamed. Here is some preliminary code I have, but which does not work very well. self

Re: Python Dictionary Algorithm Question

2008-12-16 Thread Scott MacDonald
You might be interested in the "Beautiful Code" book: http://oreilly.com/catalog/9780596510046/ It has a chapter on Python's dict implementation that is pretty good. On Tue, Dec 16, 2008 at 10:51 AM, Brigette Hodson wrote: > Hello! I am in a beginning algorithms class this semester and I am work

Re: Generator slower than iterator?

2008-12-16 Thread Arnaud Delobelle
bearophileh...@lycos.com writes: > This can be a little faster still: > > match_counter = defaultdict(int) > for line in fileinput.input(sys.argv[1:]): > ip = line.split(None, 1)[0] > match_counter[ip] += 1 > > Bye, > bearophile Or maybe (untested): match_counter = defaultdict(int) for l

Re: AIM client code for Python?

2008-12-16 Thread Jean-Paul Calderone
On Tue, 16 Dec 2008 10:54:38 -0700, Joe Strout wrote: I'd like to write an AIM bot in Python. I found and tried , but it doesn't work for me: Connecting... Traceback (most recent call last): File "aimbot-1.py", line 17, in bot.go() File "/Users/jstrout/Do

Re: Python Dictionary Algorithm Question

2008-12-16 Thread Christian Heimes
Brigette Hodson schrieb: > Hello! I am in a beginning algorithms class this semester and I am working > on a presentation. I want to discuss in some detail the algorithm python > uses to determine the hash function for python dictionaries. Does anyone > know what this algorithm is? Or where I can g

Re: Does Python3 offer a FrozenDict?

2008-12-16 Thread Paul Moore
On 16 Dec, 17:28, bearophileh...@lycos.com wrote: > Johannes Bauer: > > > is there anything like a frozen dict in Python3, so I could do a > > foo = { FrozenDict({"a" : "b"}): 3 } > > You can adapt this code to Python3 (and post a new recipe? It may be > positive to create a new section of the Cook

AIM client code for Python?

2008-12-16 Thread Joe Strout
I'd like to write an AIM bot in Python. I found and tried , but it doesn't work for me: Connecting... Traceback (most recent call last): File "aimbot-1.py", line 17, in bot.go() File "/Users/jstrout/Documents/Python-Dev/AIMbot/toc.py", line 62, in go

Re: Generator slower than iterator?

2008-12-16 Thread Federico Moreira
2008/12/16 > Python 3.0 does not support has_key, it's time to get used to not using it > :) > Good to know line.split(None, 1)[0] really speeds up the proccess Thanks again. -- http://mail.python.org/mailman/listinfo/python-list

Python Dictionary Algorithm Question

2008-12-16 Thread Brigette Hodson
Hello! I am in a beginning algorithms class this semester and I am working on a presentation. I want to discuss in some detail the algorithm python uses to determine the hash function for python dictionaries. Does anyone know what this algorithm is? Or where I can go to find information on it? Tha

Re: help I'm getting delimited

2008-12-16 Thread MRAB
Paul Watson wrote: On Tue, 2008-12-16 at 08:26 -0800, aka wrote: Hi, I'm going nuts over the csv.reader and UnicodeReader class. Somehow I can't get this method working which is supposed to read a csv file which name is inputted but here now hardcoded. What I need for now is that the string vers

Re: Free place to host python files?

2008-12-16 Thread feba
Stuff like code.google, sf.net, are more oriented towards serious development, not just holding random apps, aren't they? Anyway, I found MediaFire, which looks like it will suffice for now. -- http://mail.python.org/mailman/listinfo/python-list

Re: Free place to host python files?

2008-12-16 Thread mudzot
> well, ignoring the fact that pastebin doesn't work for me for some > reason, I'm talking about hosting it as a .py downloadable, not a hunk > of text. maybe one option is registering in some free project hosting service like code.google.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Free place to host python files?

2008-12-16 Thread Giampaolo Rodola'
On 16 Dic, 15:56, feba wrote: > On Dec 16, 8:29 am, s...@pobox.com wrote: > > >     feba> I'm getting started in python, and it would be helpful to have a > >     feba> place to put up various code snippets I've made, so I don't have > >     feba> to send them individually to each person I want to

Re: Generator slower than iterator?

2008-12-16 Thread rdmurray
Quoth Lie Ryan : > On Tue, 16 Dec 2008 12:07:14 -0300, Federico Moreira wrote: > > > Hi all, > > > > Im parsing a 4.1GB apache log to have stats about how many times an ip > > request something from the server. > > > > The first design of the algorithm was > > > > for line in fileinput.input(sy

Re: Does Python3 offer a FrozenDict?

2008-12-16 Thread bearophileHUGS
Johannes Bauer: > is there anything like a frozen dict in Python3, so I could do a > foo = { FrozenDict({"a" : "b"}): 3 } You can adapt this code to Python3 (and post a new recipe? It may be positive to create a new section of the Cookbook for Py3 only): http://code.activestate.com/recipes/414283/

Re: tricky nested list unpacking problem

2008-12-16 Thread Steve Holden
Chris Rebert wrote: > On Mon, Dec 15, 2008 at 11:06 AM, Reckoner wrote: >> Hi, >> >> I have lists of the following type: >> >> [1,2,3,[5,6]] >> >> and I want to produce the following strings from this as >> >> '0-1-2-3-5' >> '0-1-2-3-6' >> >> That was easy enough. The problem is that these can be

Re: Python plugin for Netbeans

2008-12-16 Thread ianaré
On Dec 15, 3:23 pm, a wrote: > Netbeans added a python plugin to its plugin repository. > Do you tried it? What do you think about this plugin? If you like netbeans already it's great to finally have python officially supported. I find netbeans to be easier to use than eclipse. -- http://mail.pyt

  1   2   >