Re: how to make format operator % work with unicode as expected

2008-01-27 Thread John Machin
On Jan 27, 3:06 pm, Peter Pei [EMAIL PROTECTED] wrote: I probably should mention that what I want is to make all parts of the string aligned, and look like table. I am not looking for other ways to make it table-alike, but only interested in making % work with unicode -counting characters not

Re: Using a dict as if it were a module namespace

2008-01-27 Thread thebjorn
On Jan 27, 8:45 am, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: I have a problem which I think could be solved by using a dict as a namespace, in a similar way that exec and eval do. When using the timeit module, it is very inconvenient to have to define functions as strings.

Re: file write question

2008-01-27 Thread thebjorn
On Jan 27, 4:02 am, Robb Lane (SL name) [EMAIL PROTECTED] wrote: I have written a script which: - opens a file - does what it needs to do, periodically writing to the file... for a few hours - then closes the file when it's done So my question is: Would it be better to 'open' and 'close' my

Re: how to make format operator % work with unicode as expected

2008-01-27 Thread Stefan Behnel
Ever heard the word PLONK? Peter Pei harshly top-posted: You didn't understand my question, but thanks any way. Yes, it is true that %s already support unicode, and I did not contradict that. But it counts the number of bytes instead of characters, and makes things like %-20s out of

Re: translating Python to Assembler

2008-01-27 Thread over
On Fri, 25 Jan 2008 17:36:06 -0800 (PST), ajaksu [EMAIL PROTECTED] wrote: On Jan 25, 11:10 pm, [EMAIL PROTECTED] wrote: Once a python py file is compiled into a pyc file, I can disassemble it into assembler. Assembler is nothing but codes, which are combinations of 1's and 0's. You can't read

Re: translating Python to Assembler

2008-01-27 Thread over
On Fri, 25 Jan 2008 17:44:07 -0800 (PST), ajaksu [EMAIL PROTECTED] wrote: On Jan 25, 11:36 pm, ajaksu [EMAIL PROTECTED] wrote: On Jan 25, 11:10 pm, [EMAIL PROTECTED] wrote: [...] Gaah, is this what's going on? [EMAIL PROTECTED]:~$ cat error.txt This is not assembler... [EMAIL PROTECTED]:~$

Re: translating Python to Assembler

2008-01-27 Thread thebjorn
On Jan 27, 9:58 am, [EMAIL PROTECTED] wrote: On Fri, 25 Jan 2008 17:44:07 -0800 (PST), ajaksu [EMAIL PROTECTED] wrote: On Jan 25, 11:36 pm, ajaksu [EMAIL PROTECTED] wrote: On Jan 25, 11:10 pm, [EMAIL PROTECTED] wrote: [...] Gaah, is this what's going on? [EMAIL PROTECTED]:~$ cat

Re: translating Python to Assembler

2008-01-27 Thread Steven D'Aprano
On Sun, 27 Jan 2008 08:58:01 +, over wrote: On Fri, 25 Jan 2008 17:44:07 -0800 (PST), ajaksu [EMAIL PROTECTED] wrote: On Jan 25, 11:36 pm, ajaksu [EMAIL PROTECTED] wrote: On Jan 25, 11:10 pm, [EMAIL PROTECTED] wrote: [...] Gaah, is this what's going on? [EMAIL PROTECTED]:~$ cat

Re: Sorting Large File (Code/Performance)

2008-01-27 Thread Stefan Behnel
Gabriel Genellina wrote: use the Windows sort command. It has been there since MS-DOS ages, there is no need to download and install other packages, and the documentation at http://technet.microsoft.com/en-us/library/bb491004.aspx says: Limits on file size: The sort command has no limit

Re: how to make format operator % work with unicode as expected

2008-01-27 Thread Marc 'BlackJack' Rintsch
On Sun, 27 Jan 2008 05:32:40 +, Peter Pei wrote: You didn't understand my question, but thanks any way. Yes, it is true that %s already support unicode, and I did not contradict that. But it counts the number of bytes instead of characters, and makes things like %-20s out of

Re: Some questions about decode/encode

2008-01-27 Thread glacier
On 1月24日, 下午5时51分, John Machin [EMAIL PROTECTED] wrote: On Jan 24, 2:49 pm, glacier [EMAIL PROTECTED] wrote: I use chinese charactors as an example here. s1='你好吗' repr(s1) '\\xc4\\xe3\\xba\\xc3\\xc2\\xf0' b1=s1.decode('GBK') My first question is : what strategy does 'decode' use

Re: Sorting Large File (Code/Performance)

2008-01-27 Thread Grant Edwards
On 2008-01-27, Stefan Behnel [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: use the Windows sort command. It has been there since MS-DOS ages, there is no need to download and install other packages, and the documentation at http://technet.microsoft.com/en-us/library/bb491004.aspx says:

Re: Some questions about decode/encode

2008-01-27 Thread glacier
On 1月24日, 下午3时29分, Gabriel Genellina [EMAIL PROTECTED] wrote: En Thu, 24 Jan 2008 04:52:22 -0200, glacier [EMAIL PROTECTED] escribió: According to your reply, what will happen if I try to decode a long string seperately. I mean: ## a='你好吗'*10

Re: Some questions about decode/encode

2008-01-27 Thread glacier
On 1月24日, 下午4时44分, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 23 Jan 2008 19:49:01 -0800, glacier wrote: My second question is: is there any one who has tested very long mbcs decode? I tried to decode a long(20+MB) xml yesterday, which turns out to be very strange and cause

Re: Index of maximum element in list

2008-01-27 Thread bearophileHUGS
bearophile: That version is easy to translate to other languages and you can probably find that Psyco makes it much faster still. That operation is quite common, so it deserves a bit more work: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/543271 (I can show you the D/C code if you

Re: Sorting Large File (Code/Performance)

2008-01-27 Thread Marc 'BlackJack' Rintsch
On Sun, 27 Jan 2008 10:00:45 +, Grant Edwards wrote: On 2008-01-27, Stefan Behnel [EMAIL PROTECTED] wrote: Gabriel Genellina wrote: use the Windows sort command. It has been there since MS-DOS ages, there is no need to download and install other packages, and the documentation at

Re: translating Python to Assembler

2008-01-27 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: hehe...which part am I kidding about? The explanation was for someone who thought python scripts were translated directly by the processor. Who might this have been? Surely not Tim. I have already disassembled a pyc file as a binary file. Have you? How's it look?

Re: Some questions about decode/encode

2008-01-27 Thread Marc 'BlackJack' Rintsch
On Sun, 27 Jan 2008 02:18:48 -0800, glacier wrote: Yepp. I feed SAX with the unicode string since SAX didn't support my encoding system(GBK). If the `decode()` method supports it, IMHO SAX should too. Is there any way to solve this better? I mean if I shouldn't convert the GBK string to

Re: Index of maximum element in list

2008-01-27 Thread Paul Rubin
[EMAIL PROTECTED] writes: The final sum: the Psyco version is almost 40 times faster than the Python version, and just 2.8 times slower than the D version, and 3.4 times slower than a C version (that doesn't use too many pointer tricks). I think this is good enough. I can't help wishing that

Re: translating Python to Assembler

2008-01-27 Thread over
On Sat, 26 Jan 2008 14:47:50 +0100, Bjoern Schliessmann [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Intel processors can only process machine language[...] There's no way for a processor to understand any higher level language, even assembler, since it is written with hexadecimal codes

Re: Some questions about decode/encode

2008-01-27 Thread John Machin
On Jan 27, 9:18 pm, glacier [EMAIL PROTECTED] wrote: On 1月24日, 下午4时44分, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 23 Jan 2008 19:49:01 -0800, glacier wrote: My second question is: is there any one who has tested very long mbcs decode? I tried to decode a long(20+MB) xml

Re: Some questions about decode/encode

2008-01-27 Thread John Machin
On Jan 27, 9:17 pm, glacier [EMAIL PROTECTED] wrote: On 1月24日, 下午3时29分, Gabriel Genellina [EMAIL PROTECTED] wrote: En Thu, 24 Jan 2008 04:52:22 -0200, glacier [EMAIL PROTECTED] escribió: According to your reply, what will happen if I try to decode a long string seperately. I mean:

Re: translating Python to Assembler

2008-01-27 Thread over
That's not the point, however. I'm trying to say that a processor cannot read a Python script, and since the Python interpreter as stored on disk is essentially an assembler file, It isn't; it's an executable. I appreciated the intelligent response I received from you earlier, now we're

Re: Index of maximum element in list

2008-01-27 Thread Arnaud Delobelle
On Jan 26, 10:07 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: On Sat, 26 Jan 2008 12:40:26 -0800, Paul Rubin wrote: [EMAIL PROTECTED] writes: def posmax(seq, key=lambda x:x):    return max(enumerate(seq), key=lambda k: key(k[1]))[0] Is the Python max able to tell

python regex: misbehaviour with \r (0x0D) as Newline character in Unicode Mode

2008-01-27 Thread Arian Sanusi
Hi, concerning to unicode, \n, \r and \r\n (0x000A, 0x000D and 0x000D+0x000A) should be threatened as newline character at least this is how i understand it: (http://en.wikipedia.org/wiki/Newline#Unicode) obviously, the re module does not care, and on unix, only threatens \n as newline char:

Re: Index of maximum element in list

2008-01-27 Thread Paul Rubin
Arnaud Delobelle [EMAIL PROTECTED] writes: def simple_posmax(l, key=None): if key: return l.index(max(l, key=key)) else: return l.index(max(l)) def simple_posmax(l, **kw): return l.index(max(l, **kw)) simple_posmax is more than 3x faster on my machine. It's not

Re: Index of maximum element in list

2008-01-27 Thread Arnaud Delobelle
On Jan 27, 11:42 am, Paul Rubin http://[EMAIL PROTECTED] wrote: Arnaud Delobelle [EMAIL PROTECTED] writes: def simple_posmax(l, key=None):     if key:         return l.index(max(l, key=key))     else:         return l.index(max(l)) def simple_posmax(l, **kw):    return l.index(max(l,

Re: translating Python to Assembler

2008-01-27 Thread Marc 'BlackJack' Rintsch
On Sun, 27 Jan 2008 10:55:20 +, over wrote: On Sat, 26 Jan 2008 14:47:50 +0100, Bjoern Schliessmann [EMAIL PROTECTED] wrote: The script is essentially gone. I'd like to know how to read the pyc files, but that's getting away from my point that there is a link between python scripts and

Re: translating Python to Assembler

2008-01-27 Thread Marc 'BlackJack' Rintsch
On Sun, 27 Jan 2008 11:23:20 +, over wrote: Don't fucking tell me about assembler, you asshole. I can read disassembled code in my sleep. Yes you can read it, but obviously you don't understand it. Ciao, Marc 'BlackJack' Rintsch --

Re: Index of maximum element in list

2008-01-27 Thread Arnaud Delobelle
On Jan 27, 11:32 am, Arnaud Delobelle [EMAIL PROTECTED] wrote: [...] simple_posmax is more than 3x faster on my machine.  It's not surprising as even though the list is walked twice, it is all done in C and no new objects have to be created. Then only non-C bit is when the result of max(l)

Re: how to make format operator % work with unicode as expected

2008-01-27 Thread Colin J. Williams
Peter Pei wrote: You didn't understand my question, but thanks any way. Yes, it is true that %s already support unicode, and I did not contradict that. But it counts the number of bytes instead of characters, and makes things like %-20s out of alignment. If you don't understand my

Re: Some questions about decode/encode

2008-01-27 Thread glacier
On 1月27日, 下午7时20分, John Machin [EMAIL PROTECTED] wrote: On Jan 27, 9:17 pm, glacier [EMAIL PROTECTED] wrote: On 1月24日, 下午3时29分, Gabriel Genellina [EMAIL PROTECTED] wrote: En Thu, 24 Jan 2008 04:52:22 -0200, glacier [EMAIL PROTECTED] escribió: According to your reply, what will

Re: Some questions about decode/encode

2008-01-27 Thread glacier
On 1月27日, 下午7时04分, John Machin [EMAIL PROTECTED] wrote: On Jan 27, 9:18 pm, glacier [EMAIL PROTECTED] wrote: On 1月24日, 下午4时44分, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 23 Jan 2008 19:49:01 -0800, glacier wrote: My second question is: is there any one who has

Re: translating Python to Assembler

2008-01-27 Thread Steven D'Aprano
On Sun, 27 Jan 2008 10:55:20 +, over wrote: I can understand people thinking I'm full of beans. Oh no, not full of beans. Full of something, but not beans. Everything you have written about assembly, machine code, compilers, Linux, Python and so forth has been a confused mish-mash of

Re: how to make format operator % work with unicode as expected

2008-01-27 Thread Diez B. Roggisch
Peter Pei schrieb: I am using things like %-20s%-60s%-10s in tkinter listbox to make it look like a table, with mono sized font like lucie system. But this does not work with data contains Les misérables, because it is unicode, and one byte is not neccessary one character. Now how can I

Re: Python System information

2008-01-27 Thread Martin Saturka
How can i get system information like CPU load and RAM usage in linux. What about 'pystatgrab'? It provides good info, with a limitation - it does not have CPU info for particular CPUs, it takes just the cumulative CPU info. http://www.i-scream.org/pystatgrab/ http://packages.debian.org/statgrab

Re: raw_input(), STRANGE behaviour

2008-01-27 Thread Dox33
Yes, I know. There are several ways to work around the problem. (Look at the innitial code I provided in this discussion start) Fact is, every time I'm getting a script from somewhere or someone, I have to search and replace all the affected code. Not very conveniant. That's why I rather would

Re: Using a dict as if it were a module namespace

2008-01-27 Thread Ross Ridge
Steven D'Aprano writes: (1) Import the test and grab the values needed from it: setup = from __main__ import myfunc, test x, y = test['x'], test['y'] I don't like this one. It doesn't seem very elegant to me, and it gets unwieldy as the complexity increases. Every item I need from test has

Re: translating Python to Assembler

2008-01-27 Thread Marc 'BlackJack' Rintsch
On Sun, 27 Jan 2008 13:41:54 +, Steven D'Aprano wrote: On Sun, 27 Jan 2008 10:55:20 +, over wrote: I can understand people thinking I'm full of beans. Oh no, not full of beans. Full of something, but not beans. Everything you have written about assembly, machine code, compilers,

Re: how to make format operator % work with unicode as expected

2008-01-27 Thread Peter Pei
I V [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sun, 27 Jan 2008 05:32:40 +, Peter Pei wrote: Yes, it is true that %s already support unicode, and I did not contradict that. But it counts the number of bytes instead of characters, and makes things like %-20s out of

Re: translating Python to Assembler

2008-01-27 Thread Grant Edwards
On 2008-01-27, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Whatever is typed in a Python script must be converted to binary code. Python scripts _are_ in a binary code when the start out. -- Grant Edwards grante Yow! What UNIVERSE is

Re: how to make format operator % work with unicode as expected

2008-01-27 Thread Peter Pei
Steven D'Aprano [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sun, 27 Jan 2008 05:32:40 +, Peter Pei wrote: You didn't understand my question, but thanks any way. Yes, it is true that %s already support unicode, and I did not contradict that. But it counts the number of

Workshop Medical Imaging Systems within EUROMEDIA 2008 - Last Call for Papers

2008-01-27 Thread [EMAIL PROTECTED]
- (Apologies for cross-posting) Workshop Medical Imaging Systems within EUROSIS EUROMEDIA 2008 April 9-11, 2008, University of Porto, Porto, Portugal

Re: how to make format operator % work with unicode as expected

2008-01-27 Thread Peter Pei
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sun, 27 Jan 2008 05:32:40 +, Peter Pei wrote: You didn't understand my question, but thanks any way. Yes, it is true that %s already support unicode, and I did not contradict that. But it counts the

Python self-evaluating strings

2008-01-27 Thread Arnaud Delobelle
Hi all, An earlier post today got me thinking about quines (programs that output themselves) in Python. I tried to find some on the web but didn't find many ([1]). In particular I didn't find any that corresponded to my instinctive (LISP-induced, probably) criterion: def

Re: Klik2 Project, Python apps on linux

2008-01-27 Thread Bill Mill
Jason, Can you give a little more detail on the problem? What's the directory structure of a Klik package that's failing look like? What program is trying to import what module from where that's failing? -Bill Mill On Jan 27, 2008 1:49 AM, Jason Taylor [EMAIL PROTECTED] wrote: Hi We've been

Re: translating Python to Assembler

2008-01-27 Thread Grant Edwards
On 2008-01-27, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: I'm starting to wonder if it is possible for somebody to be simultaneously so self-assured and so ignorant, or if we're being trolled. I recently learned that this is called the Dunning-Kruger effect: The Dunning-Kruger

is it a bug?

2008-01-27 Thread Mr Shore
import threading import time class timer(threading.Thread): def __init__(self,no,interval): threading.Thread.__init__(self) self.no=no self.interval=interval def run(self): while True: print 'Thread Object (%d), Time:%s'%(self.no,time.ctime())

py3k feature proposal: field auto-assignment in constructors

2008-01-27 Thread coldpizza
There is a pattern that occurs fairly often in constructors in Python and other OOP languages. Let's take an example: class Server(object): def __init__(self, host, port, protocol, bufsize, timeout): self.host = host self.port = port self.protocol = protocol

Re: how to make format operator % work with unicode as expected

2008-01-27 Thread Marc 'BlackJack' Rintsch
On Sun, 27 Jan 2008 16:00:42 +, Peter Pei wrote: Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sun, 27 Jan 2008 05:32:40 +, Peter Pei wrote: You didn't understand my question, but thanks any way. Yes, it is true that %s already support

Bash the Bush [WAS: Re: translating Python to Assembler]

2008-01-27 Thread Wildemar Wildenburger
Grant Edwards wrote: On 2008-01-27, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: The Dunning-Kruger effect is the phenomenon wherein people who have little knowledge think that they know more than others who have much more knowledge. [snip] [snip as well] ... must restist ...

REALLY simple xml reader

2008-01-27 Thread Simon Pickles
Hi Can anyone suggest a really simple XML reader for python? I just want to be able to do something like this: xmlDoc = xml.open(file.xml) element = xmlDoc.GetElement(foo/bar) ... to read the value of: foo bar42/bar /foo Thanks Simon -- Linux user #458601 - http://counter.li.org.

Re: getting values from cache

2008-01-27 Thread Gabriel Genellina
En Sat, 26 Jan 2008 05:21:52 -0200, nodrogbrown [EMAIL PROTECTED] escribi�: hi i am writing code to check a folder containing images and then process thir vals using PIL and do some calc to create a matrix of values .if the folder has any new imgs added the program will do all calc again

Re: REALLY simple xml reader

2008-01-27 Thread Diez B. Roggisch
Simon Pickles schrieb: Hi Can anyone suggest a really simple XML reader for python? I just want to be able to do something like this: xmlDoc = xml.open(file.xml) element = xmlDoc.GetElement(foo/bar) ... to read the value of: foo bar42/bar /foo Since python2.5, the ElementTree

Re: py3k feature proposal: field auto-assignment in constructors

2008-01-27 Thread André
On Jan 27, 1:06 pm, coldpizza [EMAIL PROTECTED] wrote: There is a pattern that occurs fairly often in constructors in Python and other OOP languages. Let's take an example: class Server(object): def __init__(self, host, port, protocol, bufsize, timeout): self.host = host

Re: Exceptions on delete in pysqlite

2008-01-27 Thread Gabriel Genellina
En Fri, 25 Jan 2008 22:12:57 -0200, Wildemar Wildenburger [EMAIL PROTECTED] escribi�: Using pysqlite, I'd like to check if some dataset that I removed has been in the database at all. Ideally I'd like pysqlite to raise an Exception if deleting does nothing. Is that possible? I don't think

Re: REALLY simple xml reader

2008-01-27 Thread Mark Tolonen
Simon Pickles [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Can anyone suggest a really simple XML reader for python? I just want to be able to do something like this: xmlDoc = xml.open(file.xml) element = xmlDoc.GetElement(foo/bar) ... to read the value of: foo

Re: Exceptions on delete in pysqlite

2008-01-27 Thread Wildemar Wildenburger
Gabriel Genellina wrote: En Fri, 25 Jan 2008 22:12:57 -0200, Wildemar Wildenburger [EMAIL PROTECTED] escribi�: Using pysqlite, I'd like to check if some dataset that I removed has been in the database at all. Ideally I'd like pysqlite to raise an Exception if deleting does nothing. Is that

Re: Using a dict as if it were a module namespace

2008-01-27 Thread Steven Bethard
Steven D'Aprano wrote: I have a problem which I think could be solved by using a dict as a namespace, in a similar way that exec and eval do. When using the timeit module, it is very inconvenient to have to define functions as strings. A good alternative is to create the function as

Re: How to modify the content of an email

2008-01-27 Thread Gabriel Genellina
En Fri, 25 Jan 2008 20:59:41 -0200, [EMAIL PROTECTED] escribi�: Hello, I'm trying to make a python script that take an email in (raw) text format, and add a footer to the text (or html) body of the email. I'm aware of the email and email.mime modules, but I can't figure out how to identify

Re: py3k feature proposal: field auto-assignment in constructors

2008-01-27 Thread Wildemar Wildenburger
André wrote: Personally, I like the idea you suggest, with the modification that I would use . instead of @, as in class Server(object): def __init__(self, .host, .port, .protocol, .bufsize, .timeout): pass I like :) However, you can probably cook up a decorator for this (not

Re: python regex: misbehaviour with \r (0x0D) as Newline character in Unicode Mode

2008-01-27 Thread Fredrik Lundh
Arian Sanusi wrote: concerning to unicode, \n, \r and \r\n (0x000A, 0x000D and 0x000D+0x000A) should be threatened as newline character the link says that your application should treat them line terminators, not that they should all be equal to a new line character. to split on Unicode line

Re: py3k feature proposal: field auto-assignment in constructors

2008-01-27 Thread Diez B. Roggisch
Wildemar Wildenburger schrieb: André wrote: Personally, I like the idea you suggest, with the modification that I would use . instead of @, as in class Server(object): def __init__(self, .host, .port, .protocol, .bufsize, .timeout): pass I like :) However, you can probably

Re: ElementTree.fromstring(unicode_html)

2008-01-27 Thread Fredrik Lundh
globophobe wrote: In [1]: unicode_html = u'\u3055\u3080\u3044\uff0f\r\n\u3064\u3081\u305f \u3044\r\n' I need to turn this into an elementtree, but some of the data is japanese whereas the rest is html. This string contains a br /. where? br / is an element, not a character. \r and \n are

Re: REALLY simple xml reader

2008-01-27 Thread Navtej Singh
check the implementation of XMLNode class here http://hsivonen.iki.fi/group-feed/flickrapi.py HTH N On Jan 27, 2008 11:05 PM, Simon Pickles [EMAIL PROTECTED] wrote: Hi Can anyone suggest a really simple XML reader for python? I just want to be able to do something like this: xmlDoc =

Re: Python self-evaluating strings

2008-01-27 Thread dg . google . groups
It's a bit cheap, but how about from inspect import getsource print getsource(getsource) or similarly def f(g): import inspect return inspect.getsource(g) print f(f) Dan -- http://mail.python.org/mailman/listinfo/python-list

ANN: Leo 4.4.6 final released

2008-01-27 Thread Edward K Ream
Leo 4.4.6 final is available at: http://sourceforge.net/project/showfiles.php?group_id=3458package_id=29106 Leo 4.4.6 fixes several recently reported bugs, all minor. Leo is a text editor, data organizer, project manager and much more. See: http://webpages.charter.net/edreamleo/intro.html The

Re: raw_input(), STRANGE behaviour

2008-01-27 Thread Gabriel Genellina
En Sun, 27 Jan 2008 12:51:51 -0200, Dox33 [EMAIL PROTECTED] escribi�: Yes, I know. There are several ways to work around the problem. (Look at the innitial code I provided in this discussion start) Fact is, every time I'm getting a script from somewhere or someone, I have to search and

Re: py3k feature proposal: field auto-assignment in constructors

2008-01-27 Thread Torsten Bronger
Hallöchen! Wildemar Wildenburger writes: André wrote: Personally, I like the idea you suggest, with the modification that I would use . instead of @, as in class Server(object): def __init__(self, .host, .port, .protocol, .bufsize, .timeout): pass I like :) However, you

Re: py3k feature proposal: field auto-assignment in constructors

2008-01-27 Thread Wildemar Wildenburger
Diez B. Roggisch wrote: Just for the fun of it, I implemented a decorator: from functools import * from inspect import * def autoassign(_init_): @wraps(_init_) def _autoassign(self, *args, **kwargs): argnames, _, _, _ = getargspec(_init_) for name, value in

Re: read and readline hanging

2008-01-27 Thread Olivier Lefevre
The `trheading` module is modeled after Java's threading API. OK. Thanks for the hint. However BufferedReader.readline() does not block in Java, so it is still difficult to transpose. But how can I find out *programmatically* that there is no more input? You can't. How do people handle

Re: py3k feature proposal: field auto-assignment in constructors

2008-01-27 Thread André
On Jan 27, 2:48 pm, Wildemar Wildenburger [EMAIL PROTECTED] wrote: Diez B. Roggisch wrote: Just for the fun of it, I implemented a decorator: from functools import * from inspect import * def autoassign(_init_): @wraps(_init_) def _autoassign(self, *args, **kwargs):

Re: Python self-evaluating strings

2008-01-27 Thread Boris Borcic
Now there's always that style : print x Traceback (most recent call last): File pyshell#15, line 1, in module eval(x) File string, line 2 Traceback (most recent call last): ^ SyntaxError: invalid syntax eval(x) Traceback (most recent call last):

Re: read and readline hanging

2008-01-27 Thread Olivier Lefevre
Indeed, if I do this interactively, I can tell after 3 lines that I've gotten all there is to get right now and the fourth readline() call hangs. Can you really? Yes interactively: at the command prompt, you can tell when it's over because you know the command you just sent and whether it

explicit protocols and duck typing

2008-01-27 Thread dg . google . groups
Hi all, As I understand it, the idea behind duck typing is that you just take an object and if it has the methods you want to use you use it assuming it to be the right type of object. I'm interested in extending this idea a bit, but I feel the sort of thing I have in mind has already been

Re: Replacing a package with another

2008-01-27 Thread Gabriel Genellina
En Sat, 26 Jan 2008 12:10:03 -0200, J. Pablo Fernández [EMAIL PROTECTED] escribi�: Is it possible to replace one package with another at runtime, that is, I have package a.blah which I want instead of b.blah, so I can inject functionality in an existing package? It might be done, just

strftime return value encoding (mbcs, locale, etc.)

2008-01-27 Thread Giovanni Bajo
Hello, I am trying to find a good way to portably get the output of strftime() and put it onto a dialog (I'm using PyQt, but it doesn't really matter). The problem is that I need to decode the byte stream returned by strftime () into Unicode. This old bug:

Re: Klik2 Project, Python apps on linux

2008-01-27 Thread Jason Taylor
Perhaps this would help, heres a list of our error reports http://klik.atekon.de/feedback/details.php?e=ImportError On 27/01/2008, Jason Taylor [EMAIL PROTECTED] wrote: Hi We've been working on klik2, http://code.google.com/p/klikclient/, which implements OSX like application files on linux

Re: Some questions about decode/encode

2008-01-27 Thread Martin v. Löwis
Is there any way to solve this better? I mean if I shouldn't convert the GBK string to unicode string, what should I do to make SAX work? Decode it and then encode it to utf-8 before feeding it to the parser. The tricky part is that you also need to change the encoding declaration in doing

Re: is it a bug?

2008-01-27 Thread Gabriel Genellina
En Sun, 27 Jan 2008 14:21:20 -0200, Mr Shore [EMAIL PROTECTED] escribi�: import threading import time class timer(threading.Thread): def __init__(self,no,interval): threading.Thread.__init__(self) self.no=no self.interval=interval def run(self):

Re: Some questions about decode/encode

2008-01-27 Thread Mark Tolonen
John Machin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Jan 27, 9:17 pm, glacier [EMAIL PROTECTED] wrote: On 1月24日, 下午3时29分, Gabriel Genellina [EMAIL PROTECTED] wrote: *IF* the file is well-formed GBK, then the codec will not mess up when decoding it to Unicode. The usual

Re: Minimum Requirements for Python

2008-01-27 Thread [EMAIL PROTECTED]
On 25 jan, 12:50, [EMAIL PROTECTED] wrote: Can someone tell me the minimum requitements for Python as I can't find it anwhere on the site. I have 3 PC's which are only 256mb RAM, wanted to know if this was sufficenent. The first machine I installed Python on was a pentium133 with 32mb ram. --

Re: strftime return value encoding (mbcs, locale, etc.)

2008-01-27 Thread Mark Tolonen
Giovanni Bajo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I am trying to find a good way to portably get the output of strftime() and put it onto a dialog (I'm using PyQt, but it doesn't really matter). The problem is that I need to decode the byte stream returned by

python valentine

2008-01-27 Thread nurple11
Slightly off-topic, but this is the best Valentine's Day card I've seen in a while: http://unholidaycards.com/code.html I think I just might get some for my lab. #!/usr/bin/env python from relationships import * from alcohol import shot, beer def valentines_day(self): if self.dating:

Re: Some questions about decode/encode

2008-01-27 Thread John Machin
On Jan 28, 7:47 am, Mark Tolonen [EMAIL PROTECTED] wrote: John Machin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Jan 27, 9:17 pm, glacier [EMAIL PROTECTED] wrote: On 1月24日, 下午3时29分, Gabriel Genellina [EMAIL PROTECTED] wrote: *IF* the file is well-formed GBK, then the

optional static typing for Python

2008-01-27 Thread Russ P.
A while back I came across a tentative proposal from way back in 2000 for optional static typing in Python: http://www.python.org/~guido/static-typing Two motivations were given: -- faster code -- better compile-time error detection I'd like to suggest a third, which could help extend

Re: strftime return value encoding (mbcs, locale, etc.)

2008-01-27 Thread Martin v. Löwis
LookupError: unknown encoding: cp932 What Python version are you using? cp932 is supported cross-platform since Python 2.4. So: what is the correct code to achieve this? Will something like this work: data = strftime(%#c, localtime()) if os.name == nt: data =

Re: translating Python to Assembler

2008-01-27 Thread John Machin
On Jan 27, 10:23 pm, [EMAIL PROTECTED] wrote: [EMAIL PROTECTED]:~$ ndisasm error.txt 54push sp 0001 686973push word 0x7369 0004 206973and [bx+di+0x73],ch 0007 206E6Fand [bp+0x6f],ch 000A 7420

Re: read and readline hanging

2008-01-27 Thread Thomas Bellman
Olivier Lefevre [EMAIL PROTECTED] wrote: Can you really? Yes interactively: at the command prompt, you can tell when it's over because you know the command you just sent and whether it requires an answer and of which kind. Also, even if there is no answer you get a fresh prompt when the

Re: explicit protocols and duck typing

2008-01-27 Thread Arnaud Delobelle
On Jan 27, 7:10 pm, [EMAIL PROTECTED] wrote: Hi all, As I understand it, the idea behind duck typing is that you just take an object and if it has the methods you want to use you use it assuming it to be the right type of object. I'm interested in extending this idea a bit, but I feel the

Re: optional static typing for Python

2008-01-27 Thread André
On Jan 27, 6:19 pm, Russ P. [EMAIL PROTECTED] wrote: A while back I came across a tentative proposal from way back in 2000 for optional static typing in Python: http://www.python.org/~guido/static-typing Two motivations were given: -- faster code -- better compile-time error

Re: optional static typing for Python

2008-01-27 Thread Jarek Zgoda
Russ P. pisze: I noticed that Guido has expressed further interest in static typing three or four years ago on his blog. Does anyone know the current status of this project? Thanks. I thought it was april fools joke? -- Jarek Zgoda http://zgodowie.org/ We read Knuth so you don't have to -

Re: optional static typing for Python

2008-01-27 Thread Russ P.
On Jan 27, 2:36 pm, Jarek Zgoda [EMAIL PROTECTED] wrote: Russ P. pisze: I noticed that Guido has expressed further interest in static typing three or four years ago on his blog. Does anyone know the current status of this project? Thanks. I thought it was april fools joke? On January

Re: translating Python to Assembler

2008-01-27 Thread ajaksu
This message got huge :/ Sorry for being so cryptic and unhelpful. I now believe that you're incurring in a (quite deep) misunderstanding and wish to make things clear for both of us :) On Jan 27, 6:58 am, [EMAIL PROTECTED] wrote: On Fri, 25 Jan 2008 17:44:07 -0800 (PST), ajaksu [EMAIL

Re: optional static typing for Python

2008-01-27 Thread Russ P.
On Jan 27, 2:49 pm, André [EMAIL PROTECTED] wrote: On Jan 27, 6:19 pm, Russ P. [EMAIL PROTECTED] wrote: A while back I came across a tentative proposal from way back in 2000 for optional static typing in Python: http://www.python.org/~guido/static-typing Two motivations were given:

Re: Python System information

2008-01-27 Thread NMBooker
On Jan 27, 2:23 pm, Martin Saturka [EMAIL PROTECTED] wrote: How can i get system information like CPU load and RAM usage in linux. What about 'pystatgrab'? It provides good info, with a limitation - it does not have CPU info for particular CPUs, it takes just the cumulative CPU

Re: optional static typing for Python

2008-01-27 Thread Jarek Zgoda
Russ P. pisze: I noticed that Guido has expressed further interest in static typing three or four years ago on his blog. Does anyone know the current status of this project? Thanks. I thought it was april fools joke? On January 21, 2000? Which calendar do you use? Static typing in Python

Python Genetic Algorithm

2008-01-27 Thread Max
Hi all. I'm just getting introduced to Python (mostly through Dive Into Python), and I've decided to use it for a project where I have to write my own Genetic Algorithm. Even if you don't know about GAs, you might be able to help with an issue I'm having. I'm just starting the project off, so I'm

Re: optional static typing for Python

2008-01-27 Thread Russ P.
On Jan 27, 3:08 pm, Jarek Zgoda [EMAIL PROTECTED] wrote: Russ P. pisze: I noticed that Guido has expressed further interest in static typing three or four years ago on his blog. Does anyone know the current status of this project? Thanks. I thought it was april fools joke? On January

Re: optional static typing for Python

2008-01-27 Thread Arnaud Delobelle
On Jan 27, 11:00 pm, Russ P. [EMAIL PROTECTED] wrote: On Jan 27, 2:49 pm, André [EMAIL PROTECTED] wrote: Perhaps this:http://www.python.org/dev/peps/pep-3107/mightbe relevant? André Thanks. If I read this correctly, this PEP is on track for Python 3.0. Wonderful! Note that annotations

  1   2   3   >