itools 0.20.6 released

2008-06-17 Thread J. David Ibáñez
itools is a Python library, it groups a number of packages into a single meta-package for easier development and deployment: itools.abnf itools.http itools.tmx itools.catalog itools.i18n itools.uri itools.csv itools.ical

Vilnius/Post EuroPython PyPy Sprint 10-12th of July

2008-06-17 Thread Antonio Cuni
Vilnius/Post EuroPython PyPy Sprint 10-12th of July The PyPy team is sprinting at EuroPython again and we invite you to participate in our 3 day long sprint at the conference hotel -

ANN: pymunk 0.8 released

2008-06-17 Thread vb
Hi everyone, Im glad to announce that pymunk 0.8 have been released, a library wrapping the 2d physics engine Chipmunk. You can find it here: http://code.google.com/p/pymunk/ What is pymunk? === pymunk is a wrapper around the 2d rigid body physics library Chipmunk,

Pattern Matching Over Python Lists

2008-06-17 Thread Chris
Is anyone aware of any prior work done with searching or matching a pattern over nested Python lists? I have this problem where I have a list like: [1, 2, [1, 2, [1, 7], 9, 9], 10] and I'd like to search for the pattern [1, 2, ANY] so that is returns: [1, 2, [1, 2, [6, 7], 9, 9], 10] [1, 2, [6,

Re: String Concatenation O(n^2) (was: Re: Explaining Implementing a Binary Search Tree.)

2008-06-17 Thread Gabriel Genellina
En Mon, 16 Jun 2008 07:34:06 -0300, Bart Kastermans [EMAIL PROTECTED] escribió: Summary: can't verify big O claim, how to properly time this? This is interesting. I had never attempted to verify a big O statement before, and decided that it would be worth trying. So I wrote some code to

Re: How to catch StopIteration?

2008-06-17 Thread Lie
On Jun 17, 12:36 pm, Lie [EMAIL PROTECTED] wrote: On Jun 17, 10:50 am, [EMAIL PROTECTED] wrote: I'm writing to see calcuration process. And so, I can't catch StopIteration... What is mistake? (snip) In a for-loop, StopIteration is caught by the for-loop for your convenience (so you

print problem

2008-06-17 Thread pirata
I was trying to print a dot on console every second to indicates running process, so I wrote, for example: for i in xrange(10): print ., time.sleep(1) Idealy, a dot will be printed out each second. But there is nothing print out until after 10 seconds, all 10 dots come out together.

Re: PEP 372 -- Adding an ordered directory to collections

2008-06-17 Thread Paul McGuire
On Jun 17, 12:28 am, Martin v. Löwis [EMAIL PROTECTED] wrote: My guess is that the two main memory allocate/deallocate cases are 1) appending a new item to the end, and 2) GC'ing the entire data structure.  I would optimize these 2 at the expense of all others. Does that include dictionary

Re: Buffer size when receiving data through a socket?

2008-06-17 Thread Gabriel Genellina
En Mon, 16 Jun 2008 21:21:35 -0300, John Salerno [EMAIL PROTECTED] escribió: I wrote some pretty basic socket programming again, but I'm still confused about what's happening with the buffer_size variable. Here are the server and client programs: -- from socket import *

Re: How to catch StopIteration?

2008-06-17 Thread Chris
On Jun 17, 5:50 am, [EMAIL PROTECTED] wrote: I'm writing to see calcuration process. And so, I can't catch StopIteration... What is mistake? def collatz(n):   r=[]   while n1:     r.append(n)     n = 3*n+1 if n%2 else n/2     yield r for i, x in enumerate(collatz(13)):   try:    

Re: How to catch StopIteration?

2008-06-17 Thread Chris
On Jun 17, 8:43 am, Chris [EMAIL PROTECTED] wrote: On Jun 17, 5:50 am, [EMAIL PROTECTED] wrote: I'm writing to see calcuration process. And so, I can't catch StopIteration... What is mistake? def collatz(n):   r=[]   while n1:     r.append(n)     n = 3*n+1 if n%2 else n/2  

Re: print problem

2008-06-17 Thread Gabriel Genellina
En Tue, 17 Jun 2008 03:15:11 -0300, pirata [EMAIL PROTECTED] escribió: I was trying to print a dot on console every second to indicates running process, so I wrote, for example: for i in xrange(10): print ., time.sleep(1) Idealy, a dot will be printed out each second. But there is

Re: How to request data from a lazily-created tree structure ?

2008-06-17 Thread Diez B. Roggisch
Yes, I need to make sure my requests are properly written so that the generic XPath engine does not need all the structure in memory. There are quite a few cases where you really don't need to load everything at all. /a/b/*/c/d is an example. But even with an example like /x/z[last()]/t, you

Re: print problem

2008-06-17 Thread Rich Healey
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gabriel Genellina wrote: En Tue, 17 Jun 2008 03:15:11 -0300, pirata [EMAIL PROTECTED] escribió: I was trying to print a dot on console every second to indicates running process, so I wrote, for example: for i in xrange(10): print .,

Re: String Concatenation O(n^2)

2008-06-17 Thread Hrvoje Niksic
Ian Kelly [EMAIL PROTECTED] writes: On Mon, Jun 16, 2008 at 11:09 AM, Jean-Paul Calderone [EMAIL PROTECTED] wrote: It will depend what version of Python you're using and the *exact* details of the code in question. An optimization was introduced where, if the string being concatenated to is

Re: UnicodeDecodeError: 'ascii' codec can't decode byte

2008-06-17 Thread Peter Otten
Gilles Ganault wrote: It seems like I have Unicode data in a CSV file but Python is using a different code page, so isn't happy when I'm trying to read and put this data into an SQLite database with APSW: My guess is that you have non-ascii characters in a bytestring. What should I do so

Re: Does '!=' equivelent to 'is not'

2008-06-17 Thread Gabriel Genellina
En Tue, 17 Jun 2008 02:25:42 -0300, Lie [EMAIL PROTECTED] escribió: On Jun 17, 11:07 am, Leo Jay [EMAIL PROTECTED] wrote: On Tue, Jun 17, 2008 at 11:29 AM, pirata [EMAIL PROTECTED] wrote: What's the difference between is not and != or they are the same thing? The 'is' is used to test do

Re: newbie question: for loop within for loop confusion

2008-06-17 Thread Gabriel Genellina
En Mon, 16 Jun 2008 22:51:30 -0300, John Salerno [EMAIL PROTECTED] escribió: takayuki wrote: I'm early on in my python adventure so I'm not there yet on the strip command nuances.I'm reading How to think like a python programmer first. It's great. Then Learning python. I've read

Re: Removing inheritance (decorator pattern ?)

2008-06-17 Thread Gerard flanagan
Maric Michaud wrote: Le Monday 16 June 2008 20:35:22 George Sakkis, vous avez écrit : On Jun 16, 1:49 pm, Gerard flanagan [EMAIL PROTECTED] wrote: [...] variation of your toy code. I was thinking the Strategy pattern, different classes have different initialisation strategies? But then you

Re: 'string'.strip(chars)-like function that removes from the middle?

2008-06-17 Thread Peter Otten
Terry Reedy wrote: Cédric Lucantis wrote: I don't see any string method to do that 'abcde'.translate(str.maketrans('','','bcd')) 'ae' I do not claim this to be better than all the other methods, but this pair can also translate while deleting, which others cannot. You should

Re: print problem

2008-06-17 Thread Gabriel Genellina
En Tue, 17 Jun 2008 04:10:41 -0300, Rich Healey [EMAIL PROTECTED] escribió: Gabriel Genellina wrote: En Tue, 17 Jun 2008 03:15:11 -0300, pirata [EMAIL PROTECTED] escribió: I was trying to print a dot on console every second to indicates running process, so I wrote, for example: for i in

Re: print problem

2008-06-17 Thread Chris
On Jun 17, 8:15 am, pirata [EMAIL PROTECTED] wrote: I was trying to print a dot on console every second to indicates running process, so I wrote, for example: for i in xrange(10):     print .,     time.sleep(1) Idealy, a dot will be printed out each second. But there is nothing print out

Re: Does '!=' equivelent to 'is not'

2008-06-17 Thread Duncan Booth
Leo Jay [EMAIL PROTECTED] wrote: same objects are equal, but equal don't have to be the same object. same objects are often equal, but not always: inf = 2e200*2e200 ind = inf/inf ind==ind False ind is ind True -- Duncan Booth http://kupuguy.blogspot.com --

Re: get keys with the same values

2008-06-17 Thread Wolfgang Grafen
You could use my mseqdict implementation of a sorted dict. http://home.arcor.de/wolfgang.grafen/Python/Modules/Modules.html swap: This method can only be applied when all values of the dictionary are immutable. The Python dictionary cannot hold mutable keys! So swap doesn't work if only one

Re: Showing a point in Gnuploy.py

2008-06-17 Thread A.T.Hofkamp
On 2008-06-16, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello. Could some1 tell me how i could display a specific point in gnuplot.py. Supposingly if i have a point of intersection (2,3). How can i show this on the graph? As in how can i write near the point of intersection the value :(2,3).

gtk.gdk.Pixbuf.scale() unexpected behavior when offset != 0

2008-06-17 Thread Joel Hedlund
Hi! I'm developing a pygtk application where I need to show images zoomed in so that the user can see individual pixels. gtk.gdk.Pixbuf.scale() seemed ideal for this, but if I set offset_x and offset_y to anything other than 0, the resulting image is heavily distorted and the offset is

Re: 'string'.strip(chars)-like function that removes from the middle?

2008-06-17 Thread Sion Arrowsmith
In article [EMAIL PROTECTED], Peter Otten [EMAIL PROTECTED] wrote: Terry Reedy wrote: 'abcde'.translate(str.maketrans('','','bcd')) 'ae' You should mention that you are using Python 3.0 ;) The 2.5 equivalent would be uabcde.translate(dict.fromkeys(map(ord, ubcd))) u'ae' Only if you're

go to specific line in text file

2008-06-17 Thread Patrick David
Hello NG, I am searching for a way to jump to a specific line in a text file, let's say to line no. 9000. Is there any method like file.seek() which leads me to a given line instead of a given byte? Hope for help Patrick -- http://mail.python.org/mailman/listinfo/python-list

Re: pyinotify issue

2008-06-17 Thread AndreH
On Jun 13, 3:39 pm, AndreH [EMAIL PROTECTED] wrote: Good day, I just installed pyinotify on my gentoo box. When I test the library through pyinotify.pv -v /tmp under root, everything works great, but when I try the same thing under my local user account, I receive the following error:

New widget

2008-06-17 Thread Petertos
Hello, here's a new casual game that looks interesting. It's called Smilies Invasion and you have to eat as much green smilies as you can: http://www.dolmenent.com/smiliesinvasion/ Greetings from a newbie developer. -- http://mail.python.org/mailman/listinfo/python-list

Re: go to specific line in text file

2008-06-17 Thread John Machin
On Jun 17, 8:10 pm, Patrick David [EMAIL PROTECTED] wrote: Hello NG, I am searching for a way to jump to a specific line in a text file, let's say to line no. 9000. Is there any method like file.seek() which leads me to a given line instead of a given byte? If by jump you mean without

Re: 'string'.strip(chars)-like function that removes from the middle?

2008-06-17 Thread Peter Otten
Sion Arrowsmith wrote: In article [EMAIL PROTECTED], Peter Otten [EMAIL PROTECTED] wrote: Terry Reedy wrote: 'abcde'.translate(str.maketrans('','','bcd')) 'ae' You should mention that you are using Python 3.0 ;) The 2.5 equivalent would be uabcde.translate(dict.fromkeys(map(ord, ubcd)))

Re: PEP 372 -- Adding an ordered directory to collections

2008-06-17 Thread bearophileHUGS
Martin v. L.: http://wiki.python.org/moin/TimeComplexity Thank you, I think that's not a list of guarantees, while a list of how things are now in CPython. If so, what's the advantage of using that method over d.items[n]? I think I have lost the thread here, sorry. So I explain again what I

Numeric type conversions

2008-06-17 Thread John Dann
I'm new to Python and can't readily find the appropriate function for the following situation: I'm reading in a byte stream from a serial port (which I've got working OK with pyserial) and which contains numeric data in a packed binary format. Much of the data content occurs as integers encoded

Re: Numeric type conversions

2008-06-17 Thread Diez B. Roggisch
John Dann wrote: I'm new to Python and can't readily find the appropriate function for the following situation: I'm reading in a byte stream from a serial port (which I've got working OK with pyserial) and which contains numeric data in a packed binary format. Much of the data content

Re: Numeric type conversions

2008-06-17 Thread ershov . a_n
try struct.pack -- http://mail.python.org/mailman/listinfo/python-list

Re: Numeric type conversions

2008-06-17 Thread A.T.Hofkamp
On 2008-06-17, John Dann [EMAIL PROTECTED] wrote: I'm reading in a byte stream from a serial port (which I've got working OK with pyserial) and which contains numeric data in a packed binary format. Much of the data content occurs as integers encoded as 2 consecutive bytes, ie a 2-byte

Re: Numeric type conversions

2008-06-17 Thread Gerhard Häring
John Dann wrote: I'm new to Python and can't readily find the appropriate function for the following situation: I'm reading in a byte stream from a serial port (which I've got working OK with pyserial) and which contains numeric data in a packed binary format. Much of the data content occurs as

Re: How to request data from a lazily-created tree structure ?

2008-06-17 Thread méchoui
On Jun 17, 9:08 am, Diez B. Roggisch [EMAIL PROTECTED] wrote: Yes, I need to make sure my requests are properly written so that the generic XPath engine does not need all the structure in memory. There are quite a few cases where you really don't need to load everything at all. /a/b/*/c/d

Re: Does '!=' equivelent to 'is not'

2008-06-17 Thread Derek Martin
On Tue, Jun 17, 2008 at 04:33:03AM -0300, Gabriel Genellina wrote: Basically 'a is b' and 'not(a is b)' is similar to 'id(a) == id(b)' and 'not(id(a) == id(b))' No. Sure it is... he said similar... not identical. They are not the same, but they are similar. Saying a flat no alone,

Re: Numeric type conversions

2008-06-17 Thread John Machin
On Jun 17, 9:28 pm, John Dann [EMAIL PROTECTED] wrote: I'm new to Python and can't readily find the appropriate function for the following situation: I'm reading in a byte stream from a serial port (which I've got working OK with pyserial) and which contains numeric data in a packed binary

Re: 32 bit or 64 bit?

2008-06-17 Thread Phil Hobbs
[EMAIL PROTECTED] wrote: On Jun 15, 7:43 pm, Peter Otten [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Jun 15, 6:58 pm, Christian Meesters [EMAIL PROTECTED] wrote: I do need speed. Is there an option? Mind telling us what you *actually* want to achieve? (What do you want to

Mapping a series of Dates to an array of Numbers

2008-06-17 Thread J-Burns
Hello. Got a problem here. Ive got a set of points tht id be plotting. Those points would contain the date on which the work was done against its frequency. Supposedly if i did something on the 28th of March one of the points would be (28, respective freq). The next time i did my work on the 1st

Re: Mapping a series of Dates to an array of Numbers

2008-06-17 Thread J-Burns
Btw dnt forget the solution should also cater to this problem: Supposedly there is a day on which i did not do anything. Than that particular spot in my graph should be left empty. Meaning that if i did something on the 1st March and after it i did something on the 7th March. Then essentially 1st

Re: Mapping a series of Dates to an array of Numbers

2008-06-17 Thread Chris
On Jun 17, 2:15 pm, J-Burns [EMAIL PROTECTED] wrote: Hello. Got a problem here. Ive got a set of points tht id be plotting. Those points would contain the date on which the work was done against its frequency. Supposedly if i did something on the 28th of March one of the points would be (28,

Re: go to specific line in text file

2008-06-17 Thread Hrvoje Niksic
Patrick David [EMAIL PROTECTED] writes: I am searching for a way to jump to a specific line in a text file, let's say to line no. 9000. Is there any method like file.seek() which leads me to a given line instead of a given byte? You can simulate it fairly easily, but it will internally read

How do I avoid using HTTPRedirectHandler with urllib2?

2008-06-17 Thread Mukherjee, Pratip
Hi, I am new to Python, trying it as an alternative to Perl. I am having problem with python HTTP handling library, urllib2. How do I avoid using the HTTPRedirectHandler while making a HTTP request? For those familiar to Perl-LWP, this is done by using simple_request() on the UserAgent object.

Re: Buffer size when receiving data through a socket?

2008-06-17 Thread John Salerno
Gabriel Genellina [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Both programs say recv(buffer_size) - buffer_size is the maximum number of bytes to be RECEIVED, that is, READ. recv will return at most buffer_size bytes. It may return less than that, even if the other side sent

Re: Buffer size when receiving data through a socket?

2008-06-17 Thread John Salerno
John Salerno [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] from socket import * host = 'localhost' port = 51567 address = (host, port) buffer_size = 1024 client_socket = socket(AF_INET, SOCK_STREAM) client_socket.connect(address) while True: data = raw_input(' ') if

Re: 32 bit or 64 bit?

2008-06-17 Thread [EMAIL PROTECTED]
On Jun 17, 3:13 pm, Phil Hobbs [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Jun 15, 7:43 pm, Peter Otten [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Jun 15, 6:58 pm, Christian Meesters [EMAIL PROTECTED] wrote: I do need speed. Is there an option? Mind telling us what

Re: go to specific line in text file

2008-06-17 Thread John Machin
On Jun 17, 10:46 pm, Hrvoje Niksic [EMAIL PROTECTED] wrote: Patrick David [EMAIL PROTECTED] writes: I am searching for a way to jump to a specific line in a text file, let's say to line no. 9000. Is there any method like file.seek() which leads me to a given line instead of a given byte?

Re: 32 bit or 64 bit?

2008-06-17 Thread Richard Brodie
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] That was suggested. Problem is, that sometimes the velocities are near zero. So this solution, by itself, is not general enough. Maybe working in p, and delta-p would be more stable. --

Re: The best way to package a Python module?

2008-06-17 Thread js
Thanks everyone for details. I'll try stealing some of the good bits of python-central of debian for my purpose. On Mon, Jun 16, 2008 at 10:43 AM, Ben Finney [EMAIL PROTECTED] wrote: Jean-Paul Calderone [EMAIL PROTECTED] writes: What has changed is that the tools in common use for Debian

Authentic Designer Handbags at www. yoyobag.com

2008-06-17 Thread kalra . shrut
Authentic Designer Handbags at www. yoyobag.com -- http://mail.python.org/mailman/listinfo/python-list

Annoying message when interrupting python scripts

2008-06-17 Thread geoffbache
Hi all, I find that I semi-frequently get the cryptic message import site failed; use -v for traceback printed on standard error when an arbitrary python script receives SIGINT while the python interpreter is still firing up. If I use -v for traceback I get something along the lines of 'import

Re: Annoying message when interrupting python scripts

2008-06-17 Thread geoffbache
To clarify: this is more serious than an incorrect error message, as the intended interrupt gets swallowed and script execution proceeds. Sometimes I seem to get half-imported modules as well, the script failing later with something like AttributeError: 'module' object has no attribute 'getenv'

Re: Pattern Matching Over Python Lists

2008-06-17 Thread Kirk Strauser
At 2008-06-17T05:55:52Z, Chris [EMAIL PROTECTED] writes: Is anyone aware of any prior work done with searching or matching a pattern over nested Python lists? I have this problem where I have a list like: [1, 2, [1, 2, [1, 7], 9, 9], 10] and I'd like to search for the pattern [1, 2, ANY]

Re: How to catch StopIteration?

2008-06-17 Thread Nick Craig-Wood
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm writing to see calcuration process. And so, I can't catch StopIteration... What is mistake? def collatz(n): r=[] while n1: r.append(n) n = 3*n+1 if n%2 else n/2 yield r for i, x in enumerate(collatz(13)):

Re: 2Q's: How to autocreate instance of class;How to check for membership in a class

2008-06-17 Thread Mark Wooding
asdf [EMAIL PROTECTED] wrote: (Presumably nothing to do with the Common Lisp system-definition utility.) So for example if I know that var1=jsmith. Can I somehow do var1=User(). Something like this might work. class User (object): def __init__(me, name): me.name = name class Users

Re: Numeric type conversions

2008-06-17 Thread MRAB
On Jun 17, 12:28 pm, John Dann [EMAIL PROTECTED] wrote: I'm new to Python and can't readily find the appropriate function for the following situation: I'm reading in a byte stream from a serial port (which I've got working OK with pyserial) and which contains numeric data in a packed binary

Re: Debuggers

2008-06-17 Thread R. Bernstein
TheSaint [EMAIL PROTECTED] writes: On 19:21, venerdì 13 giugno 2008 R. Bernstein wrote: I'm not completely sure what you mean, but I gather that in post-mortem debugging you'd like to inspect local variables defined at the place of error. Yes, exactly. This can be seen with pdb, but not

text alignment

2008-06-17 Thread Gandalf
Hi every one. What is the similar python WX style property for CSS text-align? I need this item text to start from the right direction: aaa= html.HtmlWindow(self, -1, style=wx.SIMPLE_BORDER, size=(250, 60)) aaa.LoadPage('../../aa.html') Thanks! --

Trying to get pcap working

2008-06-17 Thread Michael Matthews
Hello, I'm fairly new to Python, and have run into dead ends in trying to figure out what is going on. The basic thing I am trying to do is get pylibpcap working on a Python installation. More precisely, I want to get it working on an ActiveState Python installation. I have it working on

Re: text alignment

2008-06-17 Thread Gandalf
On Jun 17, 6:43 pm, Gandalf [EMAIL PROTECTED] wrote: Hi every one. What is the similar python WX style property for CSS text-align? I need this item text to start from the right direction: aaa= html.HtmlWindow(self, -1, style=wx.SIMPLE_BORDER, size=(250, 60))        

Re: Pattern Matching Over Python Lists

2008-06-17 Thread bearophileHUGS
Kirk Strauser: Hint: recursion. Your general algorithm will be something like: Another solution is to use a better (different) language, that has built-in pattern matching, or allows to create one. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Context manager for files vs garbage collection

2008-06-17 Thread Sebastian lunar Wiesner
Floris Bruynooghe [EMAIL PROTECTED]: I was wondering when it was worthwil to use context managers for file. Consider this example: def foo(): t = False for line in file('/tmp/foo'): if line.startswith('bar'): t = True break return t Using

Re: Numeric type conversions

2008-06-17 Thread John Dann
On Tue, 17 Jun 2008 08:58:11 -0700 (PDT), MRAB [EMAIL PROTECTED] wrote: [snip] Please note that in slicing the start position is included and the end position is excluded, so that should be ByteStream[12:14]. Yes, I just tripped over that, in fact, hence the error in my original post. I suppose

Re: Buffer size when receiving data through a socket?

2008-06-17 Thread John Salerno
Gabriel Genellina [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Note that most of the time you want to use the sendall() method, because send() doesn't guarantee that all the data was actually sent. http://docs.python.org/lib/socket-objects.html If I use sendall(), am I still

Re: Does '!=' equivelent to 'is not'

2008-06-17 Thread Terry Reedy
pirata wrote: I'm a bit confusing about whether is not equivelent to != 0 is not 0.0 True 0 != 0.0 False -- http://mail.python.org/mailman/listinfo/python-list

Re: Numeric type conversions

2008-06-17 Thread Peter Otten
John Dann wrote: On Tue, 17 Jun 2008 08:58:11 -0700 (PDT), MRAB [EMAIL PROTECTED] wrote: [snip] Please note that in slicing the start position is included and the end position is excluded, so that should be ByteStream[12:14]. Yes, I just tripped over that, in fact, hence the error in my

Re: Making wxPython a standard module?

2008-06-17 Thread TYR
b = wx.Button(label=Click Me, action=myCallable) Instead you used to have to create a button and then call some utility function in some other object to bind that button to a callable (IIRC this was one place where Window IDs could be used). Now, the button actually has a

Re: text alignment

2008-06-17 Thread Mike Driscoll
On Jun 17, 11:45 am, Gandalf [EMAIL PROTECTED] wrote: On Jun 17, 6:43 pm, Gandalf [EMAIL PROTECTED] wrote: Hi every one. What is the similar python WX style property for CSS text-align? I need this item text to start from the right direction: aaa= html.HtmlWindow(self, -1,

Re: 'string'.strip(chars)-like function that removes from the middle?

2008-06-17 Thread Terry Reedy
Peter Otten wrote: Terry Reedy wrote: Cédric Lucantis wrote: I don't see any string method to do that 'abcde'.translate(str.maketrans('','','bcd')) 'ae' I do not claim this to be better than all the other methods, but this pair can also translate while deleting, which others cannot.

Re: text alignment

2008-06-17 Thread Gandalf
On Jun 17, 7:49 pm, Mike Driscoll [EMAIL PROTECTED] wrote: On Jun 17, 11:45 am, Gandalf [EMAIL PROTECTED] wrote: On Jun 17, 6:43 pm, Gandalf [EMAIL PROTECTED] wrote: Hi every one. What is the similar python WX style property for CSS text-align? I need this item text to start from the

Re: text alignment

2008-06-17 Thread Gandalf
since you brought up this issue, please tell me where can I fine menual for this library? can i generate dynamic GUI from it? If not, Is there any way to generate dynamic GUI (one that can change according to the user input) with HTML-CSS- javascript similar environment? --

Static memory allocation in Python

2008-06-17 Thread Eduardo Henrique Tessarioli
Hi, I am running a very simple python application and I noted that the memory allocation is something like 4,5M. This is a problem in my case, because I have to run 2 thousand process at the same time. The memory I need is 100k or less. Is there any way to set this for the python process?

Re: 'string'.strip(chars)-like function that removes from the middle?

2008-06-17 Thread Ethan Furman
Ethan Furman wrote: Greetings. The strip() method of strings works from both ends towards the middle. Is there a simple, built-in way to remove several characters from a string no matter their location? (besides .replace() ;) For example: .strip -- 'www.example.com'.strip('cmowz.') 'example'

Re: 'string'.strip(chars)-like function that removes from the middle?

2008-06-17 Thread Roel Schroeven
Peter Otten schreef: Ethan Furman wrote: The strip() method of strings works from both ends towards the middle. Is there a simple, built-in way to remove several characters from a string no matter their location? (besides .replace() ;) identity = .join(map(chr, range(256))) Or identity =

Re: text alignment

2008-06-17 Thread Mike Driscoll
On Jun 17, 12:59 pm, Gandalf [EMAIL PROTECTED] wrote: On Jun 17, 7:49 pm, Mike Driscoll [EMAIL PROTECTED] wrote: On Jun 17, 11:45 am, Gandalf [EMAIL PROTECTED] wrote: On Jun 17, 6:43 pm, Gandalf [EMAIL PROTECTED] wrote: Hi every one. What is the similar python WX style property for

Re: text alignment

2008-06-17 Thread Mike Driscoll
On Jun 17, 1:20 pm, Gandalf [EMAIL PROTECTED] wrote: since you brought up this issue, please tell me where can I fine menual for this library? You want the manual for wxPython? Go to the download page on the Official wxPython page and get the Docs Demos package:

Re: Removing inheritance (decorator pattern ?)

2008-06-17 Thread George Sakkis
On Jun 16, 11:10 pm, Maric Michaud [EMAIL PROTECTED] wrote: Le Monday 16 June 2008 20:35:22 George Sakkis, vous avez écrit : On Jun 16, 1:49 pm, Gerard flanagan [EMAIL PROTECTED] wrote: George Sakkis wrote: I have a situation where one class can be customized with several

Re: Static memory allocation in Python

2008-06-17 Thread Calvin Spealman
On Jun 17, 2008, at 2:34 PM, Eduardo Henrique Tessarioli wrote: Hi, I am running a very simple python application and I noted that the memory allocation is something like 4,5M. This is a problem in my case, because I have to run 2 thousand process at the same time. The memory I need is

2d graphics - drawing a vescica piscis in Python

2008-06-17 Thread Terrence Brannon
Hello, I have written a program to draw a vescica piscis http:// en.wikipedia.org/wiki/Vesica_piscis from turtle import * def main(): setup(width=400, height=400) r = 50 color(black) circle(r) color(white) forward(r) color(black) circle(r) x =

Re: 2d graphics - drawing a vescica piscis in Python

2008-06-17 Thread Mensanator
On Jun 17, 2:45 pm, Terrence Brannon [EMAIL PROTECTED] wrote: Hello, I have written a program to draw a vescica piscis http:// en.wikipedia.org/wiki/Vesica_piscis from turtle import * def main():     setup(width=400, height=400)     r = 50     color(black)     circle(r)    

Is there a standard binary search with overridable comparisons?

2008-06-17 Thread markscottwright
I've got an ordered list of MyClasses that I want to be able to do binary searches on, but against a tuple. MyClass has valid __lt__(self, rhs) and __eq__(self, rhs) member functions that work when rhs is a tuple. This works: l = [MyClass(..), MyClass(..), ...] l.find((a,b)) But this doesn't:

Re: 2d graphics - drawing a vescica piscis in Python

2008-06-17 Thread Matimus
On Jun 17, 12:45 pm, Terrence Brannon [EMAIL PROTECTED] wrote: Hello, I have written a program to draw a vescica piscis http:// en.wikipedia.org/wiki/Vesica_piscis from turtle import * def main():     setup(width=400, height=400)     r = 50     color(black)     circle(r)    

Re: UnicodeDecodeError: 'ascii' codec can't decode byte

2008-06-17 Thread Gilles Ganault
On Tue, 17 Jun 2008 09:23:28 +0200, Peter Otten [EMAIL PROTECTED] wrote: Assuming that encoding is UTF-8 and that apsw can cope with unicode, try to convert your data to unicode before feeding it to the database api: sql = INSERT INTO mytable (col1,col2) VALUES (?,?) rows =

using the string functions (ex. find()) on a multi-symbol string

2008-06-17 Thread korean_dave
How can i use the find() function on a string that is composed of tons of symbols that cause errors... THis is my string: find(htmlheadmeta name=qrichtext content=1 /style type=text/cssp, li { white-space: pre-wrap; }/style/headbody style= font-family:'MS Shell Dlg 2'; font-size:8.25pt;

Re: 2d graphics - drawing a vescica piscis in Python

2008-06-17 Thread Lie
On Jun 18, 2:45 am, Terrence Brannon [EMAIL PROTECTED] wrote: Hello, I have written a program to draw a vescica piscis http:// en.wikipedia.org/wiki/Vesica_piscis from turtle import * def main():     setup(width=400, height=400)     r = 50     color(black)     circle(r)    

Re: text alignment

2008-06-17 Thread Gandalf
On Jun 17, 8:43 pm, Mike Driscoll [EMAIL PROTECTED] wrote: On Jun 17, 1:20 pm, Gandalf [EMAIL PROTECTED] wrote: since you brought up this issue, please tell me where can I fine menual for this library? You want the manual for wxPython? Go to the download page on the Official wxPython page

Re: newbie question: for loop within for loop confusion

2008-06-17 Thread John Salerno
Gabriel Genellina wrote: En Mon, 16 Jun 2008 22:51:30 -0300, John Salerno [EMAIL PROTECTED] escribió: takayuki wrote: I'm early on in my python adventure so I'm not there yet on the strip command nuances.I'm reading How to think like a python programmer first. It's great. Then Learning

Re: using the string functions (ex. find()) on a multi-symbol string

2008-06-17 Thread John Machin
On Jun 18, 7:12 am, korean_dave [EMAIL PROTECTED] wrote: How can i use the find() function on a string that is composed of tons of symbols that cause errors... THis is my string: find(htmlheadmeta name=qrichtext content=1 /style type=text/cssp, li { white-space: pre-wrap; }/style/headbody

Re: How to request data from a lazily-created tree structure ?

2008-06-17 Thread Diez B. Roggisch
Do you know if there is such XPath engine that can be applied to a DOM- like structure ? No. But I toyed with the idea to write one :) One way would be to take an XPath engine from an existing XML engine (ElementTree, or any other), and see what APIs it calls... and see if we cannot create

Re: [Twisted-Python] Re-working a synchronous iterator to use Twisted

2008-06-17 Thread Jean-Paul Calderone
On Tue, 17 Jun 2008 23:10:48 +0200, Terry Jones [EMAIL PROTECTED] wrote: For the record, here's a followup to my own posting, with working code. The earlier untested code was a bit of a mess. The below runs fine. In case it wasn't clear before, you're pulling results (e.g., from a search

Re: using the string functions (ex. find()) on a multi-symbol string

2008-06-17 Thread John Machin
On Jun 18, 7:12 am, korean_dave [EMAIL PROTECTED] wrote: How can i use the find() function on a string that is composed of tons of symbols that cause errors... THis is my string: find(htmlheadmeta name=qrichtext content=1 /style type=text/cssp, li { white-space: pre-wrap; }/style/headbody

Calling pcre with ctypes

2008-06-17 Thread moreati
Recently I discovered the re module doesn't support POSIX character classes: Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type help, copyright, credits or license for more information. import re r = re.compile('[:alnum:]+') print r.match('123')

Execfile issue

2008-06-17 Thread Dan Yamins
I'm having (what I assume is) a simple problem regarding the way import and execfile interact. I apologize in advance for my naivete. Lets say I have the function: def Func1(): print dir() execfile('testfile') print dir() X and the file #file: testfile

Re: PEP 372 -- Adding an ordered directory to collections

2008-06-17 Thread Martin v. Löwis
I think I have lost the thread here, sorry. So I explain again what I mean. I think for this data structure it's important to keep all the normal dict operations at the same speed. If you use a C implementation vaguely similar to my pure python recipe you can perform the del in O(1) too,

Re: PEP 372 -- Adding an ordered directory to collections

2008-06-17 Thread Martin v. Löwis
Well, this has become something of a rant, Indeed - and I was only asking about .byindex(n) :-) I don't know why that method is included in the PEP. Speculating myself, I assume that the PEP author wants it to be O(1). As bearophile explains, that's not possible/not a good idea. As for

Re: Is there a standard binary search with overridable comparisons?

2008-06-17 Thread John Machin
On Jun 18, 6:55 am, markscottwright [EMAIL PROTECTED] wrote: I've got an ordered list of MyClasses that I want to be able to do binary searches on, but against a tuple. MyClass has valid __lt__(self, rhs) and __eq__(self, rhs) member functions that work when rhs is a tuple. This works: l =

  1   2   >