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

2008-01-28 Thread Russ P.
On Jan 27, 11:47 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > 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 > >> argu

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

2008-01-28 Thread Steven D'Aprano
On Sun, 27 Jan 2008 10:04:06 -0500, Ross Ridge wrote: > I think this is the way to go as it follows the principle of "say what > you mean." You can however simplify it, and repeat yourself less, by > using the extended call syntax: > > expr = "myfunc(**test)" > setup = """from __main

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

2008-01-28 Thread Ben Finney
"Russ P." <[EMAIL PROTECTED]> writes: > OK, then how about a special function that could be called from > inside the constructor (or anywhere else for that matter) to > initialize a list of data members. For example, > > self.__set__(host, port, protocol, bufsize, > timeout) > > This would b

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

2008-01-28 Thread Torsten Bronger
Hallöchen! Steven D'Aprano writes: > 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 tw

Re: raw_input(), STRANGE behaviour

2008-01-28 Thread Dox33
YES! This is what I was looking for. Great! All works fine now. Thank you very much Gabriel. Gabriel Genellina schreef: > Add this on your sitecustomize.py module (or create one) > > import sys > def raw_input(prompt=None): >if prompt: sys.stdout.write(prompt) >return original_raw_input()

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

2008-01-28 Thread Steven D'Aprano
On Mon, 28 Jan 2008 19:21:48 +1100, Ben Finney wrote: > In fact, here's a variation that doesn't even need a language > change:: > > >>> class Foo(object): > ... def __init__(self, spam, eggs, beans): > ... self.__dict__.update(dict( > ... (name, value) for

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

2008-01-28 Thread Russ P.
On Jan 28, 12:21 am, Ben Finney <[EMAIL PROTECTED]> wrote: > "Russ P." <[EMAIL PROTECTED]> writes: > > OK, then how about a special function that could be called from > > inside the constructor (or anywhere else for that matter) to > > initialize a list of data members. For example, > > > self.__se

Set ulimit when using subprocess.Popen?

2008-01-28 Thread Jarek Zgoda
Hi, all, anybody has an idea on how to set ulimit (-v in my case, linux) for process started using subprocess.Popen? -- Jarek Zgoda Skype: jzgoda | GTalk: [EMAIL PROTECTED] | voice: +48228430101 "We read Knuth so you don't have to." (Tim Peters) -- http://mail.python.org/mailman/listinfo/pytho

Re: Transforming ascii file (pseduo database) into proper database

2008-01-28 Thread Albert van der Horst
In article <[EMAIL PROTECTED]>, p. <[EMAIL PROTECTED]> wrote: >I need to take a series of ascii files and transform the data >contained therein so that it can be inserted into an existing >database. The ascii files are just a series of lines, each line >containing fields separated by '|' character.

Re: Python System information

2008-01-28 Thread Paul Boddie
On 26 Jan, 15:58, Clement <[EMAIL PROTECTED]> wrote: > Hi friends, > How can i get system information like CPU load and RAM usage in linux. > Is there any packages for python One result lower than this thread in the Google search results for the query "Python System Information" is a reference to

Re: optional static typing for Python

2008-01-28 Thread Russ P.
On Jan 28, 1:53 am, Bruno Desthuilliers wrote: > Russ P. a écrit : > > > > > 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 i

Re: optional static typing for Python

2008-01-28 Thread Paul Rubin
"Russ P." <[EMAIL PROTECTED]> writes: > You might want to check into what the FAA allows in "flight-critical" > code, for example. I am certainly not an expert in that area, but I've > had a passing exposure to it. My understanding is that every possible > branch of the code must be fully and metic

Re: Struct.Pack and Binary files

2008-01-28 Thread PurpleServerMonkey
On Jan 28, 1:48 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > 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 > > eq

Serving images

2008-01-28 Thread Jumping Arne
I'm no web programmer so please be kind. I'm just going to start writing a small "web app", it's very small and will only do one thing so I'm not going to use some kind of web framework. The purpose of the script is to do some custom markup of markdown formatted pages, render them and send them

starting programs from python script on windows

2008-01-28 Thread Benedict Verheyen
Hi, i want to automate starting programs on my windows machine and i want to do it with windows. This is a sample script: from subprocess import Popen, PIPE import time print " Starting app 1" time.sleep(1) try: p1 = Popen(["C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE"], stdout

Re: optional static typing for Python

2008-01-28 Thread Bruno Desthuilliers
Russ P. a écrit : > A while back I came across a tentative proposal from way back in 2000 > for optional static typing in Python: > (snip) > In any case, optional static typing in Python would help tremendously > here. The hardest part of automated conversion of Python to a > statically typed lan

Re: optional static typing for Python

2008-01-28 Thread Bruno Desthuilliers
Russ P. a écrit : > 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, bu

Re: read and readline hanging

2008-01-28 Thread Marc 'BlackJack' Rintsch
On Sun, 27 Jan 2008 19:58:27 +0100, Olivier Lefevre wrote: >>> But how can I find out *programmatically* that there is no more >>> input? >> >> You can't. > > How do people handle this, then? Reading from a process that will > block if you ask too much yet won't let you know how much there is >

Re: Python Standardization: Wikipedia entry

2008-01-28 Thread Paul Boddie
On 28 Jan, 02:05, ajaksu <[EMAIL PROTECTED]> wrote: > > Hmmm. Seems to me that "Is X Standardized" in the given context means > having a formal, published standard issued by some Standards > organization. While you can discuss the meaning of some so-called > standards (like W3C's 'recommendations',

Re: optional static typing for Python

2008-01-28 Thread cokofreedom
On Jan 28, 11:42 am, "Russ P." <[EMAIL PROTECTED]> wrote: > On Jan 28, 1:51 am, Bruno Desthuilliers > > > [EMAIL PROTECTED]> wrote: > > Russ P. a écrit :> A while back I came across a tentative proposal from way > > back in 2000 > > > for optional static typing in Python: > > > (snip) > > > > In

Re: starting programs from python script on windows

2008-01-28 Thread Tim Golden
Benedict Verheyen wrote: > i want to automate starting programs on my windows machine and i want > to do it with windows. > This is a sample script: > > from subprocess import Popen, PIPE > import time > > print " Starting app 1" > time.sleep(1) > try: > p1 = Popen(["C:\Program Files\Microso

Re: finding child cpu usage of a running child

2008-01-28 Thread Matthew_WARREN
had to say, that subject conjoured up an interesting image in my head :) This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord w

Re: optional static typing for Python

2008-01-28 Thread Russ P.
On Jan 28, 1:51 am, Bruno Desthuilliers wrote: > Russ P. a écrit :> A while back I came across a tentative proposal from way > back in 2000 > > for optional static typing in Python: > > (snip) > > > In any case, optional static typing in Python would help tremendously > > here. The hardest part o

Re: Some questions about decode/encode

2008-01-28 Thread glacier
On Jan 28, 2:31 pm, John Machin <[EMAIL PROTECTED]> wrote: > 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, t

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

2008-01-28 Thread Hendrik van Rooyen
On Sunday 27 January 2008 09:45, 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 altern

Can xml.sax NOT process the DTD?

2008-01-28 Thread marek jedlinski
I'm using xml.sax to extract certain content from xml files. (Background: my job is software localization; these are bilingual xml files, from which I need to extract translated text, e.g. for spellchecking). It works fine, unless a particular file has a doctype directive that specifies a DTD. Th

Re: When is min(a, b) != min(b, a)?

2008-01-28 Thread Antoon Pardon
On 2008-01-25, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 25 Jan 2008 07:57:13 +, Antoon Pardon wrote: > >>> But if you consider that having "x is not smaller than y" be equivalent >>> to "x is greater than or equal to y" is more important than forcing a >>> boolean answer in the firs

Re: optional static typing for Python

2008-01-28 Thread Torsten Bronger
Hallöchen! Russ P. writes: > On Jan 28, 1:51 am, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: >> Russ P. a écrit :> A while back I came across a tentative proposal from way > back in 2000 >> > for optional static typing in Python: >> >> (snip) >> >>> In any case, optional static typing in Pytho

Re: optional static typing for Python

2008-01-28 Thread Diez B. Roggisch
> If Python could be automatically converted to Ada or Java, that could > potentially be used as a baseline for actual operational software. > That would capture the algorithmic details more reliably than recoding > from scratch by hand. But such an automatic conversion is not feasible > without ex

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

2008-01-28 Thread Arnaud Delobelle
On Jan 28, 4:47 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > 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

Re: Python Genetic Algorithm

2008-01-28 Thread Wildemar Wildenburger
Steven D'Aprano wrote: >> I'm not sure I'm following you here. So a "chromosome" is bit of >> functionality, right? So basically it is a function. So my advice would >> be to write these functions and store it to the "indivuals"-list like >> so: > > No, a chromosome is a bit of *data*: a noun, not

Re: Can xml.sax NOT process the DTD?

2008-01-28 Thread Jim
On Jan 28, 6:48 am, marek jedlinski <[EMAIL PROTECTED]> wrote: > I've noticed that I can eliminate the error if I create 0-byte dtd files > and put them where the parser expects to find them, but this is a little > tedious, since there are plenty of different DTDs expected at different > locations.

Re: Anybody has ported talib to Python via SWIG

2008-01-28 Thread Aldo Ceccarelli
On 26 Gen, 19:33, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 24 Jan 2008 20:49:33 -0200, Aldo Ceccarelli   > <[EMAIL PROTECTED]> escribi�: > > > Hi Everybody, > > TaLib (technical analysis package with function indicators coded in C/C > > ++,http://www.ta-lib.org) has a complete libra

Re: optional static typing for Python

2008-01-28 Thread Bruno Desthuilliers
Russ P. a écrit : > On Jan 28, 1:51 am, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: >> Russ P. a écrit :> A while back I came across a tentative proposal from way >> back in 2000 >>> for optional static typing in Python: >> (snip) >> >>> In any case, optional static typing in Python would help

Re: starting programs from python script on windows

2008-01-28 Thread Benedict Verheyen
Tim Golden schreef: > OK. You've got a few misunderstandings in there. Nothing too major, > but it's worth sorting them out. > > 1) If you just want to kick off a program and that's it, say as part of > some kind of startup process, then you can just use the subprocess.call > convenience functi

Re: When is min(a, b) != min(b, a)?

2008-01-28 Thread Mark Dickinson
On Jan 28, 6:50 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: > My personal preference would be that python would allow people the > choice, with the default being that any operation that resulted > in a non numeric result would throw an exception. > > People who somehow made it clear they know how

Re: Set ulimit when using subprocess.Popen?

2008-01-28 Thread Rob Wolfe
Jarek Zgoda napisał(a): > Hi, all, > > anybody has an idea on how to set ulimit (-v in my case, linux) for > process started using subprocess.Popen? What about: from subprocess import call call('ulimit -v 1000 && ulimit -v && ls', shell=True) HTH, Rob -- http://mail.python.org/mailman/listinf

Re: validate string is valid maths

2008-01-28 Thread Christian Heimes
Steven D'Aprano wrote: > def rationalise_signs(s): > while "++" in s or "+-" in s or "-+" in s or "--" in s: > s = s.replace("++", "+") > s = s.replace("--", "+") > s = s.replace("+-", "-") > s = s.replace("-+", "-") > return s I assume it's faster to check

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

2008-01-28 Thread Steven Bethard
Arnaud Delobelle wrote: > Sligthly improved (not for performance! but signature-preserving and > looks for default values) > > from functools import wraps > from inspect import getargspec > from itertools import izip, chain > > def autoassign(*names): > def decorator(f): > fargnames,

Re: sharing objects between classes

2008-01-28 Thread Diez B. Roggisch
Gerardo Herzig wrote: > Hi all. Im wondering the way to share a database connection between some > classes: > > So far, i came up with a simple class schema, where each class means > each different relation, i mean i have the follow classes > > class Database(object): > ## make the connection

Re: wx.EVT_RIGHT_UP strangeness?

2008-01-28 Thread Mike Driscoll
On Jan 26, 1:30 pm, [EMAIL PROTECTED] wrote: > I am playing with wxPython 2.8.7.1 on OS X 10.4.11 with MacPython 2.5 > > When running the demo program, the ShapeWindow demo does not close the > window > on right click. It turns out that the wx.EVT_RIGHT_UP does not fire. > > I discovered that one w

Re: Encryption Recommendation

2008-01-28 Thread Tim Chase
> Usually, one doesn't store clear-text passwords. Instead, use a > hash-algorithm like md5 or crypt (the former is in the standard lib, don't > know of the other out of my head) and hash the password, and store that > hash. Python offers md5, and SHA modules built-in. (yay, python!) http://d

Re: "just like Java" (was :Re: translating Python to Assembler)

2008-01-28 Thread Bruno Desthuilliers
Paul Boddie a écrit : > On 25 Jan, 14:05, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: >> Christian Heimes a écrit : >> >>> No, that is not correct. Python code is compiled to Python byte code and >>> execute inside a virtual machine just like Java or C#. >> I'm surprised you've not been flamed t

sharing objects between classes

2008-01-28 Thread Gerardo Herzig
Hi all. Im wondering the way to share a database connection between some classes: So far, i came up with a simple class schema, where each class means each different relation, i mean i have the follow classes class Database(object): ## make the connection self.conn = make_conn() class

Re: translating Python to Assembler

2008-01-28 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > On Sat, 26 Jan 2008 14:47:50 +0100, Bjoern Schliessmann >> This may be true, but I think it's not bad to assume that machine >> language and assembler are "almost the same" in this context, >> since the translation between them is non-ambiguous (It's >> just "recoding";

Re: [OT] "just like Java" (was :Re: translating Python to Assembler)

2008-01-28 Thread Bruno Desthuilliers
Jeroen Ruigrok van der Werven a écrit : > -On [20080125 14:07], Bruno Desthuilliers ([EMAIL PROTECTED]) wrote: >> I'm surprised you've not been flamed to death by now - last time I >> happened to write a pretty similar thing, I got a couple nut case >> accusing me of being a liar trying to spread

Encryption Recommendation

2008-01-28 Thread [EMAIL PROTECTED]
Hello - I'm still using Python 2.4. In my code, I want to encrypt a password and at another point decrypt it. What is the standard way of doing encryption in python? Is it the Pycrypto module? Roger -- http://mail.python.org/mailman/listinfo/python-list

Re: Set ulimit when using subprocess.Popen?

2008-01-28 Thread Rob Wolfe
Jarek Zgoda napisał(a): > Rob Wolfe napisa�(a): > > > > Jarek Zgoda napisa�(a): > >> Hi, all, > >> > >> anybody has an idea on how to set ulimit (-v in my case, linux) for > >> process started using subprocess.Popen? > > > > What about: > > > > from subprocess import call > > call('ulimit -v 1000

validate string is valid maths

2008-01-28 Thread Matthew_WARREN
Hi pythoners. I am generating strings of length n, randomly from the symbols +-/*0123456789 What would be the 'sensible' way of transforming the string, for example changing '3++8' into 3+8 or '3++--*-9' into '3+-9' such that eval(string) will always return a number? in cases where multipl

Re: optional static typing for Python

2008-01-28 Thread Bjoern Schliessmann
Russ P. wrote: > On Jan 28, 1:51 am, Bruno Desthuilliers > Lord have mercy(tm). > > What is that supposed to mean? I suppose he wants to communicate that this is the nth time this topic is brought up (n=>infinite). Try searching the archives next time. Regards, Björn P.S.: IMHO, your flame i

Re: When is min(a, b) != min(b, a)?

2008-01-28 Thread Mark Dickinson
On Jan 28, 6:50 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: > People who somehow made it clear they know how to work with inf, and > NaN results, would get silent NaN where no exceptions would be thrown. One other thing: there's an excellent starting point for considering how things should work,

A question about osyco

2008-01-28 Thread iu2
Hi guys, I wrote two version of a fib functions, a recursive one and an iterative one. Psyco improved a lot the recursive function time, but didn't affect at all the iterative function. Why? Here is the code: import time, psyco def mytime(code): t = time.time() res = eval(code) del

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

2008-01-28 Thread Bruno Desthuilliers
Paddy a écrit : (snip) > Is it not possible to write a function that queries its call stack > when run to find the name of all arguments and locals() of the level > above > so you could write: > > class test(object): > def __init__(self, x, y): > arg2inst() > > and automatically assign se

[no subject]

2008-01-28 Thread 7146031596
17146031598 -- http://mail.python.org/mailman/listinfo/python-list

Re: sharing objects between classes

2008-01-28 Thread Bruno Desthuilliers
Diez B. Roggisch a écrit : > Gerardo Herzig wrote: > >> Hi all. Im wondering the way to share a database connection between some >> classes: >> >> So far, i came up with a simple class schema, where each class means >> each different relation, i mean i have the follow classes >> >> class Database(

Re: Python Genetic Algorithm

2008-01-28 Thread Max
On Jan 27, 7:25 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > Just pass the class itself. For example: > > # Define a class. > class Parrot(object): > pass > > x = "Parrot" # x is the NAME of the class > y = Parrot # y is the CLASS itself > z = Parrot() # z is an INSTAN

Re: validate string is valid maths

2008-01-28 Thread Steven D'Aprano
On Mon, 28 Jan 2008 15:10:54 +, Matthew_WARREN wrote: > Hi pythoners. > > I am generating strings of length n, randomly from the symbols > > +-/*0123456789 > > What would be the 'sensible' way of transforming the string, for example > changing '3++8' into 3+8 That's easy: replace pairs

Re: Encryption Recommendation

2008-01-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Hello - > > I'm still using Python 2.4. In my code, I want to encrypt a password > and at another point decrypt it. What is the standard way of doing > encryption in python? Is it the Pycrypto module? Usually, one doesn't store clear-text passwords. Instead, use a h

Re: Get Available Functions

2008-01-28 Thread Tim Chase
> I'm working with a python module which isn't part of the core > Python API and it also isn't very documented or supported, is > there any way that I can easily dump/view the available > classes and methods within the package from within python? Most of the time, the dir(), type() and help() func

Re: Encryption Recommendation

2008-01-28 Thread Paul Rubin
"Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > Usually, one doesn't store clear-text passwords. Instead, use a > hash-algorithm like md5 or crypt (the former is in the standard lib, don't > know of the other out of my head) and hash the password, and store that > hash. Rather, use the HMAC modul

Re: regular expression negate a word (not character)

2008-01-28 Thread Greg Bacon
The code below at least passes your tests. Hope it helps, Greg #! /usr/bin/perl use warnings; use strict; use constant { MATCH=> 1, NO_MATCH => 0, }; my @tests = ( [ "winter tire",=> MATCH ], [ "tire", => MATCH ], [ "retire",

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

2008-01-28 Thread Arnaud Delobelle
On Jan 28, 4:30 am, Tim Chase <[EMAIL PROTECTED]> wrote: > I've seen some folks import inspect/functools, but from my > testing, the __init__ method in question has a .func_code object > that already has the varnames in it. in py3k f.func_code gives way to f.__code__, this is why inspect may be pr

Re: Question on importing wxPython

2008-01-28 Thread Mike Driscoll
On Jan 28, 12:06 pm, "Steven W. Orr" <[EMAIL PROTECTED]> wrote: > python-2.3.5 > wx-2.6 > > I just bought the wxPython In Action book and I see that all the examples > say to > import wx > All of our pre-existing code was horribly doing a > from wxPython import * > > I changed all the code so that

Re: referer url

2008-01-28 Thread [EMAIL PROTECTED]
Thanks for that! i found the variable in "ALL_HTTP" and it's working now. Thanks again.. -- http://mail.python.org/mailman/listinfo/python-list

Python-URL! - weekly Python news and links (Jan 28)

2008-01-28 Thread Gabriel Genellina
QOTW: "The nice thing with Pyrex is that you can use the Python interpreter, or not use it, more or less depending on your way to declare things and your way to code. So, in a way, you have full control over the compromise between speed and facility. The temptation is always strong to use Python

Question on importing wxPython

2008-01-28 Thread Steven W. Orr
python-2.3.5 wx-2.6 I just bought the wxPython In Action book and I see that all the examples say to import wx All of our pre-existing code was horribly doing a from wxPython import * I changed all the code so that it was doing an import wx and found that everything was broken. In particular, r

Re: validate string is valid maths

2008-01-28 Thread Remco Gerlich
Hi, It seems that for every group of 2 or more +-/* signs, one of the following holds: - The group starts with '-', everything after it should be dropped, otherwise - The second character is '-', everything after it should be dropped, otherwise - Drop everything after the first. That should turn

Re: translating Python to Assembler

2008-01-28 Thread Grant Edwards
>> 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 assembler. At this >> point, I admit the code above is NOT assembler, but sooner or >> later it will be converted to machine cod

Re: referer url

2008-01-28 Thread Tim Chase
> I was wondering, if there is a way to retrieve the referer url with > python (web-based). > I tried this: > > import os > print os.getenv('HTTP_REFERER') > > but it's not working, even thought other http variables do function, > this one is always a None. This could be for any number of reason

Re: translating Python to Assembler

2008-01-28 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Bjoern Schliessmann wrote: >> [EMAIL PROTECTED] wrote: >>> 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

Re: read and readline hanging

2008-01-28 Thread Olivier Lefevre
>> Yes, that has since occurred to me. I need to echo some magic string >> after each command to know that I reached the end of the answer to >> the previous command. In interactive mode the prompt fulfills that >> role. > > And hope that that "magic string" does not occur somewhere within > the r

Re: post variable

2008-01-28 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > sorry for creating a new post but this is totally different from the > previous one. > > Here is the problem (which is very hard to explain, so i will use a > paradigm): i submit a form and the post variable is being sent to the > page test.py. then the test.py retriev

post variable

2008-01-28 Thread [EMAIL PROTECTED]
sorry for creating a new post but this is totally different from the previous one. Here is the problem (which is very hard to explain, so i will use a paradigm): i submit a form and the post variable is being sent to the page test.py. then the test.py retrieves the POST and print it to the page. n

Re: extending Python - passing nested lists

2008-01-28 Thread Christian Meesters
Mark Dickinson wrote: > Well, it's pretty clear: you misspelt "length" as "lenght". :) Well, that's not it ;-). (Damn copy & paste plague ...) > > PySequence_Fast doesn't return an array: it returns a PyObject---in > this case, a PyObject corresponding to a Python tuple. That's it. Thanks. Thi

Embeding python with mingw on win32 and python 2.4.4

2008-01-28 Thread mani
Hi I'm bringing up an old story once more! I'm on win32 (winxp sp2) python 2.4.4. mingw gcc version is 3.4.5. msys is in c:\msys. mingw is in c:\mingw and python is in c:\pyton24. there is also python24.lib and libpython24.a in c:\python24\libs. when I try to compile this sample code [1] from with

Re: extending Python - passing nested lists

2008-01-28 Thread Mark Dickinson
On Jan 28, 10:10 am, Christian Meesters <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to write a C-extension function for an application of mine. For > this I need to pass a nested list (like: [[a, b, c], [d, e, f], ...], where > all letters are floats) to the C-function. Now, with the code I h

Re: sharing objects between classes

2008-01-28 Thread gherzig
> Diez B. Roggisch a écrit : >> Gerardo Herzig wrote: >> >>> Hi all. Im wondering the way to share a database connection between >>> some >>> classes: >>> >>> So far, i came up with a simple class schema, where each class means >>> each different relation, i mean i have the follow classes >>> >>> c

SMTP Sending Mail Problem

2008-01-28 Thread the_ricka
Hi all, I'm fairly new to python, but very excited about it's potential. I'm trying to write a simple program that will accept input from a command line and send email. The parameters I used on the command line are for From address, To addresses, Subject and Body. For the body, I thought it woul

Re: read and readline hanging

2008-01-28 Thread Olivier Lefevre
pexpect looks promising, thanks. -- O.L. -- http://mail.python.org/mailman/listinfo/python-list

Re: validate string is valid maths

2008-01-28 Thread marek . rocki
I decided to play with it a little bit, but take a different approach than Steven. This seems actually one of the problems where regexp might be a good solution. import re re_signednumber = r'([-+]?\d+)' re_expression = '%s(?:([-+/*])[-+/*]*?%s)*' % (re_signednumber, re_signednumber) for test_cas

Re: optional static typing for Python

2008-01-28 Thread Marc 'BlackJack' Rintsch
On Mon, 28 Jan 2008 08:31:43 -0800, John Nagle wrote: > Unenforced static typing is somewhat pointless. If that > goes in, it should be enforced by implementations. Luckily we don't get static typing. We get annotations which *can* be used for type hints, checked by additional code. Can be

Re: PYS file

2008-01-28 Thread Gabriel Genellina
On 28 ene, 13:05, azrael <[EMAIL PROTECTED]> wrote: > A I Understood correctly, pyc files are compiled py scripts. Is it > possible to decomplite them. > I guess it's possible, but how hard is it. You want to get back the Python source? Look for the "decompyle" package. The last published release

Re: translating Python to Assembler

2008-01-28 Thread Grant Edwards
On 2008-01-28, Bjoern Schliessmann <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> No, it doesn't output corresponding machine code (that's what >> some Java JIT implementations do, but I'm not aware of any >> Python implementations that do that). The virtual machine >> interpreter just does

Re: post variable

2008-01-28 Thread Hrvoje Niksic
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > so the output is always the POST retrieven at first. So the page > keeps on printing the POST variable retrieven at first even thought > i might have reloaded the page 1000 times. Is there any way to > "empty" the POST variable, so that at reload n

Re: validate string is valid maths

2008-01-28 Thread Gabriel Genellina
impor tOn 28 ene, 14:31, [EMAIL PROTECTED] wrote: > What would be the 'sensible' way of transforming the string, for example > changing '3++8' into 3+8 > or '3++--*-9' into '3+-9' such that eval(string) will always return a > number? '3++8' is already a valid expresion, like '3++---9' >

Problems installing Python on server

2008-01-28 Thread Yansky
I asked my hosting company if they would upgrade Python on my server to the latest version. They responded with: "Sorry no. We tend to stick with what comes packaged with the unix distribution to ease maintenance issues. There is nothing stopping you from running your own version of python from w

Re: translating Python to Assembler

2008-01-28 Thread Bjoern Schliessmann
Grant Edwards wrote: > No, it doesn't output corresponding machine code (that's what > some Java JIT implementations do, but I'm not aware of any > Python implementations that do that). The virtual machine > interpreter just does the action specified by the bytecode. By "outputs corresponding mac

[Q] Is there a way to minimize a Tkinter application to the system tray?

2008-01-28 Thread Thomas Ploch
Hello folks, I already found some answers on the net, which said that the Tk library that Tkinter wraps does not offer functionality to minimize an application to the system tray. But I hope there are some wizards in here that might tell me that how it (possibly) could be done. Thomas -- ht

RE: Python Genetic Algorithm

2008-01-28 Thread Blubaugh, David A.
Sir, Have you ever worked with Gene Expression Programming David Blubaugh -Original Message- From: Wildemar Wildenburger [mailto:[EMAIL PROTECTED] Sent: Monday, January 28, 2008 7:24 AM To: python-list@python.org Subject: Re: Python Genetic Algorithm Steven D'Aprano wrote:

Re: regular expression negate a word (not character)

2008-01-28 Thread Dr.Ruud
Greg Bacon schreef: > #! /usr/bin/perl > > use warnings; > use strict; > > use constant { > MATCH=> 1, > NO_MATCH => 0, > }; > > my @tests = ( > [ "winter tire",=> MATCH ], > [ "tire", => MATCH ], > [ "retire", => MATCH ],

RE: Encryption Recommendation

2008-01-28 Thread Andreas Tawn
>> I'm still using Python 2.4. In my code, I want to encrypt a password >> and at another point decrypt it. What is the standard way of doing >> encryption in python? Is it the Pycrypto module? > >Usually, one doesn't store clear-text passwords. Instead, use a >hash-algorithm like md5 or crypt (

Re: referer url

2008-01-28 Thread Tim Chase
> 1) CGI so i'm doing it right. that's helpful to know > 2) this is impossible as i'm doing the exact same thing with another > language and it utterly works. Just making sure...same browser/setup/configuration, different language? > 3) the same as above kinda figured...most servers give you

Re: Just for fun: Countdown numbers game solver

2008-01-28 Thread david . hotham
I also had a go at this problem for a bit of python practice, about 6 months ago. I tried a few optimizations and my experience was that with only 6 seeds, a hash table was very effective. So effective, in fact, that it made all other optimizations more or less pointless. Code below. Arguments

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

2008-01-28 Thread André
On Jan 28, 11:45 am, Steven Bethard <[EMAIL PROTECTED]> wrote: > Arnaud Delobelle wrote: > > Sligthly improved (not for performance! but signature-preserving and > > looks for default values) > > > from functools import wraps > > from inspect import getargspec > > from itertools import izip, chain

Re: SMTP Sending Mail Problem

2008-01-28 Thread Gabriel Genellina
On 28 ene, 14:15, the_ricka <[EMAIL PROTECTED]> wrote: > However, whenever I try to read more than one line from the file, the > email is not being delivered.  The only reason I know this is because > I tried just reading in the first line of the text file, and the email > sent fine.  Right now I

Re: read and readline hanging

2008-01-28 Thread Olivier Lefevre
> The buffering behavior at the interactive prompt is very often different > from connections via pipes. I hadn't thought of that. I will ask on the Octave list. Thanks, -- O.L. -- http://mail.python.org/mailman/listinfo/python-list

Unicode Problem

2008-01-28 Thread Victor Subervi
Hi; New to unicode. Got this error: Traceback (most recent call last): File "", line 1, in File "", line 29, in tagWords File "/usr/local/lib/python2.5/codecs.py", line 303, in write data, consumed = self.encode(object, self.errors) UnicodeDecodeError: 'ascii' codec can't decode byte 0x

extending Python - passing nested lists

2008-01-28 Thread Christian Meesters
Hi, I would like to write a C-extension function for an application of mine. For this I need to pass a nested list (like: [[a, b, c], [d, e, f], ...], where all letters are floats) to the C-function. Now, with the code I have the compiler is complaining: "subscripted value is neither array nor poi

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

2008-01-28 Thread Arnaud Delobelle
On Jan 28, 4:08 pm, "André" <[EMAIL PROTECTED]> wrote: [...] > If I may suggest, I would extend this so that autoassign's signature > would be as follows: > > autoassign(all=True, include_only=None, exclude=None) > > Either one of include_only or exclude could be a list of function to > which the a

referer url

2008-01-28 Thread [EMAIL PROTECTED]
Hello all! I was wondering, if there is a way to retrieve the referer url with python (web-based). I tried this: import os print os.getenv('HTTP_REFERER') but it's not working, even thought other http variables do function, this one is always a None. Thanks in advance. -- http://mail.python.or

  1   2   >