Re: Namespaces/introspection: collecting sql strings for validation

2007-04-22 Thread Martin Drautzburg
George Sakkis wrote: > Yes, there is: use an ORM to do the SQL generation for you. Check out > SQLAlchemy, it will buy you much more than what you asked for. Might look, though in general I don't like OR mappers much. Having SQL generated feels as strange as having python code generated. Too much

Re: serializable object references

2007-04-22 Thread Martin Drautzburg
Gabriel Genellina wrote: > En Sun, 22 Apr 2007 12:47:10 -0300, Martin Drautzburg > <[EMAIL PROTECTED]> escribió: > >> I was thinking that it would be nice if a web application could talk >> to real objects. The client side does not need to know the internals >> of an object, it acts as a "view" f

Re: Dictionaries and dot notation

2007-04-22 Thread Martin Drautzburg
Alex Martelli wrote: > Martin Drautzburg <[EMAIL PROTECTED]> wrote: > >> > mydata = data( ) >> > mydata.foo = 'foo' >> > mydata.bar = 'bar' >> > >> > print mydata.foo >> > print mydata.bar >> >> I am aware of all this. >> Okay let me rephrase my question: is there a way of using dot >> notation

Re: Select weirdness

2007-04-22 Thread Irmen de Jong
Ron Garret wrote: > I don't understand why socketserver calling select should matter. (And > BTW, there are no calls to select in SocketServer.py. I'm using > Python2.5.) You don't *need* a select at all. Socketserver just blocks on accept() and dispatches a handler on the new connection. >>

Socket exceptions aren't in the standard exception hierarchy

2007-04-22 Thread John Nagle
Here are three network-related exceptions. These were caught by "except" with no exception type, because none of the more specific exceptions matched. This is what a traceback produced: 1. File "D:\Python24\lib\socket.py", line 295, in read data = self._sock.recv(recv_size) timeout: timed

Re: Namespaces/introspection: collecting sql strings for validation

2007-04-22 Thread Peter Otten
Martin Drautzburg wrote: > > def SQL(sql, checked=set()): > > if sql in checked: > > return True > > if not valid_sql(sql): raise ValueError > > checked.add(sql) > > return sql > > No this does not do the trick. I will not be able to validate an sql > statement bofore I ru

Re: python style guide inconsistencies

2007-04-22 Thread Martin v. Löwis
> I have the impression that tradition will change in 3.0 and your preference > realized. > Wrong? or have you not been following? I have not been following, so this might be the case. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's handling of unicode surrogates

2007-04-22 Thread Martin v. Löwis
> The Unicode standard doesn't require that you support surrogates, or > any other kind of character, so no you wouldn't be lying. There is the notion of Unicode implementation levels, and each of them does include a set of characters to support. In level 1, combining characters need not to be sup

Re: Support for new items in set type

2007-04-22 Thread Prateek
Oh dear god, I implemented this and it overall killed performance by about 50% - 100%. The same script (entering 3000 items) takes between 88 - 109s (it was running in 55s earlier). Here is the new Set implementation: class SeaSet(set): __slots__ = ['master', 'added', 'deleted'] de

Re: Python's handling of unicode surrogates

2007-04-22 Thread Martin v. Löwis
> IMHO what is really needed is a bunch of high level methods like > .graphemes() - iterate over graphemes > .codepoints() - iterate over codepoints > .isword() - check if the string represents one word > etc... This doesn't need to come as methods, though. If anybody wants to provide a library wi

Re: recursion depth problem

2007-04-22 Thread proctor
On Apr 22, 8:23 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > Steven Bethard <[EMAIL PROTECTED]> wrote: > >... > > > > > > import sys > > > def ch4(item, n=0): > > >if n < len(item): > > >if item[n] == '0': > > >item[n] = '1' > > >

Initial Release: latexmath2png

2007-04-22 Thread Kamil Kisiel
This past week I cleaned up and released some of my code for converting LaTeX math equations in to PNG images. The current concept is to have a useful unix-style command line utility as well as a module that can be embedded in to other applications such as wikis, CMSs, etc. I've released it under a

Re: recursion depth problem

2007-04-22 Thread proctor
On Apr 22, 9:28 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 22 Apr 2007 19:13:31 -0700, proctor <[EMAIL PROTECTED]> declaimed the > following in comp.lang.python: > > > > > :-) > > > this is good stuff. for learning especially! thank you again! > > Took me some time to find... M

Re: recursion depth problem

2007-04-22 Thread [EMAIL PROTECTED]
On Apr 22, 9:13�pm, proctor <[EMAIL PROTECTED]> wrote: > On Apr 22, 7:10 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > > > > > > > On 22 Apr 2007 17:06:18 -0700, proctor <[EMAIL PROTECTED]> declaimed the > > following in comp.lang.python: > > > > > � � else: > > > > � � � � # only one of carry

Re: Dictionaries and dot notation

2007-04-22 Thread Alex Martelli
Martin Drautzburg <[EMAIL PROTECTED]> wrote: > > mydata = data( ) > > mydata.foo = 'foo' > > mydata.bar = 'bar' > > > > print mydata.foo > > print mydata.bar > > I am aware of all this. > Okay let me rephrase my question: is there a way of using dot notation > without having to create a class?

Re: recursion depth problem

2007-04-22 Thread Steven Bethard
Alex Martelli wrote: > Steven Bethard <[EMAIL PROTECTED]> wrote: >... >>> import sys >>> def ch4(item, n=0): >>>if n < len(item): >>>if item[n] == '0': >>>item[n] = '1' >>>print ''.join(item) >>>

Re: Dictionaries and dot notation

2007-04-22 Thread Ben Finney
Martin Drautzburg <[EMAIL PROTECTED]> writes: > Okay let me rephrase my question: is there a way of using dot > notation without having to create a class? Dot notation, e.g. 'foo.bar', is parsed by the interpreter as "access the attribute named 'bar' of the object 'foo'". Objects have attributes

Re: Python and Javascript equivalence

2007-04-22 Thread 7stud
On Apr 22, 7:00 pm, "Sam the Cat" <[EMAIL PROTECTED]> wrote: > Hey All, > > I am writing some COM code in Python to control photoshop. Several > functions of PS require an "Array" argument. In the examples of VBscript or > javascript the Array type is used. I have tried what would appear to be t

Re: Namespaces/introspection: collecting sql strings for validation

2007-04-22 Thread Alex Martelli
Martin Drautzburg <[EMAIL PROTECTED]> wrote: ... > The problem is the first part: how can I lookup the callers module and > the classobjs defined in there? Or finding any constant strings in the > caller's module would also be just fine. Or is there a completely > different way to do such a thin

Re: Python and Javascript equivalence

2007-04-22 Thread Prateek
Try creating a dict with sequential numeric keys. If you already have a list called my_list, you can do: com_array = dict(zip(range(len(my_list)), my_list)) This works when you want to convert Python objects to Javascript using JSON. It may work for you. -Prateek -- http://mail.python.org/ma

inspect.getblock()

2007-04-22 Thread Aaron Brady
inspect.getblock() seems to halt prematurely. This code only prints 6 lines of the 12 line input file. assume it's by design, but the docs don't mention getblock. docstring is "Extract the block of code at the top of the given list of lines," which should be "code *from* the top." ###whati

Re: pickled object, read and write..

2007-04-22 Thread Prateek
On Apr 22, 11:40 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi all. > > I have to put together some code that reads high scores from a saved > file, then gives the user the opportunity to add their name and score > to the high scores list, which is then saved. > > Trouble is, I can't tell

Re: recursion depth problem

2007-04-22 Thread Alex Martelli
Steven Bethard <[EMAIL PROTECTED]> wrote: ... > > import sys > > def ch4(item, n=0): > >if n < len(item): > >if item[n] == '0': > >item[n] = '1' > >print ''.join(item) > >ch4(item) > >

Re: *** Dr G Polya BRILLIANTLY analyses the Virgina Shooting Incident ***

2007-04-22 Thread joseph2k
[EMAIL PROTECTED] wrote: > Dr Gideon Polya published some 130 works in a 4 decade scientific > career, most recently a huge pharmacological reference text > "Biochemical Targets of Plant Bioactive Compounds" (Taylor & Francis, > New York & London, 2003), and is currently editing a completed book o

Re: recursion depth problem

2007-04-22 Thread proctor
On Apr 22, 7:34 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > proctor wrote: > > On Apr 22, 2:06 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > >> proctor wrote: > >>> On Apr 22, 1:24 pm, Michael Bentley <[EMAIL PROTECTED]> wrote: > On Apr 22, 2007, at 1:49 PM, proctor wrote: > > i have

Re: recursion depth problem

2007-04-22 Thread proctor
On Apr 22, 7:10 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 22 Apr 2007 17:06:18 -0700, proctor <[EMAIL PROTECTED]> declaimed the > following in comp.lang.python: > > > > else: > > > # only one of carry in, b1, or b2 is set > > #or none is set! Missed t

Re: recursion depth problem

2007-04-22 Thread Steven Bethard
proctor wrote: > On Apr 22, 2:06 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: >> proctor wrote: >>> On Apr 22, 1:24 pm, Michael Bentley <[EMAIL PROTECTED]> wrote: On Apr 22, 2007, at 1:49 PM, proctor wrote: > i have a small function which mimics binary counting. it runs fine as > lon

Re: Class Not Auto-Init On Import

2007-04-22 Thread Steve Holden
Dennis Lee Bieber wrote: > On Sat, 21 Apr 2007 11:56:05 -0400, Steve Holden <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> Robert Rawlins - Think Blue wrote: > >>> LocationService.setIP(‘192.168.1.1’) >>> >> This isn't a call on a specific LocationService instance, it's a

Re: Can __init__ not return an object?

2007-04-22 Thread Steve Holden
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). I seem to be > having problems. At the end of __init__ I say (somet

Python and Javascript equivalence

2007-04-22 Thread Sam the Cat
Hey All, I am writing some COM code in Python to control photoshop. Several functions of PS require an "Array" argument. In the examples of VBscript or javascript the Array type is used. I have tried what would appear to be the equivalent in Python -- Lists and Tuples -- but to no avail. An

Re: serializable object references

2007-04-22 Thread Gabriel Genellina
En Sun, 22 Apr 2007 12:47:10 -0300, Martin Drautzburg <[EMAIL PROTECTED]> escribió: > I was thinking that it would be nice if a web application could talk to > real objects. The client side does not need to know the internals of an > object, it acts as a "view" for server-side models. All it has

Re: *** Dr G Polya BRILLIANTLY analyses the Virgina Shooting Incident ***

2007-04-22 Thread bill . sloman
On Apr 22, 8:49 pm, Jim Thompson <[EMAIL PROTECTED] Web-Site.com> wrote: > Ignorant Bastard Poster > > On 22 Apr 2007 11:32:34 -0700, [EMAIL PROTECTED] wrote: > > >Dr Gideon Polya published some 130 works in a 4 decade scientific > >career, most recently a huge pharmacological reference text > >"Bi

Re: recursion depth problem

2007-04-22 Thread proctor
On Apr 22, 5:51 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sun, 22 Apr 2007 17:37:05 -0500, Michael Bentley > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > Anything that can be done with recursion can be done without > > recursion. If you really wanted to mimic

Re: recursion depth problem

2007-04-22 Thread proctor
On Apr 22, 5:51 pm, Michael Bentley <[EMAIL PROTECTED]> wrote: > Oops! Note to self: *ALWAYS* try code before posting to a public > forum :-( > > def binary(val, width): > print '%10s = the sum of' % val > for i in [2 ** x for x in range(width - 1, -1, -1)]: > a = v

Re: [ANN] mlabwrap-1.0final

2007-04-22 Thread Alexander Schmolck
Stef Mientki <[EMAIL PROTECTED]> writes: > Alexander Schmolck wrote: > > I'm pleased to finally announce mlabwrap-1.0: > > Project website > > > --- > > > > Description > > > --- > > Mlabwrap-1.0 is a high-level python to matlab(tm) bridge t

Re: recursion depth problem

2007-04-22 Thread Michael Bentley
Oops! Note to self: *ALWAYS* try code before posting to a public forum :-( def binary(val, width): print '%10s = the sum of' % val for i in [2 ** x for x in range(width - 1, -1, -1)]: a = val / i print ' ' * 13 + '%s * (2 ** %s)' % (a, width)

Re: recursion depth problem

2007-04-22 Thread Michael Bentley
On Apr 22, 2007, at 5:47 PM, proctor wrote: > On Apr 22, 4:37 pm, Michael Bentley <[EMAIL PROTECTED]> wrote: >> On Apr 22, 2007, at 4:08 PM, proctor wrote: >> >> >> >>> On Apr 22, 2:55 pm, [EMAIL PROTECTED] wrote: On Apr 22, 11:49 am, proctor <[EMAIL PROTECTED]> wrote: >> > hello, >> >>>

Re: recursion depth problem

2007-04-22 Thread proctor
On Apr 22, 5:05 pm, tac-tics <[EMAIL PROTECTED]> wrote: > Yes, you should use a for loop in this situation. > > Certain functional languages, such as Scheme and various LISP dialects > allow for what is called "tail recursion" which effectively eliminates > this problem by internally converting rec

Re: file.read() returns an emtpy even if its currenet position is not at the end

2007-04-22 Thread js
Thank you for reply. I've just found the bug report on this. http://sourceforge.net/tracker/index.php?func=detail&aid=1523853&group_id=5470&atid=105470 Nobody seems to be working on this, though. On 22 Apr 2007 14:41:29 -0700, Alberto Valverde <[EMAIL PROTECTED]> wrote: > On Apr 22, 6:51 pm, "j

Re: recursion depth problem

2007-04-22 Thread tac-tics
Yes, you should use a for loop in this situation. Certain functional languages, such as Scheme and various LISP dialects allow for what is called "tail recursion" which effectively eliminates this problem by internally converting recursion to iteration. Python isn't really cut out for heavy recurs

Re: Namespaces/introspection: collecting sql strings for validation

2007-04-22 Thread George Sakkis
On Apr 21, 4:16 pm, Martin Drautzburg <[EMAIL PROTECTED]> wrote: > 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 sta

Re: Bug in select (was: Re: Select weirdness)

2007-04-22 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > Well, on WinXP, Python 2.4, with I should have specified: I'm running 2.5 on unix. (I've reproduced the problem on both Linux and OS X.) rg -- http://mail.python.org/mailman/listinfo/python-list

Re: recursion depth problem

2007-04-22 Thread proctor
On Apr 22, 4:37 pm, Michael Bentley <[EMAIL PROTECTED]> wrote: > On Apr 22, 2007, at 4:08 PM, proctor wrote: > > > > > On Apr 22, 2:55 pm, [EMAIL PROTECTED] wrote: > >> On Apr 22, 11:49 am, proctor <[EMAIL PROTECTED]> wrote: > > >>> hello, > > >>> i have a small function which mimics binary countin

Re: Bug in select

2007-04-22 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Erik Max Francis <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > > Geez you people are picky. Since I ran this several times I ran into > > the TIM_WAIT problem. Here's the actual transcript: > > It's not about being picky, it's about making it clear what y

Re: recursion depth problem

2007-04-22 Thread Michael Bentley
On Apr 22, 2007, at 4:08 PM, proctor wrote: > On Apr 22, 2:55 pm, [EMAIL PROTECTED] wrote: >> On Apr 22, 11:49 am, proctor <[EMAIL PROTECTED]> wrote: >> >> >> >>> hello, >> >>> i have a small function which mimics binary counting. it runs >>> fine as >>> long as the input is not too long, but

Re: Vector classes

2007-04-22 Thread Gabriel Genellina
En Sun, 22 Apr 2007 09:33:53 -0300, Mizipzor <[EMAIL PROTECTED]> escribió: > During my coding Ive found two vector classes on the internet. Ive > modified them both a little but the do both have advantages and > disadvantages. > > vector1: http://rafb.net/p/4FVdh699.html > vector2: http://rafb.net

Re: [re.finditer] Getting all occurences in one go?

2007-04-22 Thread Paul Rubin
Gilles Ganault <[EMAIL PROTECTED]> writes: > for match in matches: > if mytable[item]=="": > mytable[item]= match.group(1) > else: > mytable[item]= mytable[item] + "," + match.group(1) # > --- END > === > > Can the lines between B

Re: Bug in select

2007-04-22 Thread Erik Max Francis
Ron Garret wrote: > Geez you people are picky. Since I ran this several times I ran into > the TIM_WAIT problem. Here's the actual transcript: It's not about being picky, it's about making it clear what your problem is. You're now describing an entirely different problem, hence why it's imp

Re: Building browser-like GET request

2007-04-22 Thread Steve Holden
Björn Keil wrote: [...] > > I hope that helped and I wasn't telling things you already new. > As a sidenote: For the task you describe I'd rather use an actual > sniffer - such as Wireshark (http://en.wikipedia.org/wiki/Wireshark), > than logs of a Proxy... Not sure wether Wireshark works under Wi

Re: python cgi problem with textarea

2007-04-22 Thread Graham Dumpleton
On Apr 22, 11:09 pm, placid <[EMAIL PROTECTED]> wrote: > On Apr 22, 4:08 pm, Adrian Smith <[EMAIL PROTECTED]> wrote: > > > > > 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: >

Re: recursion depth problem

2007-04-22 Thread proctor
On Apr 22, 2:06 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > proctor wrote: > > On Apr 22, 1:24 pm, Michael Bentley <[EMAIL PROTECTED]> wrote: > >> On Apr 22, 2007, at 1:49 PM, proctor wrote: > > >>> i have a small function which mimics binary counting. it runs fine as > >>> long as the input i

Re: file.read() returns an emtpy even if its currenet position is not at the end

2007-04-22 Thread Alberto Valverde
On Apr 22, 6:51 pm, "js " <[EMAIL PROTECTED]> wrote: > Hi list. > > I'm writing a tail -f like program in python > and I found file.read() doesn't work as I think it should. > > Here's the code illustrating my problem. > > ### > #!/usr/bin/env python > import os, sys > filename = "test.out" > > f =

Re: python style guide inconsistencies

2007-04-22 Thread Bjoern Schliessmann
Darren Dale wrote: > I was just searching for some guidance on how to name packages and > modules, and discovered some inconsistencies on the > www.python.org. http://www.python.org/doc/essays/styleguide.html > says "Module names can be either MixedCase or lowercase." That > page also refers to PE

Re: [re.finditer] Getting all occurences in one go?

2007-04-22 Thread Gilles Ganault
On Sun, 22 Apr 2007 23:28:23 +0200, Gilles Ganault <[EMAIL PROTECTED]> wrote: >I'd like to make sure there isn't an easier way to extract all the >occurences found with re.finditer: Oops, s/match/item/: req = urllib2.Request(url, None, headers) response = urllib2.urlopen(req).read() matches = re.

[re.finditer] Getting all occurences in one go?

2007-04-22 Thread Gilles Ganault
Hello I'd like to make sure there isn't an easier way to extract all the occurences found with re.finditer: === req = urllib2.Request(url, None, headers) response = urllib2.urlopen(req).read() matches = re.compile("(\d+).html").finditer(response) # --- BEGIN for match

Re: Bug in select

2007-04-22 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Erik Max Francis <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > > So this is clearly a bug, but surely I'm not the first person to have > > encountered this? Is there a known workaround? > > It's hard to see how this demonstrates a bug in anything, since yo

Re: python style guide inconsistencies

2007-04-22 Thread Terry Reedy
""Martin v. Löwis"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Darren Dale schrieb: | > I was just searching for some guidance on how to name packages and modules, | > and discovered some inconsistencies on the www.python.org. | > http://www.python.org/doc/essays/styleguide.ht

Re: Bug in select

2007-04-22 Thread Erik Max Francis
Ron Garret wrote: > So this is clearly a bug, but surely I'm not the first person to have > encountered this? Is there a known workaround? It's hard to see how this demonstrates a bug in anything, since you're telnetting to the wrong port in your example. -- Erik Max Francis && [EMAIL PROTEC

Re: Python "robots.txt" parser broken since 2003

2007-04-22 Thread John Nagle
Steven Bethard wrote: > John Nagle wrote: > >> Terry Reedy wrote: >> >>> "John Nagle" <[EMAIL PROTECTED]> wrote in message >>> news:[EMAIL PROTECTED] >>> | This was reported in 2003, and a patch was uploaded in 2005, but >>> the patch >>> | never made it into Python 2.4 or 2.5. >>> >>> If the pa

Re: function minimization

2007-04-22 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Is anyone aware of python library that does function minimization a la | Minuit (http://wwwasdoc.web.cern.ch/wwwasdoc/minuit/) used by CERN? Have you checked the minimization function in scipy? -- http://mail.python.org/mailman/li

Re: recursion depth problem

2007-04-22 Thread proctor
On Apr 22, 2:55 pm, [EMAIL PROTECTED] wrote: > On Apr 22, 11:49 am, proctor <[EMAIL PROTECTED]> wrote: > > > > > hello, > > > i have a small function which mimics binary counting. it runs fine as > > long as the input is not too long, but if i give it input longer than > > 8 characters it gives >

Bug in select (was: Re: Select weirdness)

2007-04-22 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Ron Garret <[EMAIL PROTECTED]> wrote: > The answer is obvious: select is looking only at the underlying socket, > and not at the rfile buffers. Here is conclusive proof that there's a bug in select: from socket import * from select import select s=socket(AF_INET

Re: recursion depth problem

2007-04-22 Thread half . italian
On Apr 22, 11:49 am, proctor <[EMAIL PROTECTED]> wrote: > hello, > > i have a small function which mimics binary counting. it runs fine as > long as the input is not too long, but if i give it input longer than > 8 characters it gives > > RuntimeError: maximum recursion depth exceeded in cmp > > i

Re: Vector classes

2007-04-22 Thread Erik Max Francis
Mizipzor wrote: > During my coding Ive found two vector classes on the internet. Ive > modified them both a little but the do both have advantages and > disadvantages. > > vector1: http://rafb.net/p/4FVdh699.html > vector2: http://rafb.net/p/0KShGu30.html > > With 1, I can typ vec.x and vec.y, v

Re: Python's handling of unicode surrogates

2007-04-22 Thread Ross Ridge
Rhamphoryncus <[EMAIL PROTECTED]> wrote: >I wish to write software that supports Unicode. Like it or not, >Unicode goes beyond the BMP, so I'd be lying if I said I supported >Unicode if I only handled the BMP. The Unicode standard doesn't require that you support surrogates, or any other kind of

Re: pickled object, read and write..

2007-04-22 Thread hg
[EMAIL PROTECTED] wrote: > Hi all. > > I have to put together some code that reads high scores from a saved > file, then gives the user the opportunity to add their name and score > to the high scores list, which is then saved. > > Trouble is, I can't tell the program to read a file that doesn't

Re: pickled object, read and write..

2007-04-22 Thread phreaki
On Apr 22, 2:40 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi all. > > I have to put together some code that reads high scores from a saved > file, then gives the user the opportunity to add their name and score > to the high scores list, which is then saved. > > Trouble is, I can't tell

Re: recursion depth problem

2007-04-22 Thread Steven Bethard
proctor wrote: > On Apr 22, 1:24 pm, Michael Bentley <[EMAIL PROTECTED]> wrote: >> On Apr 22, 2007, at 1:49 PM, proctor wrote: >> >> >> >>> i have a small function which mimics binary counting. it runs fine as >>> long as the input is not too long, but if i give it input longer than >>> 8 characte

Re: python style guide inconsistencies

2007-04-22 Thread Martin v. Löwis
Darren Dale schrieb: > I was just searching for some guidance on how to name packages and modules, > and discovered some inconsistencies on the www.python.org. > http://www.python.org/doc/essays/styleguide.html says "Module names can be > either MixedCase or lowercase." That page also refers to PEP

Re: Vector classes

2007-04-22 Thread Will McGugan
Mizipzor wrote: > During my coding Ive found two vector classes on the internet. Ive > modified them both a little but the do both have advantages and > disadvantages. > I'm working on a vector class at the moment, in my 'gameobjects' library. It's not really ready for public consumption, but fee

Re: recursion depth problem

2007-04-22 Thread proctor
On Apr 22, 1:24 pm, Michael Bentley <[EMAIL PROTECTED]> wrote: > On Apr 22, 2007, at 1:49 PM, proctor wrote: > > > > > i have a small function which mimics binary counting. it runs fine as > > long as the input is not too long, but if i give it input longer than > > 8 characters it gives > > > Run

Re: Python's handling of unicode surrogates

2007-04-22 Thread Leo Kislov
On Apr 20, 7:34 pm, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > On Apr 20, 6:21 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > If you absolutely think support for non-BMP characters is necessary > > in every program, suggesting that Python use UCS-4 by default on > > all systems has a higher c

[ANN] Pythonutils 0.3.0

2007-04-22 Thread Fuzzyman
There is a new (and long overdue) release of the `Pythonutils module `_. This is version **0.3.0**. * `Quick Download: Pythonutils 0.3.0.zip `_ What

Re: Select weirdness

2007-04-22 Thread Jean-Paul Calderone
On Sun, 22 Apr 2007 11:42:10 -0700, Ron Garret <[EMAIL PROTECTED]> wrote: >I think I've figured out what's going on. > > [snip] > >As you can see, the select call shows input available for a while (five >lines) and then shows no input available despite the fact that there is >manifestly still input

Re: Dictionaries and dot notation

2007-04-22 Thread Martin Drautzburg
Daniel Nogradi wrote: >> > What if I want to create a datastructure that can be used in dot >> > notation without having to create a class, i.e. because those >> > objects have no behavior at all? >> >> A class inheriting from dict and implementing __getattr__ and >> __setattr__ should do the tri

python style guide inconsistencies

2007-04-22 Thread Darren Dale
I was just searching for some guidance on how to name packages and modules, and discovered some inconsistencies on the www.python.org. http://www.python.org/doc/essays/styleguide.html says "Module names can be either MixedCase or lowercase." That page also refers to PEP 8 at http://www.python.org/d

Re: recursion depth problem

2007-04-22 Thread Michael Bentley
On Apr 22, 2007, at 1:49 PM, proctor wrote: > i have a small function which mimics binary counting. it runs fine as > long as the input is not too long, but if i give it input longer than > 8 characters it gives > > RuntimeError: maximum recursion depth exceeded in cmp > > i'm not too sure what

Re: Namespaces/introspection: collecting sql strings for validation

2007-04-22 Thread Scott David Daniels
Martin Drautzburg wrote: > I would like to validate sql strings, which are spread all over the > code, The statements will not be assembled from smaller pieces, > but they will not neccessarily be defined at module level. I could > live with class level, > parse the source file, but I am

sharon stone paris hilton

2007-04-22 Thread S S
sharon stone paris hilton www.alphasearch.at www.alphasearch.be www.alphasearch.it www.alphasearch.info www.alphasearch.gr www.alphasearch.es www.alphasearch.se www.alphasearch.dk -- http://mail.python.org/mailman/listinfo/python-list

recursion depth problem

2007-04-22 Thread proctor
hello, i have a small function which mimics binary counting. it runs fine as long as the input is not too long, but if i give it input longer than 8 characters it gives RuntimeError: maximum recursion depth exceeded in cmp i'm not too sure what i am doing improperly. is there really a lot of r

Re: *** Dr G Polya BRILLIANTLY analyses the Virgina Shooting Incident ***

2007-04-22 Thread Jim Thompson
Ignorant Bastard Poster On 22 Apr 2007 11:32:34 -0700, [EMAIL PROTECTED] wrote: >Dr Gideon Polya published some 130 works in a 4 decade scientific >career, most recently a huge pharmacological reference text >"Biochemical Targets of Plant Bioactive Compounds" (Taylor & Francis, >New York & London

Re: Select weirdness

2007-04-22 Thread Ron Garret
I think I've figured out what's going on. First, here's the smoking gun: I changed the code as follows: class myHandler(StreamRequestHandler): def handle(self): print '>>>' while 1: sl = select([self.rfile],[],[],1)[0] print sl l = self.rfile.readline() i

pickled object, read and write..

2007-04-22 Thread [EMAIL PROTECTED]
Hi all. I have to put together some code that reads high scores from a saved file, then gives the user the opportunity to add their name and score to the high scores list, which is then saved. Trouble is, I can't tell the program to read a file that doesn't exist, that generates an error. So I m

*** Dr G Polya BRILLIANTLY analyses the Virgina Shooting Incident ***

2007-04-22 Thread thermate
Dr Gideon Polya published some 130 works in a 4 decade scientific career, most recently a huge pharmacological reference text "Biochemical Targets of Plant Bioactive Compounds" (Taylor & Francis, New York & London, 2003), and is currently editing a completed book on global avoidable mortality (nume

Re: Namespaces/introspection: collecting sql strings for validation

2007-04-22 Thread Martin Drautzburg
Peter Otten wrote: > Martin Drautzburg wrote: > >> 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. > > def validateSQL(

Re: Dictionaries and dot notation

2007-04-22 Thread Martin Drautzburg
> mydata = data( ) > mydata.foo = 'foo' > mydata.bar = 'bar' > > print mydata.foo > print mydata.bar I am aware of all this. Okay let me rephrase my question: is there a way of using dot notation without having to create a class? -- http://mail.python.org/mailman/listinfo/python-list

Re: Select weirdness

2007-04-22 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Ron Garret <[EMAIL PROTECTED]> wrote: > 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 >

Re: Convert from/to struct_time

2007-04-22 Thread Diez B. Roggisch
Florian Lindner schrieb: > Hello, > I have a struct_time and a datetime object and need compare them. Is there > any function that converts either of these two to another? datetime.datetime(*time.localtime()[:6]) Diez -- http://mail.python.org/mailman/listinfo/python-list

Convert from/to struct_time

2007-04-22 Thread Florian Lindner
Hello, I have a struct_time and a datetime object and need compare them. Is there any function that converts either of these two to another? Thanks, Florian -- http://mail.python.org/mailman/listinfo/python-list

file.read() returns an emtpy even if its currenet position is not at the end

2007-04-22 Thread js
Hi list. I'm writing a tail -f like program in python and I found file.read() doesn't work as I think it should. Here's the code illustrating my problem. ### #!/usr/bin/env python import os, sys filename = "test.out" f = open(filename, "w+") f.write("Hello") f.flush() f.seek(0, 2) statinfo =

Re: Flat DB seeking speed

2007-04-22 Thread Aahz
In article <[EMAIL PROTECTED]>, Jia Lu <[EMAIL PROTECTED]> wrote: > > I see there are lots of flat db or db-like modules in the standard >python modules. > What about the keywords seeking speed of them ? > > (I want to put about 1 articles with 1 IDs, and I can do >searching keywords with

Re: No speedup on multi-processor machine?

2007-04-22 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, John Nagle <[EMAIL PROTECTED]> wrote: >Caleb Hattingh wrote: >> On Apr 21, 11:02 pm, [EMAIL PROTECTED] wrote: >> >>>Hi, >>>I am using Python Thread library for my parallel processing course >>>project. I am doing matrix convolution on a multi-processor machine >>>r

Re: Support for new items in set type

2007-04-22 Thread Aahz
In article <[EMAIL PROTECTED]>, Prateek <[EMAIL PROTECTED]> wrote: > >Thanks Alex, but we're actually implementing a (non-relational) >database engine. Why are you reinventing the wheel? Why not just implement your functionality on top of an existing database as your backing store? -- Aahz ([E

Re: Dictionaries and dot notation

2007-04-22 Thread Bruno Desthuilliers
Martin Drautzburg a écrit : > This may be pretty obvious for most of you: > > When I have an object (an instance of a class "Foo") I can access > attributes via dot notation: > > aFoo.bar > > however when I have a dictionary > > aDict = {"bar":"something"} > > I have to write

Re: python cgi problem with textarea

2007-04-22 Thread Adrian Smith
On Apr 22, 10:09 pm, placid <[EMAIL PROTECTED]> wrote: > i just tried it and its working. here it is > > http://yallara.cs.rmit.edu.au/~bevcimen/form.html > > maybe the internal server error is because mod_python isn't installed > assuming your using Apache as your web server Yeah, but it wouldn'

Re: python cgi problem with textarea

2007-04-22 Thread Jim
On Apr 22, 2:08 am, Adrian Smith <[EMAIL PROTECTED]> wrote: > ...and I get an internal server error if I have any spaces in the > textarea, And what error appears in the server error log? -- http://mail.python.org/mailman/listinfo/python-list

Re: Select weirdness

2007-04-22 Thread Ron Garret
In article <[EMAIL PROTECTED]>, Irmen de Jong <[EMAIL PROTECTED]> wrote: > Ron Garret wrote: > > 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 shor

Re: serializable object references

2007-04-22 Thread Martin Drautzburg
Gabriel Genellina wrote: > En Sun, 22 Apr 2007 08:07:27 -0300, Martin Drautzburg > <[EMAIL PROTECTED]> escribió: > >> Is it possible to convert an object into a string that identifies the >> object in a way, so it can later be looked up by this string. >> Technically this should be possible, beca

Re: No speedup on multi-processor machine?

2007-04-22 Thread danfan1981
Thanks guys. But I think IronPython only works on Windows machine, but I am using a Sun machine. I was suggested to use Jython, which can run on Sun. But I need to use Numpy for matrix operations, which is only available to CPython. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python "robots.txt" parser broken since 2003

2007-04-22 Thread Steven Bethard
John Nagle wrote: > Terry Reedy wrote: >> "John Nagle" <[EMAIL PROTECTED]> wrote in message >> news:[EMAIL PROTECTED] >> | This was reported in 2003, and a patch was uploaded in 2005, but the >> patch >> | never made it into Python 2.4 or 2.5. >> >> If the patch is still open, perhaps you could r

  1   2   >