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

2008-01-27 Thread Steven D'Aprano
On Sun, 27 Jan 2008 11:16:00 -0700, Steven Bethard wrote: > Why not mess with the namespace inside the setup code? E.g.:: [snip] Ah, thanks, good thinking. It's not perfect, but it should be close enough for what I'm trying to do. -- Steven who still wishes you could explicitly pass a namespa

Re: [wxPython-users] Issue with docking wx.listctrl window

2008-01-27 Thread tarun
Robin, I can use sizers and divide my frames into sections. But I also want to add menu options for display/hide window1 and window2 in my original example. Is this possible even if I use sizers. Regards, Tarun On Jan 28, 2008 1:09 PM, tarun <[EMAIL PROTECTED]> wrote: > Thanks Robin. > Can you pl

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

2008-01-27 Thread Steven D'Aprano
On Mon, 28 Jan 2008 08:04:05 +0100, Torsten Bronger wrote: >> Are you referring to the alternate syntax or to the decorator? Either >> way, you could be saving 4 or 5 or more lines, if you have enough >> arguments. > > Mostly, I write them in one or two lines, e.g. > > def __init__(self, id,

Re: [wxPython-users] Issue with docking wx.listctrl window

2008-01-27 Thread tarun
Thanks Robin. Can you please elobrate more on this. Regards, Tarun Devnani On Jan 25, 2008 10:24 PM, Robin Dunn <[EMAIL PROTECTED]> wrote: > tarun wrote: > > Thanks a lot Robin. > > > > I tried using self.log and instead of self.log.list. *Code is attached.* > > But this gives me a panel and list

Re: Python Standardization: Wikipedia entry

2008-01-27 Thread Paddy
On Jan 28, 4:44 am, "Russ P." <[EMAIL PROTECTED]> wrote: > On Jan 27, 5:41 pm, Roy Smith <[EMAIL PROTECTED]> wrote: > > > > > In article > > <[EMAIL PROTECTED]>, > > > ajaksu <[EMAIL PROTECTED]> wrote: > > > On Jan 27, 10:32 pm, Paddy <[EMAIL PROTECTED]> wrote: > > > > I would value the opinion of

Re: optional static typing for Python

2008-01-27 Thread Paul Rubin
Paddy <[EMAIL PROTECTED]> writes: > > Fair enough. My main issue was against the notion that random testing > > is the only thing necessary. > > Sorry Paul if I may have given that impression, its just that when you > bring in random testing to a design that until then had only directed > tests y

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

2008-01-27 Thread Paddy
On Jan 27, 5: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 = ho

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

2008-01-27 Thread Torsten Bronger
Hallöchen! Dustan writes: > On Jan 27, 12:41 pm, Torsten Bronger <[EMAIL PROTECTED]> > wrote: > >> [...] >> >> Well, you save one or two lines per class. Not enough in my >> opinion. > > Are you referring to the alternate syntax or to the decorator? > Either way, you could be saving 4 or 5 or mo

Do You Want a GSM Mobile with Amazing Features? Please click here

2008-01-27 Thread Farooq
www.enmac.com.hk GSM Mobile Phones, Digital iPods, Digital Clocks, Digital Pens, Digital Quran. Enjoy these products with Islamic Features (Complete Holy Quran with Text and Audio, Tafaseer books, Ahadees Books, Daily Supplications, Universal Qibla Direction, Prayer Timing and much more) visit our

Re: optional static typing for Python

2008-01-27 Thread Paddy
On Jan 28, 6:17 am, Paul Rubin wrote: > Paddy <[EMAIL PROTECTED]> writes: > > Given the complexity of current microprocessors i'm guessing that > > their previous testing methods would be too good to just junk in > > totality because the FDIV bug was not found. Similarly

Re: Some questions about decode/encode

2008-01-27 Thread John Machin
On Jan 28, 2:53 pm, glacier <[EMAIL PROTECTED]> wrote: > > Thanks,John. > It's no doubt that you proved SAX didn't support GBK encoding. > But can you give some suggestion on how to make SAX parse some GBK > string? Yes, the same suggestion as was given to you by others very early in this thread,

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

2008-01-27 Thread Russ P.
On Jan 27, 7:33 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > "Russ P." <[EMAIL PROTECTED]> writes: > > On Jan 27, 5:13 pm, Wildemar Wildenburger > > <[EMAIL PROTECTED]> wrote: > > > class Server(object): > > > def __init__(self, self.host, self.port, > > > self.protocol, self.

Re: optional static typing for Python

2008-01-27 Thread Paul Rubin
Paddy <[EMAIL PROTECTED]> writes: > Given the complexity of current microprocessors i'm guessing that > their previous testing methods would be too good to just junk in > totality because the FDIV bug was not found. Similarly if they were > not using formal methods then it makes sense to add it too

Re: optional static typing for Python

2008-01-27 Thread Paddy
On Jan 28, 1:56 am, Paul Rubin wrote: > Paddy <[EMAIL PROTECTED]> writes: > > I would rather advocate such random test generation methods as being > > more appropriate for testing software in safety critical systems when > > the programming language is dynamic. > > That m

Re: getting values from cache

2008-01-27 Thread jimgardener
> > I'd try to avoid duplicating the calculation code. > > Also, if you split the data in two, you can just read the filename list > alone: thanx G those were good suggestions gordon -- http://mail.python.org/mailman/listinfo/python-list

Re: raw_input(), STRANGE behaviour

2008-01-27 Thread sevenbark
On Sat, 26 Jan 2008 04:23:36 -0800 (PST), Dox33 <[EMAIL PROTECTED]> wrote: >WHERE IS THE SECOND LINE? >It is in the file stderr_catch.txt!!! > > See the problem? >Please Tell me? Why is the prompt produced by raw_input() printed to >the error channel? It should be stdout, just as the print s

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

2008-01-27 Thread Gabriel Genellina
En Sun, 27 Jan 2008 23:51:28 -0200, Arnaud Delobelle <[EMAIL PROTECTED]> escribió: > Nice! I've got a slight variation without magic argument names: > > class Test(object): > @autoassign('foo', 'bar') > def __init__(self, baz): > print 'baz =', baz > En Mon, 28 Jan 2008 00:0

Re: Python Standardization: Wikipedia entry

2008-01-27 Thread Russ P.
On Jan 27, 5:41 pm, Roy Smith <[EMAIL PROTECTED]> wrote: > In article > <[EMAIL PROTECTED]>, > > > > ajaksu <[EMAIL PROTECTED]> wrote: > > On Jan 27, 10:32 pm, Paddy <[EMAIL PROTECTED]> wrote: > > > I would value the opinion of fellow Pythoneers who have also > > > contributed to Wikipedia, on the

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

2008-01-27 Thread Tim Chase
> This is neat. :) Could that maybe be extended to only assign selected > args to the instance and let others pass unchanged. So that, for instance: > > @autoassign("foo", "bar") > def __init__(self, foo, bar, baz): > super(baz) I've seen some folks import inspect/functools, but from my tes

Re: Some questions about decode/encode

2008-01-27 Thread glacier
On 1月28日, 上午5时50分, John Machin <[EMAIL PROTECTED]> wrote: > 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时

Re: optional static typing for Python

2008-01-27 Thread Kay Schluehr
On Jan 28, 12:22 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > 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

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

2008-01-27 Thread Ben Finney
"Russ P." <[EMAIL PROTECTED]> writes: > On Jan 27, 5:13 pm, Wildemar Wildenburger > <[EMAIL PROTECTED]> wrote: > > class Server(object): > > def __init__(self, self.host, self.port, > > self.protocol, self.bufsize, self.timeout): > > pass > > > > ? > > That makes s

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

2008-01-27 Thread André
On Jan 27, 10:57 pm, Paul Rubin wrote: > Wildemar Wildenburger <[EMAIL PROTECTED]> writes: > > class Server(object): > > def __init__(self, self.host, self.port, > > self.protocol, self.bufsize, self.timeout): > > pass > > ? > > That could

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

2008-01-27 Thread Paul Rubin
Wildemar Wildenburger <[EMAIL PROTECTED]> writes: > class Server(object): > def __init__(self, self.host, self.port, > self.protocol, self.bufsize, self.timeout): > pass > ? That could temporarily bind those attributes but it shouldn't persistently mutate the object

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

2008-01-27 Thread Russ P.
On Jan 27, 5:13 pm, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Ben Finney wrote: > > "André" <[EMAIL PROTECTED]> writes: > > >> Personally, I like the idea you suggest, with the modification that I > >> would use "." instead of "@", as in > > >> class Server(object): > >> def __init__(s

Re: Struct.Pack and Binary files

2008-01-27 Thread Grant Edwards
On 2008-01-28, PurpleServerMonkey <[EMAIL PROTECTED]> wrote: > Having trouble working out an appropriate format string for packing a > binary file. > > The below is something I use for ASCII files but now I need something > equivalent for working with binary files i.e jpg, zips etc. > > fileHandle

Re: read and readline hanging

2008-01-27 Thread Karthik Gurusamy
On Jan 27, 11:08 am, Olivier Lefevre <[EMAIL PROTECTED]> wrote: > >> 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 ca

Re: optional static typing for Python

2008-01-27 Thread Terry Reedy
"Russ P." <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |> Perhaps this:http://www.python.org/dev/peps/pep-3107/might be relevant? | Thanks. If I read this correctly, this PEP is on track for Python 3.0. Wonderful! If you experiment with static analysis using annotations, I am sur

Re: optional static typing for Python

2008-01-27 Thread Russ P.
On Jan 27, 5:03 pm, Paddy > If static typing is optional then a program written in a dynamic > language that passes such an automated static analysis of source code > would have to be a simple program written in a simplistic way, and > also in a static style. Yes, but for safety-critical software

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

2008-01-27 Thread André
On Jan 27, 9:47 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sun, 27 Jan 2008 19:13:27 -0500, Terry Reedy wrote: > > [snip] > > > class Test(object): > > @autoassign > > def __init__(self, _foo, _bar, baz): > > print 'baz =', baz > > [snip] > > > I think

Re: optional static typing for Python

2008-01-27 Thread Paul Rubin
Paddy <[EMAIL PROTECTED]> writes: > I would rather advocate such random test generation methods as being > more appropriate for testing software in safety critical systems when > the programming language is dynamic. That method totally failed to find the Pentium FDIV bug, and they use static proof

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

2008-01-27 Thread Arnaud Delobelle
On Jan 28, 1:47 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: [...] > As nice as this feature would be, and I vote +2 on the functionality, I > wonder whether the amount of line noise in method definitions now will be > approaching Perlish levels? We've got default values, type

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

2008-01-27 Thread Arnaud Delobelle
On Jan 27, 6:32 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > 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, .

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

2008-01-27 Thread Steven D'Aprano
On Sun, 27 Jan 2008 19:13:27 -0500, Terry Reedy wrote: [snip] > class Test(object): > @autoassign > def __init__(self, _foo, _bar, baz): > print 'baz =', baz [snip] > I think this version, with this name convention, is nice enough to > possibly go in the stdlib if there were

Re: Python Standardization: Wikipedia entry

2008-01-27 Thread Roy Smith
In article <[EMAIL PROTECTED]>, ajaksu <[EMAIL PROTECTED]> wrote: > On Jan 27, 10:32 pm, Paddy <[EMAIL PROTECTED]> wrote: > > I would value the opinion of fellow Pythoneers who have also > > contributed to Wikipedia, on the issue of "Is Python Standardized". > > Specifically in the context of th

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

2008-01-27 Thread Christian Heimes
Paul McGuire wrote: > I thought at one time there was to be a "decorators" module in the > stdlib for just this kind of useful item. At minimum, you could post > this to the Python wiki at http://wiki.python.org/moin/PythonDecoratorLibrary. Please take the idea to the Python developer list. Seve

Re: Python Genetic Algorithm

2008-01-27 Thread Steven D'Aprano
On Mon, 28 Jan 2008 00:35:51 +0100, Wildemar Wildenburger wrote: > Max wrote: >> In GAs, you operate on a Population of solutions. Each Individual from >> the Population is a potential solution to the problem you're >> optimizing, and Individuals have what's called a chromosome - a >> specificatio

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

2008-01-27 Thread MRAB
On Jan 28, 1:01 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Mon, 28 Jan 2008 00:39:02 +0100, Wildemar Wildenburger wrote: > > Dustan wrote: > >>> Well, you save one or two lines per class. Not enough in my opinion. > > >> Are you referring to the alternate syntax or to t

Re: Python Genetic Algorithm

2008-01-27 Thread Max
On Jan 27, 8:01 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Max" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > | In GAs, you operate on a Population of solutions. Each Individual from > | the Population is a potential solution to the problem you're > | optimizing, and Indivi

Struct.Pack and Binary files

2008-01-27 Thread PurpleServerMonkey
Having trouble working out an appropriate format string for packing a binary file. The below is something I use for ASCII files but now I need something equivalent for working with binary files i.e jpg, zips etc. fileHandle = open("test.txt") while loop: fileBuffer = fileHandle.read(

Re: Python Standardization: Wikipedia entry

2008-01-27 Thread Paddy
On Jan 28, 1:05 am, ajaksu <[EMAIL PROTECTED]> wrote: > On Jan 27, 10:32 pm, Paddy <[EMAIL PROTECTED]> wrote: > > > I would value the opinion of fellow Pythoneers who have also > > contributed to Wikipedia, on the issue of "Is Python Standardized". > > Specifically in the context of this table: > >

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

2008-01-27 Thread Paul McGuire
On Jan 27, 6:13 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > I think this version, with this name convention, is nice enough to possibly > go in the stdlib if there were an appropriate place for it.  Not sure where > though.  If there were a classtools module > > tjr +1 I thought at one t

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

2008-01-27 Thread Wildemar Wildenburger
Ben Finney wrote: > "André" <[EMAIL PROTECTED]> writes: > >> 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 > > -1. >

Re: Python Standardization: Wikipedia entry

2008-01-27 Thread ajaksu
On Jan 27, 10:32 pm, Paddy <[EMAIL PROTECTED]> wrote: > I would value the opinion of fellow Pythoneers who have also > contributed to Wikipedia, on the issue of "Is Python Standardized". > Specifically in the context of this table: > http://en.wikipedia.org/wiki/Comparison_of_programming_languages

Re: optional static typing for Python

2008-01-27 Thread Paddy
On Jan 27, 10: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-tim

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

2008-01-27 Thread Steven D'Aprano
On Mon, 28 Jan 2008 00:39:02 +0100, Wildemar Wildenburger wrote: > Dustan wrote: >>> Well, you save one or two lines per class. Not enough in my opinion. >> >> Are you referring to the alternate syntax or to the decorator? Either >> way, you could be saving 4 or 5 or more lines, if you have enou

Re: Python Genetic Algorithm

2008-01-27 Thread Terry Reedy
"Max" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | In GAs, you operate on a Population of solutions. Each Individual from | the Population is a potential solution to the problem you're | optimizing, and Individuals have what's called a chromosome - a | specification of what it co

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

2008-01-27 Thread Ben Finney
"André" <[EMAIL PROTECTED]> writes: > 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 -1. That leading dot is too easy to m

Re: Python Genetic Algorithm

2008-01-27 Thread Max
On Jan 27, 7:25 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sun, 27 Jan 2008 15:09:52 -0800, Max wrote: > > 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 Genet

Python Standardization: Wikipedia entry

2008-01-27 Thread Paddy
I would value the opinion of fellow Pythoneers who have also contributed to Wikipedia, on the issue of "Is Python Standardized". Specifically in the context of this table: http://en.wikipedia.org/wiki/Comparison_of_programming_languages#General_comparison (Comparison of programming languages)

Re: Python Genetic Algorithm

2008-01-27 Thread Steven D'Aprano
On Sun, 27 Jan 2008 15:09:52 -0800, Max wrote: > 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

Re: explicit protocols and duck typing

2008-01-27 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | 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

Re: Python Genetic Algorithm

2008-01-27 Thread Max
On Jan 27, 7:01 pm, "Steven Clark" <[EMAIL PROTECTED]> wrote: > Why not make chromosome itself a class? > > class BasicChromosome(object): > def __init__(self, data): > self.data = data > > def crossover(self): > [stuff here] > > You can subclass this as needed, altering the

Re: Python Genetic Algorithm

2008-01-27 Thread Max
On Jan 27, 6:35 pm, Wildemar Wildenburger <[EMAIL PROTECTED]> wrote: > Max wrote: > > In GAs, you operate on a Population of solutions. Each Individual from > > the Population is a potential solution to the problem you're > > optimizing, and Individuals have what's called a chromosome - a > > speci

Re: Python self-evaluating strings

2008-01-27 Thread Arnaud Delobelle
On Jan 27, 11:58 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message > Some years ago there was a substantial thread on this, (Shortest > Self-Reproducing Programs, or some such) including a fairly long one from > me that gave several 'shortest' (

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

2008-01-27 Thread Terry Reedy
"André" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] If one goes back to the original idea instead, the decision of using automatic assignment should depend on the signature of the __init__ function. Here's an implementation (using "_" instead of "." as it would lead to a syntax e

Re: Python self-evaluating strings

2008-01-27 Thread Arnaud Delobelle
On Jan 27, 4:14 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: [...] > 1. Starting from the classic idea (lambda x:x%x)('lambda x:x%x') I got   > the following > v=(lambda x:x%('"''""'+x+'"''""'))("""(lambda x:x%%('"''""'+x+'"''""')) > (%s)""") A bit more readable: v1=(lambda x:x%('r\"'+x+'\"'))

Re: Python Genetic Algorithm

2008-01-27 Thread Steven Clark
Why not make chromosome itself a class? class BasicChromosome(object): def __init__(self, data): self.data = data def crossover(self): [stuff here] You can subclass this as needed, altering the crossover method as necessary. ...perhaps I didn't understand your question.

Re: Python self-evaluating strings

2008-01-27 Thread Terry Reedy
"Arnaud Delobelle" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | 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

Re: optional static typing for Python

2008-01-27 Thread Christian Heimes
Arnaud Delobelle wrote: > 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

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

2008-01-27 Thread Wildemar Wildenburger
Dustan wrote: >> Well, you save one or two lines per class. Not enough in my >> opinion. > > Are you referring to the alternate syntax or to the decorator? Either > way, you could be saving 4 or 5 or more lines, if you have enough > arguments. OK, but then again, every decent IDE should give you

Re: Python Genetic Algorithm

2008-01-27 Thread Wildemar Wildenburger
Max wrote: > In GAs, you operate on a Population of solutions. Each Individual from > the Population is a potential solution to the problem you're > optimizing, and Individuals have what's called a chromosome - a > specification of what it contains. For example, common chromosomes are > bit strings

Re: optional static typing for Python

2008-01-27 Thread ajaksu
On Jan 27, 9:13 pm, "Russ P." <[EMAIL PROTECTED]> wrote: > 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 > > >>>

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

2008-01-27 Thread Dustan
On Jan 27, 12:41 pm, Torsten Bronger <[EMAIL PROTECTED]> wrote: > 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_

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 t

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 jo

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 s

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 typin

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 > inf

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 motiv

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 PROTECT

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

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

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 t

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

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: 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 = data.d

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 > >> >

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 P

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 w

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: 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 return

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 Un

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 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

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

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: http://mail.python.org/pipermail/pytho

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

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 thought

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 whet

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 "", line 1, in eval(x) File "", line 2 Traceback (most recent call last): ^ SyntaxError: invalid syntax >>> eval(x) Traceback (most recent call last): File "", lin

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, **k

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 han

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 a

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, valu

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

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

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: 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 . where? is an element, not a character. "\r" and "\n" are

  1   2   >