Re: Returning a date as string

2007-04-21 Thread Björn Keil
On 22 Apr., 02:26, John Machin <[EMAIL PROTECTED]> wrote: > On Apr 22, 6:59 am, Björn Keil <[EMAIL PROTECTED]> wrote: > > > Hello pythons, > > > I have little problem with understanding conversions in python. I've > > written a little class - nothing much, just to try out Python a little > > - cont

Re: Problem redefining __getitem__ for str subclass

2007-04-21 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > I do not think I am understanding how to redefine the getitem function > for string. Why does the following not work: > > class NStr(str): > def __getitem__(self,idx): > print "NStr:getitem",idx,type(idx) > return str.__getitem__(self,idx) > > s=N

Re: Support for new items in set type

2007-04-21 Thread Alex Martelli
Prateek <[EMAIL PROTECTED]> wrote: > I have a bit of a specialized request. > > I'm reading a table of strings (specifically fixed length 36 char > uuids generated via uuid.uuid4() in the standard library) from a file > and creating a set out of it. > Then my program is free to make whatever modi

Re: Support for new items in set type

2007-04-21 Thread Steven D'Aprano
On Sat, 21 Apr 2007 20:13:44 -0700, Prateek wrote: > I have a bit of a specialized request. > > I'm reading a table of strings (specifically fixed length 36 char > uuids generated via uuid.uuid4() in the standard library) from a file > and creating a set out of it. > Then my program is free to ma

Re: Can __init__ not return an object?

2007-04-21 Thread Steven D'Aprano
On Sat, 21 Apr 2007 22:36:42 -0400, Steven W. Orr wrote: > When I go to create an object I want to be able to decide whether the > object is valid or not in __init__, and if not, I want the constructor to > return something other than an object, (like maybe None). None is an object, like everyt

python cgi problem with textarea

2007-04-21 Thread Adrian Smith
This may be more a cgi thing than a Python one, but I'm trying to get this page: http://adrian10.phpwebhosting.com/trial.html consisting basically of this: ...to print out the contents of the textarea with this cgi script: #!/usr/bin/python import cgi print "Content-type: text/html\n" form

Re: Handy short cut for formatting elapsed time in floating point seconds

2007-04-21 Thread Steven D'Aprano
On Sat, 21 Apr 2007 18:09:01 -0700, Paul McGuire wrote: > I am doing some simple timing of some elements of Python scripts, and > the simplest is to just call time.time() before and after key elements > of the script: > > t1 = time.time() > > # do lengthy operation > > t2 = time.time() > print

Namespaces/introspection: collecting sql strings for validation

2007-04-21 Thread Martin Drautzburg
I would like to validate sql strings, which are spread all over the code, i.e. I run ("prepare") them against a database to see if it happy with the statements. Spelling errors in sql have been a major pain for me. The statements will not be assembled from smaller pieces, but they will not neccess

Select weirdness

2007-04-21 Thread Ron Garret
Here's my code. It's a teeny weeny little HTTP server. (I'm not really trying to reinvent the wheel here. What I'm really doing is writing a dispatching proxy server, but this is the shortest way to illustrate the problem I'm having): from SocketServer import * from socket import * from sele

<    1   2