Re: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread Laurent Pointal
[EMAIL PROTECTED] a écrit : ... > Ideally, I'd like a whole series of projects where I'm walked through > how to go about writing real Python. The way I look at it, nobody > learnt to build a house just from reading about building materials! Take a look at "Dive Into Python" from Mark Pilgrim, goo

Re: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread Ravi Teja
> Is this kind of cleverness what is usually known as "magic"? > I suspect that this has something to do with it, but not completely > sure... :-). It must be. Now Django has a "magic removal branch". -- http://mail.python.org/mailman/listinfo/python-list

Re: Zipping files/zipfile module

2006-08-02 Thread Simon Forman
Brian Beck wrote: > OriginalBrownster wrote: > > I want to zip all the files within a directory called "temp" > > and have the zip archive saved in a directory with temp called ziptemp > > > > I was trying to read up on how to use the zipfile module python > > provides, but I cannot seem to find ad

Re: Finding the name of a class

2006-08-02 Thread Bruno Desthuilliers
Kirk Strauser wrote: > Bruno Desthuilliers wrote: > >> Kirk Strauser wrote: > >> class foo(object): >> pass >>> how can I find its name, such as: >>> >> b = foo > >> I suppose you mean b = foo() ? > > Actually, I meant 'b = foo' in this case - I want to find the name of the > cl

Re: Strange Tkinter Grid behaviour Problem

2006-08-02 Thread H J van Rooyen
"Peter Otten" <[EMAIL PROTECTED]> wrote: |H J van Rooyen wrote: | | > Hi, | > | > Still struggling with my GUI exercise - | > | > I have the following lines of code in a routine that is bound at | > to an instance of Entry : | > | > self.disp.Amount_des = Label(self.disp, text = self.dis

Re: BCD List to HEX List

2006-08-02 Thread H J van Rooyen
"John Machin" <[EMAIL PROTECTED]> wrote: | [EMAIL PROTECTED] wrote: | | >My version assumes three subroutines: extracting | > nibbles, shifting, and adding, Those are pretty simple, so I asked | > if he needed them rather than presenting them. | > Assuming we have | > them, the algorithm is three

Re: Finding the name of a class

2006-08-02 Thread Bruno Desthuilliers
Dennis Lee Bieber wrote: > On Tue, 01 Aug 2006 11:09:57 -0500, Kirk Strauser <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> Actually, I meant 'b = foo' in this case - I want to find the name of the >> class that b references, but the name of an instance (which may have zer

Re: Finding the name of a class

2006-08-02 Thread Bruno Desthuilliers
Larry Bates wrote: > Kirk Strauser wrote: >> Given a class: >> > class foo(object): > pass >> how can I find its name, such as: >> > b = foo > print something(b) >> 'foo' >> >> I'm writing a trace() decorator for the sake of practice, and am trying to >> print the name of the cl

Re: Hierarchical unit tests

2006-08-02 Thread Peter Otten
Pupeno wrote: > Having A(unittest.TestCase) and B(A), the unittests framework seems not to > run A's test when testing B, right ? Wrong: $ cat hierarchical_tests.py import unittest class A(unittest.TestCase): def test_a(self): pass class B(A): def test_b(self): pass if

Re: cleaner way to write this try/except statement?

2006-08-02 Thread Peter Otten
John Salerno wrote: > The code to look at is the try statement in the NumbersValidator class, > just a few lines down. Is this a clean way to write it? i.e. is it okay > to have all those return statements? Is this a good use of try? Etc. > > Thanks. > > > > import

Re: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Hi all. I've been try to learn ruby for a few months but I'm about > ready to give up. The available books either assume a programming > background, or are out of date. Anyway, I think python may suit me more > due to its 'theres one way to do it' philosophy (hope the quo

Re: BCD List to HEX List

2006-08-02 Thread bryanjugglercryptographer
John Machin wrote: > [EMAIL PROTECTED] wrote: > > "For each nibble n of x" means to take each 4 bit piece of the BCD > > integer as a value from zero to sixteen (though only 0 through 9 > > will appear), from most significant to least significant. > The OP's input, unvaryingly through the whole t

Re: Dr. Dobb's Python-URL! - weekly Python news and links (Aug 2)

2006-08-02 Thread david_wahler
I'll be out of the office until approximately August 20th. If you have any questions, please email [EMAIL PROTECTED] -- David Wahler -- http://mail.python.org/mailman/listinfo/python-list

Re: Reinstalling Python Problem (Newbie)

2006-08-02 Thread Avell Diroll
beno wrote: > I intend to do that. However, I think this is the RIGHT list to ask > questions pertinent to python... I didn't intend to be abrupt, ... I was just in an hurry, sorry for that. Anyway I still see this problem more as a program not compiling correctly on Freebsd than python not com

Re: how to stop python

2006-08-02 Thread Laurent Pointal
victor a écrit : > or if u want explicit exit of program then use: > > import sys > sys.exit(1) > > or > > raise SystemExit, 'message' There is also the (not recommanded - see docs, but it exists) os._exit(n) function. A+ Laurent. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Python for my web site

2006-08-02 Thread Cliff Wells
On Tue, 2006-08-01 at 23:26 -0300, Gerhard Fiedler wrote: > Or is there something in PostgreSQL that makes its users acidic? :) Well, ACID is popular in PostgreSQL circles. Cliff -- -- http://mail.python.org/mailman/listinfo/python-list

Re: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread jitya
[EMAIL PROTECTED] wrote: > Hi all. I've been try to learn ruby for a few months but I'm about > ready to give up. Perfection is achieved only on the point of collapse. -- C.N. Parkinson Welcome to Python , apart from the tutorials whenever time permits do read this articles . Why Python :

Re: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread Bruno Desthuilliers
Luis M. González wrote: > Delaney, Timothy (Tim) wrote: (snip) >> "Clever" in this context generally means using a trick/hack that is >> non-obvious (often even after you understand it). "Cleverness" often >> leads to difficult-to-understand code, which is contrary to the "python >> philosophy". >>

Re: Need a compelling argument to use Django instead of Rails

2006-08-02 Thread Ben Sizer
Vincent Delporte wrote: > On 31 Jul 2006 07:05:27 -0700, "Ben Sizer" <[EMAIL PROTECTED]> wrote: > >Typically you run PHP as a module in your webserver, so there should be > >no process startup overhead. mod_python provides the same sort of > >functionality for Python, but is not as popular or widel

Behavior on non definded name in Cheetah

2006-08-02 Thread Paolo Pantaleo
[I hope I am posting to the right place] I have a cheetah template something like this: x is: $x y is: $y z is: $z [Actually more complicated] If for example $y is not defined I get an exception and the parsing of the template stops. Is there any way to substitute $y with an emty string and m

Re: Behavior on non definded name in Cheetah

2006-08-02 Thread Stephan Diehl
Paolo Pantaleo wrote: > [I hope I am posting to the right place] > > I have a cheetah template something like this: > > x is: $x > y is: $y > z is: $z > > [Actually more complicated] > > If for example $y is not defined I get an exception and the parsing > of the template stops. Is there any

Attribute protection the 2nd

2006-08-02 Thread Kay Schluehr
A new recipe for attribute protection which is aligned with Pythons convention of privacy indication using underscore name mangling. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496930 Regards, Kay -- http://mail.python.org/mailman/listinfo/python-list

Re: Zipping files/zipfile module

2006-08-02 Thread Yves Lange
Simon Forman a écrit : > Brian Beck wrote: >> OriginalBrownster wrote: >>> I want to zip all the files within a directory called "temp" >>> and have the zip archive saved in a directory with temp called ziptemp >>> >>> I was trying to read up on how to use the zipfile module python >>> provides, bu

Re: Behavior on non definded name in Cheetah

2006-08-02 Thread Paolo Pantaleo
2006/8/2, Stephan Diehl <[EMAIL PROTECTED]>: > Paolo Pantaleo wrote: > > [I hope I am posting to the right place] > > > > I have a cheetah template something like this: > > > > x is: $x > > y is: $y > > z is: $z > > > > [Actually more complicated] > > > > If for example $y is not defined I get an e

Re: Behavior on non definded name in Cheetah

2006-08-02 Thread Peter Otten
Paolo Pantaleo wrote: > 2006/8/2, Stephan Diehl <[EMAIL PROTECTED]>: >> Paolo Pantaleo wrote: >> > [I hope I am posting to the right place] >> > >> > I have a cheetah template something like this: >> > >> > x is: $x >> > y is: $y >> > z is: $z >> > >> > [Actually more complicated] >> > >> > If for

Datetime objects

2006-08-02 Thread Lad
How can I find days and minutes difference between two datetime objects? For example If I have b=datetime.datetime(2006, 8, 2, 8, 57, 28, 687000) a=datetime.datetime(2006, 8, 1, 18, 19, 45, 765000) Thank you for help L. -- http://mail.python.org/mailman/listinfo/python-list

Re: Datetime objects

2006-08-02 Thread Diez B. Roggisch
Lad wrote: > How can I find days and minutes difference between two datetime > objects? > For example If I have > b=datetime.datetime(2006, 8, 2, 8, 57, 28, 687000) > a=datetime.datetime(2006, 8, 1, 18, 19, 45, 765000) a - b Lookup datetime.timedelta - all of this is neatly documented. Diez --

Class definition within function

2006-08-02 Thread Tomi Lindberg
Hi, With the following function definition, is it possible to create an instance of class C outside the function f (and if it is, how)? And yes, I think this is one of those times when the real question is why :) >>> def f(): class C(object): def __init__(self):

Re: Class definition within function

2006-08-02 Thread Diez B. Roggisch
Tomi Lindberg wrote: > Hi, > > With the following function definition, is it possible to > create an instance of class C outside the function f (and if > it is, how)? And yes, I think this is one of those times > when the real question is why :) > > >>> def f(): > class C(object): > def __init_

Re: Reinstalling Python Problem (Newbie)

2006-08-02 Thread Avell Diroll
beno wrote: > Avell Diroll wrote: >> beno wrote: >> *** tidying a little *** >>> >>> What do I do about the problems with mimetools and urllib2? >>> >> >> This is the last report of the 'make test' command and there should be >> a few lines before that stating each test one by one and prin

Re: Class definition within function

2006-08-02 Thread Kay Schluehr
Tomi Lindberg wrote: > Hi, > > With the following function definition, is it possible to > create an instance of class C outside the function f (and if > it is, how)? def f(): class C(object): def __init__(self): self.a = 'a' f.C = C return C() >>> f.C >

Re: Class definition within function

2006-08-02 Thread Tomi Lindberg
Diez B. Roggisch wrote: > No, its not. Only inside of it. And the question really is: why? Thanks. And no need to worry, the question was intended as fully theoretical. -- Tomi Lindberg -- http://mail.python.org/mailman/listinfo/python-list

Re: Class definition within function

2006-08-02 Thread Peter Otten
Tomi Lindberg wrote: > With the following function definition, is it possible to > create an instance of class C outside the function f (and if > it is, how)? And yes, I think this is one of those times > when the real question is why :) > >  >>> def f(): > class C(object): >  

Re: Datetime objects

2006-08-02 Thread Lad
Sybren Stuvel wrote: > Lad enlightened us with: > > How can I find days and minutes difference between two datetime > > objects? > > For example If I have > > b=datetime.datetime(2006, 8, 2, 8, 57, 28, 687000) > > a=datetime.datetime(2006, 8, 1, 18, 19, 45, 765000) > > diff = b - a Ok, I tried

Re: Class definition within function

2006-08-02 Thread Duncan Booth
Tomi Lindberg wrote: > With the following function definition, is it possible to > create an instance of class C outside the function f (and if > it is, how)? And yes, I think this is one of those times > when the real question is why :) > > >>> def f(): > class C(object): > def

Re: Datetime objects

2006-08-02 Thread Rama
I am a newcomer to python - so not too sure if this method is the correct one.   Noticing this,   >>> dir(diff)['__abs__', '__add__', '__class__', '__delattr__', '__div__', '__doc__', '__eq__', '__floordiv__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__mu

Re: Class definition within function

2006-08-02 Thread Tomi Lindberg
Peter Otten wrote: > By the way you get an instance of a different class C every time you call f, > so that > > isinstance(f(), type(f()) > > is False. That I didn't know. Well, that theory won't be seeing much practice I guess. -- Tomi Lindberg -- http://mail.python.org/mailman/listinfo/pyt

Re: python under earthlink hosting?

2006-08-02 Thread Martin P. Hellwig
mbstevens wrote: > I keep chatting with the tech support people at Earthlink, asking where > the location of the Python interpreter is. They don't seem to know where > it is. They don't know if Python is running on my server, either. I know > Perl is at /usr/local/bin/perl ...but when I use a si

Re: Need a compelling argument to use Django instead of Rails

2006-08-02 Thread Paul Rubin
"Ben Sizer" <[EMAIL PROTECTED]> writes: > Another perfectly good reason is that PHP pages are much simpler to > deploy than any given Python application server. Just add the code into > your HTML pages as required and you're done. Python could come close to > this if something like the Python Serve

Re: Class definition within function

2006-08-02 Thread Diez B. Roggisch
Kay Schluehr wrote: > > Tomi Lindberg wrote: >> Hi, >> >> With the following function definition, is it possible to >> create an instance of class C outside the function f (and if >> it is, how)? > > def f(): > class C(object): > def __init__(self): > self.a = 'a' >

Re: Datetime objects

2006-08-02 Thread John Machin
Lad wrote: > Sybren Stuvel wrote: > > Lad enlightened us with: > > > How can I find days and minutes difference between two datetime > > > objects? > > > For example If I have > > > b=datetime.datetime(2006, 8, 2, 8, 57, 28, 687000) > > > a=datetime.datetime(2006, 8, 1, 18, 19, 45, 765000) > > >

Re: Nested function scope problem

2006-08-02 Thread Antoon Pardon
On 2006-08-02, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 1 Aug 2006 17:44:54 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> Suppose I write a C-interpreter and then would translate a statement >> like "c = c + 100" into actions the interpreter wou

Re: Zipping files/zipfile module

2006-08-02 Thread Ant
Enabling directory recursion: > from os import listdir, mkdir > from os.path import join, basename, isfile > from zipfile import ZipFile > > def zip_dir(path, output_path, include_hidden=True): > try: > mkdir(output_path) > except OSError, e: > if e.errno == 17: # Path exis

Re: cleaner way to write this try/except statement?

2006-08-02 Thread John Salerno
Peter Otten wrote: > John Salerno wrote: > >> The code to look at is the try statement in the NumbersValidator class, >> just a few lines down. Is this a clean way to write it? i.e. is it okay >> to have all those return statements? Is this a good use of try? Etc. >> >> Thanks. >> >> -

upgrading python...

2006-08-02 Thread bruce
hi. i'min a situation where i might need to upgrade python. i have the current version of python for FC3. i might need to have the version for FC4. i built the version that's on FC4 from the python source RPM. however, when i simply try to install the resulting RPM, the app gives me dependency is

VisualStudio2005 supported in distutils

2006-08-02 Thread mg
Hello, I try to compile Python and several packages (like Numarray) with Visual Studio 2005. I downloaded the last version of Python from Subversion, and project files are provided for Visual Studio 2005. With some few simple corrections, everything compile and Python run correctly. Unfortunat

Re: cleaner way to write this try/except statement?

2006-08-02 Thread John Salerno
Simon Forman wrote: > Maybe I did miss something: Are you actually trying to make a static > method? Say, to be able to call it elsewhere than just the Validate() > method? I don't know if a static method is the best way to do it, but what I was trying to do was make a regular function within

Re: Windows vs. Linux

2006-08-02 Thread Gerhard Fiedler
On 2006-08-02 04:42:31, Sybren Stuvel wrote: > I never said "I would have known it better". I just said that IMO it > was a bad design choice ;-) Well, and I question your qualification to judge that. In order to say that, you would have to know the reasoning, would have to put it in the histor

Re: Network Game in Python

2006-08-02 Thread Ben Sizer
[EMAIL PROTECTED] wrote: > Some questions I have are: > 1. How can I manage network messages among the players. Should > multicast be used or Actor should send the message to Supervisor and he > sends to all. ? Send a message from one client to the supervisor, handle it, then get the supervisor to

Re: Windows vs. Linux

2006-08-02 Thread John Salerno
Gerhard Fiedler wrote: > A design choice is not necessarily a > bad choice just because it turns out that some 30 years later there is a > similar common product whose creators made a different choice, and now > programmers have to cater to both. To be fair, this isn't the reason he gave for it b

Re: Need a compelling argument to use Django instead of Rails

2006-08-02 Thread Ben Sizer
Paul Rubin wrote: > "Ben Sizer" <[EMAIL PROTECTED]> writes: > > Another perfectly good reason is that PHP pages are much simpler to > > deploy than any given Python application server. Just add the code into > > your HTML pages as required and you're done. Python could come close to > > this if som

Re: upgrading python...

2006-08-02 Thread Matthew Miller
On Wed, Aug 02, 2006 at 06:50:11AM -0700, bruce wrote: > i'min a situation where i might need to upgrade python. i have the current > version of python for FC3. i might need to have the version for FC4. i built > the version that's on FC4 from the python source RPM. Going from Python 2.3 as in FC3

Re: cleaner way to write this try/except statement?

2006-08-02 Thread John Salerno
John Salerno wrote: > The code to look at is the try statement in the NumbersValidator class, > just a few lines down. Is this a clean way to write it? i.e. is it okay > to have all those return statements? Is this a good use of try? Etc. Ok, I came up with this. It looks much nicer, I think, th

Re: Convert string to mathematical function

2006-08-02 Thread Colin J. Williams
Nick Vatamaniuc wrote: > Jeremy, > > Which method of extension are you using? For example you can pass the > function to C++/C directly using weave, without the need to convert to > Python first. Python has a different syntax than C++. Also I assume you > want exponentiation in you example "x^2...

Re: upgrading python...

2006-08-02 Thread Paul Boddie
bruce wrote: > > i'min a situation where i might need to upgrade python. i have the current > version of python for FC3. i might need to have the version for FC4. i built > the version that's on FC4 from the python source RPM. In principle this is a good idea, since you're aiming to manage your in

Snake is eating itself

2006-08-02 Thread Kay Schluehr
Diez B. Roggisch wrote: > Kay Schluehr wrote: > > > > > Tomi Lindberg wrote: > >> Hi, > >> > >> With the following function definition, is it possible to > >> create an instance of class C outside the function f (and if > >> it is, how)? > > > > def f(): > > class C(object): > > def __i

Re: Windows vs. Linux

2006-08-02 Thread Richard Brodie
"Gerhard Fiedler" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >With the same reasoning one could say that the Unix creators should have > used the VMS (or any other existing) form. Only if they used Guido's time machine. -- http://mail.python.org/mailman/listinfo/python-list

Can any one help?

2006-08-02 Thread sujith h
Hi am a newbie to pyparsing. But can any one help me to write small program to implement a small parser? Well is it possible to build a small calculator to do some arithmetic operations. Hope that i may get a reply... ~Sujith -- http://mail.python.org/mailman/listinfo/python-list

Re: Zipping files/zipfile module

2006-08-02 Thread Brian Beck
Yves Lange wrote: > Other solutions: > you can try the rar command line from WinRar but it's not recommended. > This is a very slow manner to compress file. Are you sure? This worked about 4 times faster than the zip command line utility in Linux, compressing the same files... -- Brian Beck Adve

ElementTree and Unicode

2006-08-02 Thread Sébastien Boisgérault
I guess I am doing something wrong ... Any clue ? >>> from elementtree.ElementTree import * >>> element = Element("string", value=u"\x00") >>> xml = tostring(element) >>> XML(xml) Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/elementtree/Eleme

Re: ElementTree and Unicode

2006-08-02 Thread Richard Brodie
"Sébastien Boisgérault" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] element = Element("string", value=u"\x00") I'm not as familiar with elementtree.ElementTree as I perhaps should be. However, you appear to be trying to insert a null character into an XML document. Should y

Re: cleaner way to write this try/except statement?

2006-08-02 Thread Roy Smith
John Salerno <[EMAIL PROTECTED]> wrote: > try: > if int(text) != 0: > return True > else: > self.error_message() > return False > except ValueError: > self.error_message() > return False

Re: Windows vs. Linux

2006-08-02 Thread bryanjugglercryptographer
Sybren Stuvel wrote: > John Salerno enlightened us with: > > But of course I still agree with you that in either case it's not a > > judgment you can fairly make 30 years after the fact. > > I don't see Microsoft changing it the next 30 years either... Apple > moved from \r to \n as EOL character.

Re: Class definition within function

2006-08-02 Thread Rick Zantow
Duncan Booth <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: >> >>> def f(): >> class C(object): >> def __init__(self): >>self.a = 'a' >> return C() >> >> >>> x = f() >> >>> x.a >> 'a' >> >>> y=f.C() >> > Of course there's this: >>> def f(): ... clas

Re: Need a compelling argument to use Django instead of Rails

2006-08-02 Thread Alex Martelli
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: ... > >>And of course import hooks. > > > > Python?? Where? > > RTFM: > http://www.python.org/doc/2.3.5/lib/built-in-funcs.html Perhaps a better reference is . Alex -- http://mail.python.org/mailman/li

Re: Need a compelling argument to use Django instead of Rails

2006-08-02 Thread Alex Martelli
Ray <[EMAIL PROTECTED]> wrote: > Damjan wrote: > > BTW I'd choose TurboGears for it's flexibility, but I guess Django could be > > nice when more rapid results are needed (and the problem doesn't fall too > > far from the Django sweet spot). > > Well actually I was thinking of exaclty the same th

Re: upgrading python...

2006-08-02 Thread Michael Brandt
> i'min a situation where i might need to upgrade python. i have the current > version of python for FC3. i might need to have the version for FC4. i built > the version that's on FC4 from the python source RPM. You could try the precompiled Python distribution from ActiveState (AS package (libcpp

Re: Finding the name of a class

2006-08-02 Thread Kent Johnson
Kirk Strauser wrote: > Larry Bates wrote: > >> print print b.__class__.__name__ gives what you want > > That doesn't seem to do it, though. Here's the result of importing a module > from my company's internally-developed library: > from Daycos.TableCopier.copyfro import StateProcessor >>>

Re: Get age of a file/dir

2006-08-02 Thread Antoon Pardon
On 2006-08-01, Carl J. Van Arsdall <[EMAIL PROTECTED]> wrote: > I've been looking around the OS module and I haven't found anything > useful yet. Does anyone know how to get the age of a file or directory > in days? I'm using unix and don't seem to find anything that will help > me. The only

Re: looking for a regular expression

2006-08-02 Thread �쩳�b�֤����ڡH
※ [EMAIL PROTECTED] (Thomas Nelson)》之銘言: > How about > my_string = "We the people of the United States, in order to form a > more perfect union, establish justice, insure domestic > tranquility,.." > print (x for x in my_string.split(",") if "justice" in x).next() > This isn't a reg

Re: Windows vs. Linux

2006-08-02 Thread Duncan Booth
[EMAIL PROTECTED] wrote: >>From a WinXP command prompt: > > C:\> > C:\>cd /windows/system32 > > C:\WINDOWS\system32> > > Not from my Windows XP command prompt it doesn't. Do you have anything strange installed on your system? -- http://mail.python.org/mailman/listinfo/python-list

need help of regular expression genius

2006-08-02 Thread GHUM
I need to split a text at every ; (Semikolon), but not at semikolons which are "escaped" within a pair of $$ or $_$ signs. My guess was that something along this should happen withing csv.py; but ... it is done within _csv.c :( Example: the SQL text should be splitted at "" (of course, those "spl

Re: Behavior on non definded name in Cheetah

2006-08-02 Thread Paolo Pantaleo
2006/8/2, Peter Otten <[EMAIL PROTECTED]>: > Paolo Pantaleo wrote: > > > 2006/8/2, Stephan Diehl <[EMAIL PROTECTED]>: > >> Paolo Pantaleo wrote: > >> > [I hope I am posting to the right place] > >> > > >> > I have a cheetah template something like this: > >> > > >> > x is: $x > >> > y is: $y > >> >

Re: ElementTree and Unicode

2006-08-02 Thread Sébastien Boisgérault
Richard Brodie wrote: > "Sébastien Boisgérault" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > element = Element("string", value=u"\x00") > > I'm not as familiar with elementtree.ElementTree as I perhaps > should be. However, you appear to be trying to insert a null > chara

Re: looking for a regular expression

2006-08-02 Thread Ant
> But what if there's not only commas, but also periods and semicolons? I > want to find words between 2 near by punctuations. I think it would make > it difficult to use split instead of regular expression. You could use re.split(r"\W", text) instead of the string split method to split on all non

Re: looking for a regular expression

2006-08-02 Thread Peter Otten
¨ì©³¦b²Ö¤°»ò°Ú¡H wrote: >> How about >> my_string = "We the people of the United States, in order to form a >> more perfect union, establish justice, insure domestic >> tranquility,.." >> print (x for x in my_string.split(",") if "justice" in x).next() >> This isn't a regular expression, but i

RE: Windows vs. Linux

2006-08-02 Thread Tim Golden
| [EMAIL PROTECTED] wrote: | | >>From a WinXP command prompt: | > | > C:\> | > C:\>cd /windows/system32 | > | > C:\WINDOWS\system32> | > | > | Not from my Windows XP command prompt it doesn't. Do you have | anything | strange installed on your system? FWIW: Microsoft Windows

Re: Windows vs. Linux

2006-08-02 Thread Alex Martelli
Gerhard Fiedler <[EMAIL PROTECTED]> wrote: ... a few fine points of computing history...: > >> (URLs probably use the slash because the internet protocols have been > >> developed largely on Unix-type systems for use with Unix-type systems?) > > > > It wasn't designed specifically for Unix-ty

Re: Windows vs. Linux

2006-08-02 Thread Alex Martelli
jean-michel bain-cornu <[EMAIL PROTECTED]> wrote: > Andy Dingley a écrit : > > I'd never recommend dual-boot for anything! > Don't agree man, it's good for testing... It's bothersome for testing: virtualization is much handier in most cases. Alex -- http://mail.python.org/mailman/listinfo/pyth

Re: need help of regular expression genius

2006-08-02 Thread Ant
GHUM wrote: > I need to split a text at every ; (Semikolon), but not at semikolons > which are "escaped" within a pair of $$ or $_$ signs. Looking at you example SQL code, it probably isn't possible with regexes. Consider the code: $$ blah blah ... $$ blah; xxx $$ blah blah $$ Regexes aren't c

Re: Windows vs. Linux

2006-08-02 Thread Tim Chase
> | Not from my Windows XP command prompt it doesn't. Do you have > | anything > | strange installed on your system? > > FWIW: > > > > Microsoft Windows XP [Version 5.1.2600] > (C) Copyright 1985-2001 Microsoft Corp. > > c:\temp>cd \ > > C:\>cd /windows/System32 > > C:\windows\system32> >

Re: Datetime objects

2006-08-02 Thread Lad
John Machin wrote: > Lad wrote: > > Sybren Stuvel wrote: > > > Lad enlightened us with: > > > > How can I find days and minutes difference between two datetime > > > > objects? > > > > For example If I have > > > > b=datetime.datetime(2006, 8, 2, 8, 57, 28, 687000) > > > > a=datetime.datetime(200

Re: Newbie Q: Class Privacy (or lack of)

2006-08-02 Thread Antoon Pardon
On 2006-07-28, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> >> class MyClass(object): >> >> __slots__ = ('bar',) >> >> def func(self): >> return 123 >> >> x = MyClass() >> x.instance_var_not_defined_in_the_class = 456 >> ==> >> AttributeError: 'MyClass' object has no a

Re: Newbie Q: Class Privacy (or lack of)

2006-08-02 Thread Diez B. Roggisch
> I find that a strange purpose because when you are working on a class, > you don't necessarily know if you will ever know many instance of that > class. So should I use __slots__ in all my classes, just to be sure > for when someone wants many instances of one? I find that a strange reasoning b

Re: Windows vs. Linux

2006-08-02 Thread John Salerno
Sybren Stuvel wrote: > Apple > moved from \r to \n as EOL character. Interesting. I didn't know that. Although it does seem to make sense to use both \r\n as EOL (if you still consider one as a carriage return and one as a newline, a la old school typewriters), \n is much nicer and cleaner loo

Re: Newbie Q: Class Privacy (or lack of)

2006-08-02 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Antoon Pardon wrote: > On 2006-07-28, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> This avoids the problem but you get others in return. And it's an >> abuse of `__slots__` which is meant as a way to save memory if you need >> really many objects of that type an

Is there an obvious way to do this in python?

2006-08-02 Thread H J van Rooyen
Hi, I want to write a small system that is transaction based. I want to split the GUI front end data entry away from the file handling and record keeping. Now it seems almost trivially easy using the sockets module to communicate between machines on the same LAN, so that I want to do the record

Re: how to get size of unicode string/string in bytes ?

2006-08-02 Thread Walter Dörwald
Diez B. Roggisch wrote: >> So then the easiest thing to do is: take the maximum length of a unicode >> string you could possibly want to store, multiply it by 4 and make that >> the length of the DB field. > >> However, I'm pretty convinced it is a bad idea to store Python unicode >> strings dire

Re: Convert string to mathematical function

2006-08-02 Thread jeremito
I was unaware of the exec and eval functions in Python. Without trying them, they seem to be what I want to do. I'll play around with it and see if I can figure it out. Thanks for the suggestions everyone. Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Newbie Cygwin Q

2006-08-02 Thread Gerry Blais
I'm trying to install and run, on XP, a queueing analysis package, PDQ, which has a{ Python, swig, C library version}. I'm new to Cygwin (but not to Unix). After installing Cygwin and Python, there is a Python2.4.exe in /lib. If I have a file with #!/lib/Python2.4.exe Print "hello" and I do

PyImport_Import() failed

2006-08-02 Thread Yang Fan
Hello,   I'm new to Python.I want to embed Python interpreter into my C++ application powered by Borland C++ Builder 2006.   I have written some C++ code in order to evaluate Python script file, but PyImport_Import() calls failed.I really don't know what's wrong with my cpp code.It always return a

Re: Newbie Cygwin Q

2006-08-02 Thread Gerry Blais
Sorry - problem solved. My #!/usr/Pyrthon2.4.exe was inadvertently on line 2... Gerry On Wed, 02 Aug 2006 13:04:10 -0400, Gerry Blais <[EMAIL PROTECTED]> wrote: >I'm trying to install and run, on XP, a queueing analysis package, >PDQ, which has a{ Python, swig, C library version}. > >I'm new

Re: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread simonharrison
thanks very much for all the comments, links to articles and other help.The Ruby crowd says you guys are no where near as friendly as them! I was half expecting a nervous breakdown after writing my first post here. Cheers again -- http://mail.python.org/mailman/listinfo/python-list

Re: Pickle vs XML for file I/O

2006-08-02 Thread crystalattice
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, crystalattice > wrote: > > >> What are the problems you fear when using `shelve` by the way? > >> > > The ideas I got about shelve are mostly due to this thread: > > http://tinyurl.com/lueok. There weren't any other threads > > contradictin

Re: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread BartlebyScrivener
[EMAIL PROTECTED] wrote: >> The Ruby crowd says you guys are no where >> near as friendly as them! Slander! Defamation! -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Python for my web site

2006-08-02 Thread Bruno Desthuilliers
Conrad a écrit : > On Mon, 31 Jul 2006 19:14:03 +0200, Bruno Desthuilliers wrote: > > >>northband wrote: >> >>>Hi, I am interested in re-writing my website in Python vs PHP but have a >>>few questions. Here are my specs, please advise as to which >>>configuration would be best: >>> >>>1.Dell Powe

Re: Nested function scope problem

2006-08-02 Thread Antoon Pardon
On 2006-08-02, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 2 Aug 2006 13:09:26 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> >> And how is this all relevant in deciding that the source language for >> the above interpreter actions isn't C? What th

Re: Programming newbie coming from Ruby: a few Python questions

2006-08-02 Thread Tim Chase
> The Ruby crowd says you guys are no where near as friendly as > them! I was half expecting a nervous breakdown after writing > my first post here. Maybe the Ruby folks have to be friendlier to make up for their language of choice... :*) The python mailing list is your pretty typical technical

Re: Using Python for my web site

2006-08-02 Thread Bruno Desthuilliers
Luis M. González a écrit : (snip). > I guess that the reason for not having used a framework already is > laziness... Strange enough, laziness is my first reason for using frameworks ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: ElementTree and Unicode

2006-08-02 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Sébastien Boisgérault wrote: > I am trying to embed an *arbitrary* (unicode) strings inside > an XML document. Of course I'd like to be able to reconstruct > it later from the xml document ... If the naive way to do it does > not work, can anyone suggest a way to do it ? E

  1   2   >