[ANNOUNCE] Pygtksourceview 2.6.0

2009-03-22 Thread Gian Mario Tagliaretti
I am pleased to announce version 2.6.0 of the Gtksourceview Python bindings. Once the mirrors have sync correctly it will be available at: http://ftp.gnome.org/pub/GNOME/sources/pygtksourceview/2.6/ The bindings are updated with the new Gtksourceview API News in 2.6.0 = o new

circuits 1.1 - a Lightweight, Event driven Framework with a strong Component Architecture.

2009-03-22 Thread James Mills
Hi, I'm pleased to announce the 1.1 release of circuits: http://trac.softcircuit.com.au/circuits/ == About == circuits is a Lightweight, Event driven Framework with a strong Component Architecture. == Quick Examples == === Hello World! === {{{ #!python from circuits import Event, Component

Re: pyconfig on 64-bit machines with distutils vs 32-bit legacy code

2009-03-22 Thread Martin v. Löwis
/data/home/nwagner/local/lib/python2.5/pyport.h:734:2: #error LONG_BIT definition appears wrong for platform (bad gcc/glibc config?). Can anyone offer any advice as to what I might be missing or misunderstanding? You need to understand where the error comes from: 1. what is the *actual*

Re: Async serial communication/threads sharing data

2009-03-22 Thread Hendrik van Rooyen
Nick Timkovich prom@gmail.com wrote: I've been working on a program that will talk to an embedded device over the serial port, using some basic binary communications with messages 4-10 bytes long or so. Most of the nuts and bolts problems I've been able to solve, and have learned a

Re: [regex] How to check for non-space character?

2009-03-22 Thread Gilles Ganault
On Sat, 21 Mar 2009 08:53:10 -0500, Tim Chase python.l...@tim.thechases.com wrote: It looks like it's these periods that are throwing you off. Just remove them. For a 3rd syntax: (\S)(\d{5}) the \S (capital, instead of \s) is any NON-white-space character Thanks guys for the tips. --

Re: default shelve on linux corrupts, does different DB system help?

2009-03-22 Thread Paul Sijben
Thanks very much for a clear and concise explanation of the problem and the solution! I am implementing it now in my system. Luckily we caught this one during testing so no important data has been lost. Unfortunately windows does not seem to support gdbm. But in our case, everything that is on

Re: [ANN] lxml 2.2 released

2009-03-22 Thread Francesco Guerrieri
On Sat, Mar 21, 2009 at 5:22 PM, Stefan Behnel stefan...@behnel.de wrote: Hi all, I'm proud to announce the release of lxml 2.2 final. http://codespeak.net/lxml/ http://pypi.python.org/pypi/lxml/2.2 Changelog: http://codespeak.net/lxml/changes-2.2.html Great news! I have relied on lxml

Re: simplejson: alternate encoder not called enought

2009-03-22 Thread Chris Rebert
On Sat, Mar 21, 2009 at 2:11 PM, Pierre Hanser han...@club-internet.fr wrote: hello I'm trying to use simplejson to encode some python objects using simplejson dumps method. The dumps method accept a cls parameter to specify an alternate encoder. But it seems that this alternate encoder is

Re: Async serial communication/threads sharing data

2009-03-22 Thread Nick Timkovich
On Mar 21, 9:19 pm, Jean-Paul Calderone exar...@divmod.com wrote: On Sat, 21 Mar 2009 13:52:21 -0700 (PDT), Nick Timkovich prometheus...@gmail.com wrote: I've been working on a program that will talk to an embedded device over the serial port, using some basic binary communications with

Re: Safe to call Py_Initialize() frequently?

2009-03-22 Thread Graham Dumpleton
On Mar 21, 2:35 pm, roschler robert.osch...@gmail.com wrote: On Mar 20, 7:27 pm, Mark Hammond skippy.hamm...@gmail.com wrote: On 21/03/2009 4:20 AM, roschler wrote: Calling Py_Initialize() multiple times has no effect.  Calling Py_Initialize and Py_Finalize multiple times does leak

Re: __init__ vs. __del__

2009-03-22 Thread David Stanek
2009/3/21 Randy Turner rtms...@yahoo.com: There are a number of use-cases for object cleanup that are not covered by a generic garbage collector... For instance, if an object is caching data that needs to be flushed to some persistent resource, then the GC has no idea about this. It seems

Re: script files with python (instead of tcsh/bash)?

2009-03-22 Thread Nick Craig-Wood
Esmail ebo...@hotmail.com wrote: I am wondering if anyone is using python to write script files? Yes! Right now I have a bigg'ish bash/tcsh script that contain some grep/awk command plus various files are processed and created, renamed and moved to specific directories. I also write out

Generator

2009-03-22 Thread mattia
Can you explain me this behaviour: s = [1,2,3,4,5] g = (x for x in s) next(g) 1 s [1, 2, 3, 4, 5] del s[0] s [2, 3, 4, 5] next(g) 3 Why next(g) doesn't give me 2? -- http://mail.python.org/mailman/listinfo/python-list

Re: Async serial communication/threads sharing data

2009-03-22 Thread Jean-Paul Calderone
On Sun, 22 Mar 2009 03:13:36 -0700 (PDT), Nick Timkovich prometheus...@gmail.com wrote: On Mar 21, 9:19 pm, Jean-Paul Calderone exar...@divmod.com wrote: On Sat, 21 Mar 2009 13:52:21 -0700 (PDT), Nick Timkovich prometheus...@gmail.com wrote: I've been working on a program that will talk to an

Re: script files with python (instead of tcsh/bash)?

2009-03-22 Thread Esmail
Nick Craig-Wood wrote: Esmail ebo...@hotmail.com wrote: I am wondering if anyone is using python to write script files? Yes! .. Almost any script that contains a loop I convert into python. In any case, the scripts are starting to look pretty hairy and I was wondering if it would

Re: Generator

2009-03-22 Thread MRAB
mattia wrote: Can you explain me this behaviour: s = [1,2,3,4,5] g = (x for x in s) next(g) 1 s [1, 2, 3, 4, 5] del s[0] s [2, 3, 4, 5] next(g) 3 Why next(g) doesn't give me 2? First it yields s[0] (which is 1), then you delete s[1], then it yields s[1] (which is now 3). It doesn't

Re: script files with python (instead of tcsh/bash)?

2009-03-22 Thread MRAB
Esmail wrote: Nick Craig-Wood wrote: Esmail ebo...@hotmail.com wrote: I am wondering if anyone is using python to write script files? Yes! .. Almost any script that contains a loop I convert into python. In any case, the scripts are starting to look pretty hairy and I was wondering

Re: default shelve on linux corrupts, does different DB system help?

2009-03-22 Thread skip
Paul Unfortunately windows does not seem to support gdbm. That is a known issue, but one that can be solved I think by getting rid of the old 1.85 version of BerkDB and using something more modern. I believe the current bsddb module in recent Python versions supports BerkDB 3.x and 4.x.

Using python 3 for scripting?

2009-03-22 Thread Timo Myyrä
Hi, I'll have to do some scripting in the near future and I was thinking on using the Python for it. I would like to know which version of Python to use? Is the Python 3 ready for use or should I stick with older releases? Timo -- http://mail.python.org/mailman/listinfo/python-list

Re: garbage collection / cyclic references

2009-03-22 Thread Aaron Brady
On Mar 21, 11:59 am, andrew cooke and...@acooke.org wrote: Aaron Brady wrote: My point is, that garbage collection is able to detect when there are no program-reachable references to an object.  Why not notify the programmer (the programmer's objects) when that happens?  If the object

Re: Tkinter book on current versions

2009-03-22 Thread Mike Driscoll
Hi, On Fri, Mar 20, 2009 at 10:14 PM, Paul Watson paul.hermeneu...@gmail.com wrote: Has anyone tried the Grayson book, Python and Tkinter Programming, with a recent version of Python? The first example code (calculator) generates a single row of buttons. Perhaps I have not applied the errata

How Get Name Of Working File

2009-03-22 Thread Victor Subervi
Hi; If I am writing a script that generates HTML, how do I grab the name of the actual file in which I am working? For example, let us say I am working in test.py. I can have the following code: import os dir = os.getcwd() and that will give me the working dir. But what about test.py? TIA,

Re: How Get Name Of Working File

2009-03-22 Thread Christian Heimes
Victor Subervi schrieb: Hi; If I am writing a script that generates HTML, how do I grab the name of the actual file in which I am working? For example, let us say I am working in test.py. I can have the following code: import os dir = os.getcwd() and that will give me the working dir.

Script for a project inside own directory

2009-03-22 Thread Filip Gruszczyński
I am having a project built like this: project module1.py module2.py packages1/ module3.py etc. I have script that uses objects from those modules/packages. If I keep this script inside project directory it's ok and it works. But I would like to move it to own scripts directory

Re: Script for a project inside own directory

2009-03-22 Thread Maxim Khitrov
2009/3/22 Filip Gruszczyński grusz...@gmail.com: I am having a project built like this: project   module1.py   module2.py   packages1/     module3.py etc. I have script that uses objects from those modules/packages. If I keep this script inside project directory it's ok and it works.

Re: How Get Name Of Working File

2009-03-22 Thread Maxim Khitrov
On Sun, Mar 22, 2009 at 10:58 AM, Christian Heimes li...@cheimes.de wrote: Victor Subervi schrieb: Hi; If I am writing a script that generates HTML, how do I grab the name of the actual file in which I am working? For example, let us say I am working in test.py. I can have the following code:

3.0 - bsddb removed

2009-03-22 Thread Sean
Anyone got any thoughts about what to use as a replacement. I need something (like bsddb) which uses dictionary syntax to read and write an underlying (fast!) btree or similar. Thanks. Sean -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python 3 for scripting?

2009-03-22 Thread mahesh
python 2.5 is prefered; On Mar 22, 7:22 pm, timo.my...@gmail.com (Timo Myyrä) wrote: Hi, I'll have to do some scripting in the near future and I was thinking on using the Python for it. I would like to know which version of Python to use? Is the Python 3 ready for use or should I stick

Re: 3.0 - bsddb removed

2009-03-22 Thread Albert Hopkins
On Sun, 2009-03-22 at 15:55 +, Sean wrote: Anyone got any thoughts about what to use as a replacement. I need something (like bsddb) which uses dictionary syntax to read and write an underlying (fast!) btree or similar. gdbm -- http://mail.python.org/mailman/listinfo/python-list

Script for a project inside own directory

2009-03-22 Thread R. David Murray
=?UTF-8?Q?Filip_Gruszczy=C5=84ski?= grusz...@gmail.com wrote: I am having a project built like this: project module1.py module2.py packages1/ module3.py etc. I have script that uses objects from those modules/packages. If I keep this script inside project directory

Re: 3.0 - bsddb removed

2009-03-22 Thread Benjamin Peterson
Sean seandc at att.net writes: Anyone got any thoughts about what to use as a replacement. I need something (like bsddb) which uses dictionary syntax to read and write an underlying (fast!) btree or similar. pybsddb is just not included in the core. It's still distributed separately.

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread Gabriel Genellina
En Sat, 21 Mar 2009 23:58:07 -0300, lamber...@corning.com escribió: ''' A python 3 question. Presume this code is in file p.py. The program fails. $ python3 p.py ... ValueError: I/O operation on closed file. Removing the comment character to increase

Re: Lambda forms and scoping

2009-03-22 Thread Gabriel Genellina
En Fri, 20 Mar 2009 23:16:00 -0300, alex goretoy aleksandr.gore...@gmail.com escribió: i looks at lambdas as unbound functions(or super function), in the case above we create the functions in a list places it in memory unboud, once binding a call to the memory address space it returns the value

Re: Script for a project inside own directory

2009-03-22 Thread Benjamin Peterson
Filip Gruszczyński gruszczy at gmail.com writes: I would like to ask if there is any workaround? Use the runpy module. -- http://mail.python.org/mailman/listinfo/python-list

Using python 3 for scripting?

2009-03-22 Thread R. David Murray
timo.my...@gmail.com (Timo =?utf-8?Q?Myyr=C3=A4?=) wrote: Hi, I'll have to do some scripting in the near future and I was thinking on using the Python for it. I would like to know which version of Python to use? Is the Python 3 ready for use or should I stick with older releases? If you

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread Benjamin Peterson
lambertdw at corning.com writes: Please, what is a better way to write the class with regard to this issue? Set the original TextIOWrapper's buffer to None. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python 3 for scripting?

2009-03-22 Thread Chris Rebert
2009/3/22 Timo Myyrä timo.my...@gmail.com: Hi, I'll have to do some scripting in the near future and I was thinking on using the Python for it. I would like to know which version of Python to use? Is the Python 3 ready for use or should I stick with older releases? 2.6.1, the latest

Re: script files with python (instead of tcsh/bash)?

2009-03-22 Thread Gabriel Genellina
En Sun, 22 Mar 2009 11:05:22 -0300, MRAB goo...@mrabarnett.plus.com escribió: Esmail wrote: Nick Craig-Wood wrote: Esmail ebo...@hotmail.com wrote: I am wondering if anyone is using python to write script files? Two quick questions: As a replacement for grep I would use the re module

regular expressions, stack and nesting

2009-03-22 Thread Aaron Brady
Hi, Every so often the group gets a request for parsing an expression. I think it would be significantly easier to do if regular expressions could modify a stack. However, since you might nearly as well write Python, maybe there is a compromise. Could the Secret Labs' regular expression engine

Re: Script for a project inside own directory

2009-03-22 Thread Filip Gruszczyński
Works great. Thanks a lot. 2009/3/22 Maxim Khitrov mkhit...@gmail.com: 2009/3/22 Filip Gruszczyński grusz...@gmail.com: I am having a project built like this: project   module1.py   module2.py   packages1/     module3.py etc. I have script that uses objects from those

Generator

2009-03-22 Thread R. David Murray
mattia ger...@gmail.com wrote: Can you explain me this behaviour: s = [1,2,3,4,5] g = (x for x in s) next(g) 1 s [1, 2, 3, 4, 5] del s[0] s [2, 3, 4, 5] next(g) 3 Why next(g) doesn't give me 2? Think of it this way: the generator is exactly equivalent to the following

Re: Using python 3 for scripting?

2009-03-22 Thread Timo Myyrä
Ok, I think I'll stick with the 2.6 then. I recall it gave warnings about things that are deprecated in 3.0 so it will make porting the scripts to 3.0 easier. I might try 3.0 once I know what kind of scripts are needed. -- http://mail.python.org/mailman/listinfo/python-list

Re: Rough draft: Proposed format specifier for a thousands separator

2009-03-22 Thread rzed
Raymond Hettinger pyt...@rcn.com wrote in news:e35271b9-7623-4845-bcb9-d8c33971f...@w24g2000prd.googlegroups.c om: If anyone here is interested, here is a proposal I posted on the python-ideas list. The idea is to make numbering formatting a little easier with the new format() builtin in

Re: regular expressions, stack and nesting

2009-03-22 Thread Chris Rebert
2009/3/22 Aaron Brady castiro...@gmail.com: Hi, Every so often the group gets a request for parsing an expression.  I think it would be significantly easier to do if regular expressions could modify a stack.  However, since you might nearly as well write Python, maybe there is a compromise.

Re: RSS feed issues, or how to read each item exactly once

2009-03-22 Thread Gabriel Genellina
En Sat, 21 Mar 2009 17:12:45 -0300, John Nagle na...@animats.com escribió: I've been using the feedparser module, and it turns out that some RSS feeds don't quite do RSS right. [...] It's something that feedparser should perhaps do. Better to ask the author than post here, I think. And

Re: 3.0 - bsddb removed

2009-03-22 Thread Nick Craig-Wood
Sean sea...@att.net wrote: Anyone got any thoughts about what to use as a replacement. I need something (like bsddb) which uses dictionary syntax to read and write an underlying (fast!) btree or similar. sqlite. bsddb gave me no end of trouble with threads, but sqlite worked

Re: script files with python (instead of tcsh/bash)?

2009-03-22 Thread Nick Craig-Wood
Esmail ebo...@hotmail.com wrote: thanks for including the script, that really helps. Nice way of finding files. Python has lots of useful stuff like that! Two quick questions: As a replacement for grep I would use the re module and its methods? The re module works on strings not

Re: Async serial communication/threads sharing data

2009-03-22 Thread Nick Craig-Wood
Jean-Paul Calderone exar...@divmod.com wrote: It's true that the serial port support in Twisted isn't the most used feature. :) These days, serial ports are on the way out, I think. That said, much of the way a serial port is used in Twisted is the same as the way a TCP connection is

Re: regular expressions, stack and nesting

2009-03-22 Thread Aaron Brady
On Mar 22, 12:18 pm, Chris Rebert c...@rebertia.com wrote: 2009/3/22 Aaron Brady castiro...@gmail.com: Hi, Every so often the group gets a request for parsing an expression.  I think it would be significantly easier to do if regular expressions could modify a stack.  However, since you

Re: python php/html file upload issue

2009-03-22 Thread Gabriel Genellina
En Sat, 21 Mar 2009 11:47:36 -0300, S.Selvam Siva s.selvams...@gmail.com escribió: I want to upload a file from python to php/html form using urllib2,and my code is below See the Python Cookbook: http://code.activestate.com/recipes/langs/python/ -- Gabriel Genellina --

Re: Using python 3 for scripting?

2009-03-22 Thread andrew cooke
mahesh wrote: python 2.5 is prefered; no it is not. andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python 3 for scripting?

2009-03-22 Thread R. David Murray
timo.my...@gmail.com (Timo =?utf-8?Q?Myyr=C3=A4?=) wrote: Ok, I think I'll stick with the 2.6 then. I recall it gave warnings about things that are deprecated in 3.0 so it will make porting the scripts to 3.0 easier. I might try 3.0 once I know what kind of scripts are needed. In case

loading program's global variables in ipython

2009-03-22 Thread per
hi all, i have a file that declares some global variables, e.g. myglobal1 = 'string' myglobal2 = 5 and then some functions. i run it using ipython as follows: [1] %run myfile.py i notice then that myglobal1 and myglobal2 are not imported into python's interactive namespace. i'd like them too

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread R. David Murray
Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Sat, 21 Mar 2009 23:58:07 -0300, lamber...@corning.com escribió: import re import io class file(io.TextIOWrapper): ''' Enhance TextIO. Streams have many sources, a file name is insufficient. '''

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread Scott David Daniels
lamber...@corning.com wrote: ... Removing the comment character to increase the stream reference count fixes the program, at the expense of an extra TextIOWrapper object. But you do create that extra TextIOWrapper, so there should be no crying about its existence. If you rely on the

Re: pyconfig on 64-bit machines with distutils vs 32-bit legacy code

2009-03-22 Thread Rob Clewley
Thanks for replying, Martin. I got my colleague (Nils) to run exactly the gcc call you described in your post (see below for what he ran) but it only returns the following: /home/nwagner/svn/PyDSTool/PyDSTool/tests/dopri853_temp/dop853_HHnet_vf_wrap.c:124:20: error: Python.h: Datei oder

Re: pyconfig on 64-bit machines with distutils vs 32-bit legacy code

2009-03-22 Thread Martin v. Löwis
Rob Clewley wrote: I got my colleague (Nils) to run exactly the gcc call you described in your post (see below for what he ran) but it only returns the following: Sehr seltsam. Welche gcc-Version ist das denn? (gcc -v)

Re: Using python 3 for scripting?

2009-03-22 Thread Timo Myyrä
I might get summer job in doing some 2nd tier support and doing some scripting besides that in Solaris environment. I gotta see what kind of scripts are needed but I'd guess the 2.6 would be the safest option. Timo -- http://mail.python.org/mailman/listinfo/python-list

Re: loading program's global variables in ipython

2009-03-22 Thread Peter Otten
per wrote: i have a file that declares some global variables, e.g. myglobal1 = 'string' myglobal2 = 5 These aren't declarations, this is exectutable code. and then some functions. i run it using ipython as follows: [1] %run myfile.py i notice then that myglobal1 and myglobal2 are

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread Gabriel Genellina
En Sun, 22 Mar 2009 15:11:37 -0300, R. David Murray rdmur...@bitdance.com escribió: Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Sat, 21 Mar 2009 23:58:07 -0300, lamber...@corning.com escribió: class file(io.TextIOWrapper): ''' Enhance TextIO. Streams have many sources,

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread Benjamin Peterson
Gabriel Genellina gagsl-py2 at yahoo.com.ar writes: There is another alternative that relies on undocumented behaviour: use open to create a *binary* file and wrap the resulting BufferedReader object in your own TextIOWrapper. How is that undocumented behavior? TextIOWrapper can wrap any

what features would you like to see in 2to3?

2009-03-22 Thread Benjamin Peterson
It's GSoC time again, and I've had lots of interested students asking about doing on project on improving 2to3. What kinds of improvements and features would you like to see in it which student programmers could accomplish? -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda forms and scoping

2009-03-22 Thread R. David Murray
Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Fri, 20 Mar 2009 23:16:00 -0300, alex goretoy aleksandr.gore...@gmail.com escribió: i looks at lambdas as unbound functions(or super function), in the case above we create the functions in a list places it in memory unboud, once binding

Re: Generator

2009-03-22 Thread mattia
Il Sun, 22 Mar 2009 16:52:02 +, R. David Murray ha scritto: mattia ger...@gmail.com wrote: Can you explain me this behaviour: s = [1,2,3,4,5] g = (x for x in s) next(g) 1 s [1, 2, 3, 4, 5] del s[0] s [2, 3, 4, 5] next(g) 3 Why next(g) doesn't give me 2? Think of

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread R. David Murray
Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Sun, 22 Mar 2009 15:11:37 -0300, R. David Murray rdmur...@bitdance.com escribió: Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Sat, 21 Mar 2009 23:58:07 -0300, lamber...@corning.com escribió: class file(io.TextIOWrapper):

loading program's global variables in ipython

2009-03-22 Thread R. David Murray
per perfr...@gmail.com wrote: hi all, i have a file that declares some global variables, e.g. myglobal1 = 'string' myglobal2 = 5 and then some functions. i run it using ipython as follows: [1] %run myfile.py i notice then that myglobal1 and myglobal2 are not imported into

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread Gabriel Genellina
En Sun, 22 Mar 2009 16:37:31 -0300, Benjamin Peterson benja...@python.org escribió: Gabriel Genellina gagsl-py2 at yahoo.com.ar writes: There is another alternative that relies on undocumented behaviour: use open to create a *binary* file and wrap the resulting BufferedReader object in your

Re: what features would you like to see in 2to3?

2009-03-22 Thread Daniel Fetchinson
It's GSoC time again, and I've had lots of interested students asking about doing on project on improving 2to3. What kinds of improvements and features would you like to see in it which student programmers could accomplish? Last time I used 2to3 (maybe not the latest version) it didn't know

Re: Generator

2009-03-22 Thread R. David Murray
mattia ger...@gmail.com wrote: Il Sun, 22 Mar 2009 16:52:02 +, R. David Murray ha scritto: mattia ger...@gmail.com wrote: Can you explain me this behaviour: s = [1,2,3,4,5] g = (x for x in s) next(g) 1 s [1, 2, 3, 4, 5] del s[0] s [2, 3, 4, 5] next(g) 3

Re: what features would you like to see in 2to3?

2009-03-22 Thread Benjamin Kaplan
On Sun, Mar 22, 2009 at 4:49 PM, Daniel Fetchinson fetchin...@googlemail.com wrote: It's GSoC time again, and I've had lots of interested students asking about doing on project on improving 2to3. What kinds of improvements and features would you like to see in it which student

Re: Tkinter book on current versions

2009-03-22 Thread Paul Watson
On Sat, 2009-03-21 at 08:10 -0700, W. eWatson wrote: Paul Watson wrote: Has anyone tried the Grayson book, Python and Tkinter Programming, with a recent version of Python? The first example code (calculator) generates a single row of buttons. Perhaps I have not applied the errata

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread Benjamin Peterson
Gabriel Genellina gagsl-py2 at yahoo.com.ar writes: The undocumented behavior is relying on the open() builtin to return a BufferedReader for a binary file. I don't see the problem. open() will return some BufferedIOBase implmentor, and that's all that TextIOWrapper needs. --

Re: Using python 3 for scripting?

2009-03-22 Thread Paul Watson
On Sun, 2009-03-22 at 17:00 +, Timo Myyrä wrote: Ok, I think I'll stick with the 2.6 then. I recall it gave warnings about things that are deprecated in 3.0 so it will make porting the scripts to 3.0 easier. I might try 3.0 once I know what kind of scripts are needed. Yes. Develop

Re: what features would you like to see in 2to3?

2009-03-22 Thread Daniel Fetchinson
It's GSoC time again, and I've had lots of interested students asking about doing on project on improving 2to3. What kinds of improvements and features would you like to see in it which student programmers could accomplish? Last time I used 2to3 (maybe not the latest version) it didn't

safely rename a method with a decorator

2009-03-22 Thread Daniel Fetchinson
I'd like to implement a decorator that would rename the method which it decorates. Since it's a tricky thing in general involving all sorts of __magic__ I thought I would ask around first before writing something buggy :) It should work something like this: class myclass( object ): @rename(

Re: Another of those is issues.

2009-03-22 Thread Emanuele D'Arrigo
Thank you all for the replies! Manu -- http://mail.python.org/mailman/listinfo/python-list

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread Gabriel Genellina
En Sun, 22 Mar 2009 19:12:13 -0300, Benjamin Peterson benja...@python.org escribió: Gabriel Genellina gagsl-py2 at yahoo.com.ar writes: The undocumented behavior is relying on the open() builtin to return a BufferedReader for a binary file. I don't see the problem. open() will return some

Re: safely rename a method with a decorator

2009-03-22 Thread MRAB
Daniel Fetchinson wrote: I'd like to implement a decorator that would rename the method which it decorates. Since it's a tricky thing in general involving all sorts of __magic__ I thought I would ask around first before writing something buggy :) It should work something like this: class

Re: Lambda forms and scoping

2009-03-22 Thread alex goretoy
Sorry to have confused yall. What I meant was that you can do something like this, where the fucntion isn't called until it is bount to () with the right params def a(): ... print inside a ... def b(): ... print inside b ... def c(a,b): ... a() ... b() ... d={c:(a,b)}

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread Benjamin Peterson
Gabriel Genellina gagsl-py2 at yahoo.com.ar schrieb: How do you know? AFAIK, the return value of open() is completely undocumented: http://docs.python.org/3.0/library/functions.html#open And if you open the file in text mode, the return value isn't a BufferedIOBase. Oh, I see. I

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread lambertdw
Return value of open undocumented? The return value of open() is a stream, according to http://docs.python.org/dev/py3k/library/io.html#module-io Seems like time for a bug report. -- http://mail.python.org/mailman/listinfo/python-list

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread Scott David Daniels
Gabriel Genellina wrote: En Sun, 22 Mar 2009 19:12:13 -0300, Benjamin Peterson benja...@python.org escribió: Gabriel Genellina gagsl-py2 at yahoo.com.ar writes: The undocumented behavior is relying on the open() builtin to return a BufferedReader for a binary file. I don't see the problem.

Re: safely rename a method with a decorator

2009-03-22 Thread Daniel Fetchinson
I'd like to implement a decorator that would rename the method which it decorates. Since it's a tricky thing in general involving all sorts of __magic__ I thought I would ask around first before writing something buggy :) It should work something like this: class myclass( object ):

Re: Lambda forms and scoping

2009-03-22 Thread andrew cooke
alex goretoy wrote: Sorry to have confused yall. What I meant was that you can do something like this, where the fucntion isn't called until it is bount to () with the right params def a(): ... print inside a ... def b(): ... print inside b ... def c(a,b): ... a() ...

Re: python 3, subclassing TextIOWrapper.

2009-03-22 Thread Gabriel Genellina
En Sun, 22 Mar 2009 21:03:38 -0300, Scott David Daniels scott.dani...@acm.org escribió: Gabriel Genellina wrote: En Sun, 22 Mar 2009 19:12:13 -0300, Benjamin Peterson benja...@python.org escribió: Gabriel Genellina gagsl-py2 at yahoo.com.ar writes: The undocumented behavior is relying on

Re: Safe to call Py_Initialize() frequently?

2009-03-22 Thread Graham Dumpleton
On Mar 21, 10:27 am, Mark Hammond skippy.hamm...@gmail.com wrote: Calling Py_Initialize and Py_Finalize multiple times does leak (Python 3 has mechanisms so this need to always be true in the future, but it is true now for non-trivial apps. Mark, can you please clarify this statement you are

Re: safely rename a method with a decorator

2009-03-22 Thread R. David Murray
Daniel Fetchinson fetchin...@googlemail.com wrote: I'd like to implement a decorator that would rename the method which it decorates. Since it's a tricky thing in general involving all sorts of __magic__ I thought I would ask around first before writing something buggy :) It should

Re: Lambda forms and scoping

2009-03-22 Thread alex goretoy
I'm talking about in function c, where we bind the function call, kinda same thing with lambdas too, exactly same def func1(a): return a def func2(a=,b=0): return %s has %d apples%(a,b) def c(f1,f2,**kwargs): print f2(kwargs['name'], f1(kwargs['apple'])) #bind call to function 1 and

Re: safely rename a method with a decorator

2009-03-22 Thread andrew cooke
there was discussion related to this same problem earlier in the week. http://groups.google.com/group/comp.lang.python/browse_thread/thread/ad08eb9eb83a4e61/d1906cbc26e16d15?q=Mangle+function+name+with+decorator%3F andrew Daniel Fetchinson wrote: I'd like to implement a decorator that would

Re: Generator

2009-03-22 Thread John Posner
[snip] If you want next(g) to yield 3, you'd have to do something like: g = (x for x in s[:]) where s[:] makes a copy of s that is then iterated over. BTW, this simpler statement works, too: g = iter(s[:]) -- http://mail.python.org/mailman/listinfo/python-list

Re: Async serial communication/threads sharing data

2009-03-22 Thread Jean-Paul Calderone
On Sun, 22 Mar 2009 12:30:04 -0500, Nick Craig-Wood n...@craig-wood.com wrote: [snip] I wrote a serial port to TCP proxy (with logging) with twisted. The problem I had was that twisted serial ports didn't seem to have any back pressure. By that I mean I could pump data into a 9600 baud serial

Re: Lambda forms and scoping

2009-03-22 Thread Gabriel Genellina
En Sun, 22 Mar 2009 20:43:02 -0300, alex goretoy aleksandr.gore...@gmail.com escribió: Sorry to have confused yall. What I meant was that you can do something like this, where the fucntion isn't called until it is bount to () with the right params def a(): ... print inside a ...

Re: Lambda forms and scoping

2009-03-22 Thread alex goretoy
Ah, so this is a terminology issue. I'd say that a and b are *called* in function c, not *bound*. I've never seen bind used in this sense before, but as Humpty Dumpty said to Alice: i use the word expressively -Alex Goretoy http://www.goretoy.com --

Re: Lambda forms and scoping

2009-03-22 Thread Gabriel Genellina
En Sun, 22 Mar 2009 16:42:21 -0300, R. David Murray rdmur...@bitdance.com escribió: Gabriel Genellina gagsl-...@yahoo.com.ar wrote: And if you imply that *where* you call a function does matter, it does not. A function carries its own local namespace, its own closure, and its global

splitting a large dictionary into smaller ones

2009-03-22 Thread per
hi all, i have a very large dictionary object that is built from a text file that is about 800 MB -- it contains several million keys. ideally i would like to pickle this object so that i wouldnt have to parse this large file to compute the dictionary every time i run my program. however

Re: splitting a large dictionary into smaller ones

2009-03-22 Thread Paul Rubin
per perfr...@gmail.com writes: i would like to split the dictionary into smaller ones, containing only hundreds of thousands of keys, and then try to pickle them. That already sounds like the wrong approach. You want a database. -- http://mail.python.org/mailman/listinfo/python-list

Re: splitting a large dictionary into smaller ones

2009-03-22 Thread odeits
On Mar 22, 7:32 pm, per perfr...@gmail.com wrote: hi all, i have a very large dictionary object that is built from a text file that is about 800 MB -- it contains several million keys.  ideally i would like to pickle this object so that i wouldnt have to parse this large file to compute the

Re: splitting a large dictionary into smaller ones

2009-03-22 Thread per
On Mar 22, 10:51 pm, Paul Rubin http://phr...@nospam.invalid wrote: per perfr...@gmail.com writes: i would like to split the dictionary into smaller ones, containing only hundreds of thousands of keys, and then try to pickle them. That already sounds like the wrong approach.  You want a

Re: splitting a large dictionary into smaller ones

2009-03-22 Thread Armin
On Monday 23 March 2009 00:01:40 per wrote: On Mar 22, 10:51 pm, Paul Rubin http://phr...@nospam.invalid wrote: per perfr...@gmail.com writes: i would like to split the dictionary into smaller ones, containing only hundreds of thousands of keys, and then try to pickle them. That

Re: splitting a large dictionary into smaller ones

2009-03-22 Thread Paul Rubin
per perfr...@gmail.com writes: fair enough - what native python database would you recommend? i prefer not to install anything commercial or anything other than python modules I think sqlite is the preferred one these days. -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >