list of attributes

2008-03-07 Thread Ken
I have a class with a __getattr__ method that returns various methods. I also have the ability to determine the list of method names that are supported by my __getattr__ method (this list would be dynamically generated as it depends on the current state). What I would like to know is if there

Re: Regarding coding style

2008-03-07 Thread dave_mikesell
On Mar 7, 10:38 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 07 Mar 2008 20:04:47 -0800, dave_mikesell wrote: > > On Mar 7, 10:31 am, "K Viltersten" <[EMAIL PROTECTED]> wrote: > >> I've been recommended reading > >> of:http://www.python.org/dev/peps/pep-0008/and in th

Re: distutils - Is is possible to install without the .py extensions

2008-03-07 Thread Robert Kern
Jari Aalto wrote: > * Fri 2008-03-07 Robert Kern <[EMAIL PROTECTED]> gmane.comp.python.general > * Message-Id: [EMAIL PROTECTED] >> Jari Aalto wrote: >>> #!/usr/bin/python >>> >>> from distutils.core import setup >>> import glob >>> >>> setup(name='program', > ... >>> scri

Re: Regarding coding style

2008-03-07 Thread Steven D'Aprano
On Fri, 07 Mar 2008 20:04:47 -0800, dave_mikesell wrote: > On Mar 7, 10:31 am, "K Viltersten" <[EMAIL PROTECTED]> wrote: >> I've been recommended reading >> of:http://www.python.org/dev/peps/pep-0008/ and in there i saw two >> things that i >> need to get elaborated. >> >> 1. When writing English,

Re: float / rounding question

2008-03-07 Thread Steven D'Aprano
On Fri, 07 Mar 2008 23:12:27 +0100, Piet van Oostrum wrote: > Sorry to come in so late in this discussion. Although it is correct to > say that many real numbers that have an exact decimal representation > cannot be exactly represented in binary, that is no excuse to print 53.6 > as 53.600

Re: Regarding coding style

2008-03-07 Thread dave_mikesell
On Mar 7, 10:31 am, "K Viltersten" <[EMAIL PROTECTED]> wrote: > I've been recommended reading of:http://www.python.org/dev/peps/pep-0008/ > and in there i saw two things that i > need to get elaborated. > > 1. When writing English, Strunk and > White apply. If your code needs so much descriptive p

Re: Timed execution in eval

2008-03-07 Thread George Sakkis
On Mar 7, 11:12 am, [EMAIL PROTECTED] wrote: > I have various bits of code I want to interpret and run at runtime in > eval ... > > I want to be able to detect if they fail with error, I want to be able > to time them, and I want to be able to stop them if they run too > long. I cannot add code to

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
I figured I might as well share the code I ended up using, in case anyone else wants an easy way to get strings to, for instance, SQL- storable datetimes. [EMAIL PROTECTED]:~$ cat test.py #!/usr/bin/python from datetime import datetime import subprocess def parsedate( date ): p = subprocess.P

Re: islice ==> [::]

2008-03-07 Thread George Sakkis
On Mar 7, 7:49 am, [EMAIL PROTECTED] wrote: > I find itertools.islice() useful, so for Python 3.x I may like to see > it removed from the itertools module, and the normal slicing syntax > [::] extended to work with generators/iterators too. > > from itertools import islice > primes = (x for x in xr

the way of "import"

2008-03-07 Thread smalltalk
I have three files names t1.py,t2.py,t3.py in e:\test\dir1,of course dir2 is exsit the content of t1.py as follow: t1.py import os print 'this is t1.py' os.chdir('..\\dir2') the content of t2.py as follow: print "this is t2.py" the content of t3.py as follow: import t1 import t2 if i run t3.py i

Re: Timed execution in eval

2008-03-07 Thread castironpi
On Mar 7, 4:07 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > > I want to be able to detect if [certain threads] fail with error, > > You can't? Why ever not? Try this. ext can be found in 'C Function in a Python Context' on google groops. import ext extA= ext.Ext() extA[ 'a

Re: Better grammar.txt

2008-03-07 Thread Paul McGuire
On Mar 6, 1:20 pm, Jeroen Ruigrok van der Werven <[EMAIL PROTECTED] nomine.org> wrote: > -On [20080306 19:21], member thudfoo ([EMAIL PROTECTED]) wrote: > > >An error occurred while loading > >http://www.martinrinehart.com/articles/python-grammar.html: > >Unknown hostwww.martinrinehart.com > > Work

Re: Want - but cannot get - a nested class to inherit from outer class

2008-03-07 Thread DBak
On Mar 7, 3:41 pm, [EMAIL PROTECTED] wrote: > On Mar 7, 4:39 pm, DBak <[EMAIL PROTECTED]> wrote: > > > On Mar 7, 1:19 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > > > On Fri, Mar 7, 2008 at 3:00 PM, DBak <[EMAIL PROTECTED]> wrote: > > > >  However I can't do this, because, of course, the name

Re: Converting a string to the most probable type

2008-03-07 Thread Steven D'Aprano
On Fri, 07 Mar 2008 16:13:04 -0800, Paul Rubin wrote: > Pierre Quentel <[EMAIL PROTECTED]> writes: >> I would like to know if there is a module that converts a string to a >> value of the "most probable type" > > Python 2.4.4 (#1, Oct 23 2006, 13:58:00) > >>> import this > The Zen of

Re: Nested phrases [was Re: Want - but cannot get - a nested class to inherit from outer class]

2008-03-07 Thread castironpi
On Mar 7, 6:39 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 07 Mar 2008 14:26:25 -0800, castironpi wrote: > > Humans have enormous "mental stacks"--- the stacks the contexts the > > speakers speak in push things they're hearing on to. > > This is not true. Oh yeah.

Re: Edit and continue for debugging?

2008-03-07 Thread Bernard
As Jonathan says. :) I had a lot of fun learning how to plug doctests[1] into my python web apps and now I'm just adding them automatically as I create classes and functions. Those tests tidbits says so much more than a paragraph of comments. [1] : http://docs.python.org/lib/module-doctest.html

Re: Converting a string to the most probable type

2008-03-07 Thread John Machin
On Mar 8, 11:13 am, Paul Rubin wrote: > Pierre Quentel <[EMAIL PROTECTED]> writes: > > I would like to know if there is a module that converts a string to a > > value of the "most probable type" > > Python 2.4.4 (#1, Oct 23 2006, 13:58:00) > >>> import this >

Re: Intelligent Date & Time parsing

2008-03-07 Thread castironpi
On Mar 7, 5:00 pm, [EMAIL PROTECTED] wrote: > On Mar 7, 4:35 pm, Jeffrey Froman <[EMAIL PROTECTED]> wrote: > > > [EMAIL PROTECTED] wrote: > > > I need > > > something to parse user input for a django app, and it's awesome to be > > > able to write "last monday", "a year ago", or "10pm tuesday" like

Re: distutils - Is is possible to install without the .py extensions

2008-03-07 Thread Jari Aalto
* Fri 2008-03-07 Robert Kern <[EMAIL PROTECTED]> gmane.comp.python.general * Message-Id: [EMAIL PROTECTED] > Jari Aalto wrote: >> #!/usr/bin/python >> >> from distutils.core import setup >> import glob >> >> setup(name='program', ... >> scripts = ['program,py'], >>

Nested phrases [was Re: Want - but cannot get - a nested class to inherit from outer class]

2008-03-07 Thread Steven D'Aprano
On Fri, 07 Mar 2008 14:26:25 -0800, castironpi wrote: > Humans have enormous "mental stacks"--- the stacks the contexts the > speakers speak in push things they're hearing on to. This is not true. Human beings have extremely shallow mental stacks, limited by short-term memory. Most people are c

DOM parsing not working!

2008-03-07 Thread Mike D
Hello, I've spent the morning trying to parse a simple xml file and have the following: import sys from xml.dom import minidom doc=minidom.parse('topstories.xml') items = doc.getElementsByTagName("item") text='' for i in items: t = i.firstChild print t.nodeName if t.nodeType == t.TEXT

Re: Edit and continue for debugging?

2008-03-07 Thread Jonathan Gardner
This is an interesting issue because we who write web applications face the same problem. Except in the web world, the application state is stored in the browser so we don't have to work our way back to where we were. We just keep our url, cookies, and request parameters handy. Before I go on, I w

Re: Converting a string to the most probable type

2008-03-07 Thread Paul Rubin
Pierre Quentel <[EMAIL PROTECTED]> writes: > I would like to know if there is a module that converts a string to a > value of the "most probable type" Python 2.4.4 (#1, Oct 23 2006, 13:58:00) >>> import this The Zen of Python, by Tim Peters ... In the face of ambiguity, refus

Re: float / rounding question

2008-03-07 Thread Mark Dickinson
On Mar 7, 5:12 pm, Piet van Oostrum <[EMAIL PROTECTED]> wrote: > Python just uses the C library for printing, I presume, and the conversion > routines in the C library are rather simplistic. It is, however, possible > to do better, so that 53.6 -- although internally represented as something > that

Re: Want - but cannot get - a nested class to inherit from outer class

2008-03-07 Thread castironpi
On Mar 7, 4:39 pm, DBak <[EMAIL PROTECTED]> wrote: > On Mar 7, 1:19 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > > > On Fri, Mar 7, 2008 at 3:00 PM, DBak <[EMAIL PROTECTED]> wrote: > > >  However I can't do this, because, of course, the name Tree isn't > > >  available at the time that the class

Re: Converting a string to the most probable type

2008-03-07 Thread John Machin
On Mar 8, 1:53 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Mar 6, 9:17 pm, Luis M. González <[EMAIL PROTECTED]> wrote: > > > > > On 6 mar, 11:27, Pierre Quentel <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I would like to know if there is a module that converts a string to a > > > val

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
On Mar 7, 4:35 pm, Jeffrey Froman <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I need > > something to parse user input for a django app, and it's awesome to be > > able to write "last monday", "a year ago", or "10pm tuesday" like > > PHP's strtotime. > > Django comes with some pretty

Re: Regarding coding style

2008-03-07 Thread Micah Cowan
Grant Edwards <[EMAIL PROTECTED]> writes: > On 2008-03-07, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> Professional typesetters, using proportional fonts, don't use double- >> spaces because it throws off word spacing and line justification and just >> plain looks ugly. > > They do, however,

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
On Mar 7, 4:33 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Mar 7, 5:08 pm, [EMAIL PROTECTED] wrote: > > > I'm new to python and I was wondering if there are any intelligent > > date/time parsing modules out there. I've looked at strptime (or > > whichever it is) and mxDateTime from the eGenix pa

Re: Regarding coding style

2008-03-07 Thread Micah Cowan
"K Viltersten" <[EMAIL PROTECTED]> writes: > 2. You should use two spaces after a sentence-ending period. > > For heavens sake, why? I've always been obstructed by the double > blanks but tolerated them. Now, that i read that > it actually is a recommendation, i need to ask about the purpose. AFA

Re: Want - but cannot get - a nested class to inherit from outer class

2008-03-07 Thread DBak
On Mar 7, 1:19 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On Fri, Mar 7, 2008 at 3:00 PM, DBak <[EMAIL PROTECTED]> wrote: > >  However I can't do this, because, of course, the name Tree isn't > >  available at the time that the classes _MT and _Node are defined, so > >  _MT and _Node can't in

Re: Intelligent Date & Time parsing

2008-03-07 Thread Jeffrey Froman
[EMAIL PROTECTED] wrote: > I need > something to parse user input for a django app, and it's awesome to be > able to write "last monday", "a year ago", or "10pm tuesday" like > PHP's strtotime. Django comes with some pretty handy filters for doing this sort of formatting. Check out the "date", "n

Re: os.chdir

2008-03-07 Thread Michael Wieher
2008/3/7, Maryam Saeedi <[EMAIL PROTECTED]>: > > I have a problem using os.chdir on linux. What should I do if I want to > change to root directory? The below does not work: > > os.chdir("~/dir1") > > Thanks > > -- > http://mail.python.org/mailman/listinfo/python-list > >>> os.getcwd() '/home/micha

Re: Intelligent Date & Time parsing

2008-03-07 Thread Carl Banks
On Mar 7, 5:08 pm, [EMAIL PROTECTED] wrote: > I'm new to python and I was wondering if there are any intelligent > date/time parsing modules out there. I've looked at strptime (or > whichever it is) and mxDateTime from the eGenix package. I need > something to parse user input for a django app, and

Re: Regarding coding style

2008-03-07 Thread castironpi
> Grant Edwards                   grante             Yow! A shapely CATHOLIC >                                   at               SCHOOLGIRL is FIDGETING >                                visi.com            inside my costume.. ... Are you wearing it? *plonkblock* So, what gets you plonked around

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
On Mar 7, 4:22 pm, [EMAIL PROTECTED] wrote: [snip] > Although if I end up writing my own I'll sure use > datetime.parser.parse to get everything left over once you remove I mean dateutil.parser.parse. Tomorrow I'll have to leave off the last Lunchtime Guiness. > strings like "this saturday". So it

Re: Want - but cannot get - a nested class to inherit from outer class

2008-03-07 Thread castironpi
On Mar 7, 3:19 pm, "Chris Mellon" <[EMAIL PROTECTED]> wrote: > On Fri, Mar 7, 2008 at 3:00 PM, DBak <[EMAIL PROTECTED]> wrote: > > >  I would like to build a class for a data structure such that nodes of > >  the data structure - of interest only to the data structure > >  implementation itself and

os.chdir

2008-03-07 Thread Maryam Saeedi
I have a problem using os.chdir on linux. What should I do if I want to change to root directory? The below does not work: os.chdir("~/dir1") Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
On Mar 7, 4:10 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Mar 7, 4:08 pm, [EMAIL PROTECTED] wrote: > > > I'm new to python and I was wondering if there are any intelligent > > date/time parsing modules out there. I've looked at strptime (or > > whichever it is) and mxDateTime from the eGenix

Re: distutils - Is is possible to install without the .py extensions

2008-03-07 Thread Robert Kern
Jari Aalto wrote: > Given following setup.py stanza: > > #!/usr/bin/python > > from distutils.core import setup > import glob > > setup(name='program', > description='', > keywords='', > version='', > url='', > download_url='', >

Re: Time Zone application after strptime?

2008-03-07 Thread M.-A. Lemburg
On 2008-03-07 22:24, Jim Carroll wrote: > It's taken me a couple of hours to give up on strptime with %Z for recognizing > time zones... but that still leaves me in the wrong zone: > > def paypal_to_mysql_date(ppDate): > # a typical paypal date is 10:29:52 Feb 29, 2008 PST > date_parts = p

Re: float / rounding question

2008-03-07 Thread Piet van Oostrum
> casevh <[EMAIL PROTECTED]> (C) wrote: >C> On Feb 25, 2:44 am, [EMAIL PROTECTED] wrote: >>> Hi I'm very much a beginner with Python. >>> I want to write a function to convert celcius to fahrenheit like this >>> one: >>> >>> def celciusToFahrenheit(tc): >>> tf = (9/5)*tc+32 >>> return tf >>>

Re: How to clear a list (3 ways).

2008-03-07 Thread John Machin
On Mar 8, 1:49 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 07 Mar 2008 09:39:05 -0200, <[EMAIL PROTECTED]> > escribi�: > > > Executive summary : What idiom do you use for resetting a list ? > >lst = |] # (1) > >lst[:] = [] # (2) > >del lst[:] # (3) > > (3) if I wan

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
On Mar 7, 4:10 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Mar 7, 4:08 pm, [EMAIL PROTECTED] wrote: > > > I'm new to python and I was wondering if there are any intelligent > > date/time parsing modules out there. I've looked at strptime (or > > whichever it is) and mxDateTime from the eGenix

Re: Regarding coding style

2008-03-07 Thread Roberto Bonvallet
On Mar 7, 6:16 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I believe it is one of those things that everybody (for some value of > "everybody") does because that's what they were taught to do Actually I was never taught to, and I never learnt about it anywhere. I started to

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
On Mar 7, 4:08 pm, [EMAIL PROTECTED] wrote: > I'm new to python and I was wondering if there are any intelligent > date/time parsing modules out there. I've looked at strptime (or > whichever it is) and mxDateTime from the eGenix package. I need > something to parse user input for a django app, and

Re: Intelligent Date & Time parsing

2008-03-07 Thread Mike Driscoll
On Mar 7, 4:08 pm, [EMAIL PROTECTED] wrote: > I'm new to python and I was wondering if there are any intelligent > date/time parsing modules out there. I've looked at strptime (or > whichever it is) and mxDateTime from the eGenix package. I need > something to parse user input for a django app, and

Intelligent Date & Time parsing

2008-03-07 Thread shakefu
I'm new to python and I was wondering if there are any intelligent date/time parsing modules out there. I've looked at strptime (or whichever it is) and mxDateTime from the eGenix package. I need something to parse user input for a django app, and it's awesome to be able to write "last monday", "a

Re: Timed execution in eval

2008-03-07 Thread Steven D'Aprano
On Fri, 07 Mar 2008 08:12:38 -0800, alex.pedwysocki wrote: > I have various bits of code I want to interpret and run at runtime in > eval ... I hope that code doesn't contain any data coming from an untrusted user. > I want to be able to detect if they fail with error, That's what try...except

Re: Better grammar.txt

2008-03-07 Thread Steven D'Aprano
On Fri, 07 Mar 2008 13:42:56 -0800, MartinRinehart wrote: > Jeroen Ruigrok van der Werven wrote: >> >http://www.martinrinehart.com/articles/python-grammar.html: Unknown >> >host www.martinrinehart.com >> >> Works for me. > > Very interesting. The link I posted works for me, while the links quoted

distutils - Is is possible to install without the .py extensions

2008-03-07 Thread Jari Aalto
Given following setup.py stanza: #!/usr/bin/python from distutils.core import setup import glob setup(name='program', description='', keywords='', version='', url='', download_url='', license='', author='',

Re: While executing the class definition which object is referenced by the first argument of the class method, Y r Object attributes not allowed as default arguments

2008-03-07 Thread Steven D'Aprano
On Fri, 07 Mar 2008 09:49:58 -0800, Krishna wrote: > I am more interested in knowing about the first argument ('self'), what > does it hold to allow the evaluation of the method, take the example you > gave, 'self.a' as Rvalue inside the method, how and why is this allowed, "self" is treated as a

Re: Better grammar.txt

2008-03-07 Thread MartinRinehart
Jeroen Ruigrok van der Werven wrote: > >http://www.martinrinehart.com/articles/python-grammar.html: > >Unknown host www.martinrinehart.com > > Works for me. Very interesting. The link I posted works for me, while the links quoted are 404 errors, though they look identical. This really is a super

Location and size of a frame

2008-03-07 Thread K Viltersten
I'm disliking the size of my frame and also i'm disappointed regarding it's location. So, i wish to change them. At this link http://infohost.nmt.edu/tcc/help/pubs/tkinter/frame.html the frame object is discussed but as far i can tell, there are only suggestions regarding what to put in the cons

Re: I cannot evaluate this statement...

2008-03-07 Thread Michael Wieher
The parentheses are there for a reason 2008/3/7, Steven D'Aprano <[EMAIL PROTECTED]>: > > On Fri, 07 Mar 2008 12:38:11 -0800, waltbrad wrote: > > > The script comes from Mark Lutz's Programming Python. It is the second > > line of a script that will launch a python program on any platform. > > >

Re: Regarding coding style

2008-03-07 Thread Aahz
In article <[EMAIL PROTECTED]>, Grant Edwards <[EMAIL PROTECTED]> wrote: > >My thumb has been putting two spaces after a period for 30 >years, so the chances that it's going to change are rather >slim. :) +1 QOTW -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ "All

Time Zone application after strptime?

2008-03-07 Thread Jim Carroll
It's taken me a couple of hours to give up on strptime with %Z for recognizing time zones... but that still leaves me in the wrong zone: def paypal_to_mysql_date(ppDate): # a typical paypal date is 10:29:52 Feb 29, 2008 PST date_parts = ppDate.split() withouttz = " ".join(date_parts[:-

Re: I cannot evaluate this statement...

2008-03-07 Thread John Machin
On Mar 8, 7:38 am, waltbrad <[EMAIL PROTECTED]> wrote: > The script comes from Mark Lutz's Programming Python. It is the > second line of a script that will launch a python program on any > platform. > > import os, sys > pyfile = (sys.platform[:3] == 'win' and 'python.exe') or 'python' > > Okay, r

Re: I cannot evaluate this statement...

2008-03-07 Thread Steven D'Aprano
On Fri, 07 Mar 2008 12:38:11 -0800, waltbrad wrote: > The script comes from Mark Lutz's Programming Python. It is the second > line of a script that will launch a python program on any platform. > > import os, sys > pyfile = (sys.platform[:3] == 'win' and 'python.exe') or 'python' > > Okay, run

Re: Regarding coding style

2008-03-07 Thread Grant Edwards
On 2008-03-07, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Professional typesetters, using proportional fonts, don't use double- > spaces because it throws off word spacing and line justification and just > plain looks ugly. They do, however, put more space between sentences than they do betwee

Re: Want - but cannot get - a nested class to inherit from outer class

2008-03-07 Thread Chris Mellon
On Fri, Mar 7, 2008 at 3:00 PM, DBak <[EMAIL PROTECTED]> wrote: > I want - but cannot get - a nested class to inherit from an outer > class. (I searched the newsgroup and the web for this, couldn't find > anything - if I missed an answer to this please let me know!) > > I would like to build a

Re: Regarding coding style

2008-03-07 Thread Steven D'Aprano
On Fri, 07 Mar 2008 11:58:38 -0500, D'Arcy J.M. Cain wrote: >> 2. You should use two spaces after a >> sentence-ending period. >> >> For heavens sake, why? I've always been obstructed by the double blanks >> but >> tolerated them. Now, that i read that it actually is a recommendation, >> i need t

Re: Timed execution in eval

2008-03-07 Thread castironpi
On Mar 7, 10:12 am, [EMAIL PROTECTED] wrote: > I have various bits of code I want to interpret and run at runtime in > eval ... import sys from time import clock, sleep from threading import Timer TimeoutError= type('TimeoutError',(Exception,),{}) class Elapse: def __init__( self ): s

Re: Want - but cannot get - a nested class to inherit from outer class

2008-03-07 Thread Jeff
Use metaclasses? DBak wrote: > I want - but cannot get - a nested class to inherit from an outer > class. (I searched the newsgroup and the web for this, couldn't find > anything - if I missed an answer to this please let me know!) > > I would like to build a class for a data structure such that

Re: Want - but cannot get - a nested class to inherit from outer class

2008-03-07 Thread DBak
Sorry - code for the class should read: class Tree(object): ...class _MT(Tree): ..def isEmpty(self): return True ..def insert(self, X): return Tree._Node(X) ...class _Node(Tree): ..def isEmpty(self): return False ..def insert(self, X): return _Node(X, self, Tree._MT()) ...def __ini

Re: looking for a light weighted library/tool to write simple GUI above the text based application

2008-03-07 Thread petr . jakes . tpc
Finaly, after few experiments, I am using pygame. It comunicates directly with the framebuffer and the performance is excellent. Thanks for your help. Petr Jakes -- http://mail.python.org/mailman/listinfo/python-list

Re: I cannot evaluate this statement...

2008-03-07 Thread Chris Mellon
On Fri, Mar 7, 2008 at 2:38 PM, waltbrad <[EMAIL PROTECTED]> wrote: > The script comes from Mark Lutz's Programming Python. It is the > second line of a script that will launch a python program on any > platform. > > import os, sys > pyfile = (sys.platform[:3] == 'win' and 'python.exe') or 'py

Re: I cannot evaluate this statement...

2008-03-07 Thread Tim Chase
> import os, sys > pyfile = (sys.platform[:3] == 'win' and 'python.exe') or 'python' > > Okay, run on a win32 machine, pyfile evaluates to python.exe [snip] > Now. Run this on linux. The first condition evaluates sys.platform[:3] > == 'win' as false. [snip] > Where am I going wrong. And when will

Want - but cannot get - a nested class to inherit from outer class

2008-03-07 Thread DBak
I want - but cannot get - a nested class to inherit from an outer class. (I searched the newsgroup and the web for this, couldn't find anything - if I missed an answer to this please let me know!) I would like to build a class for a data structure such that nodes of the data structure - of intere

Re: I cannot evaluate this statement...

2008-03-07 Thread Jerry Hill
On Fri, Mar 7, 2008 at 3:38 PM, waltbrad <[EMAIL PROTECTED]> wrote: > Now. Run this on linux. The first condition evaluates sys.platform[:3] > == 'win' as false. So, the next comparison should be 'False' or > 'python' -- This is because 'and' returns the first false value. > But, again, on l

I cannot evaluate this statement...

2008-03-07 Thread waltbrad
The script comes from Mark Lutz's Programming Python. It is the second line of a script that will launch a python program on any platform. import os, sys pyfile = (sys.platform[:3] == 'win' and 'python.exe') or 'python' Okay, run on a win32 machine, pyfile evaluates to python.exe That makes sen

Re: Timed execution in eval

2008-03-07 Thread castironpi
On Mar 7, 10:12 am, [EMAIL PROTECTED] wrote: > I have various bits of code I want to interpret and run at runtime in > eval ... > > I want to be able to detect if they fail with error, I want to be able > to time them, and I want to be able to stop them if they run too > long.  I cannot add code to

Re: islice ==> [::]

2008-03-07 Thread Raymond Hettinger
[castiro] > Slice literals are a logical next step, precedented by raw strings and > bytes. slice= islice is too, precedented by range= xrange. Looking closely at the [::] notation, I think it can easily be confused with an open box of fleas. IMO, the one unequivocal, explicit way of checking fo

Re: Converting a string to the most probable type

2008-03-07 Thread castironpi
> And so on and so forth.  The tricky bit is how to tell the difference > between Day, Month and Year. There isn't one. -- http://mail.python.org/mailman/listinfo/python-list

Re: Difference between 'function' and 'method'

2008-03-07 Thread castironpi
On Mar 7, 6:44 am, Sion Arrowsmith <[EMAIL PROTECTED]> wrote: > Gabriel Genellina <[EMAIL PROTECTED]> wrote: > >En Thu, 06 Mar 2008 23:46:43 -0200, <[EMAIL PROTECTED]> escribi�: > >> [ ... ] > >You may look at the SimpleXMLRPCServer class and see how it implements   > >introspection. It's rather

Re: islice ==> [::]

2008-03-07 Thread castironpi
> > I find itertools.islice() useful, so for Python 3.x I may like to see > general iterables.  Third, the analogy breaks down quickly (i.e. > chain(it[:2], it[2:]) does not give the same result as iter(it) unless > >>> s = 'abcdefg' > >>> list(W(s)[2:]) Slice literals are a logical next step, pr

Re: Can't get items out of a set?

2008-03-07 Thread Raymond Hettinger
[Cruxic] > Is it possible to get an object out of a set() given another object > that has the same hash code and equality (__hash__() and __eq__() > return the same)? Yes, but it requires an indirect approach. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/499299 Raymond -- http://mail

Re: While executing the class definition which object is referenced by the first argument of the class method, Y r Object attributes not allowed as default arguments

2008-03-07 Thread castironpi
On Mar 7, 11:49 am, Krishna <[EMAIL PROTECTED]> wrote: > On Mar 6, 5:04 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > > > > > > En Thu, 06 Mar 2008 22:48:42 -0200, Krishna <[EMAIL PROTECTED]> > > escribi�: > > > class Test(object): > > > ...     def __init__(self): > > > ...          

Re: islice ==> [::]

2008-03-07 Thread Raymond Hettinger
[bearophileH] > I find itertools.islice() useful, so for Python 3.x I may like to see > it removed from the itertools module, and the normal slicing syntax > [::] extended to work with generators/iterators too. This is a can of worms. First, remember iterations is a protocol, not a type. So, thi

Can't get items out of a set?

2008-03-07 Thread Cruxic
Hello, all. Is it possible to get an object out of a set() given another object that has the same hash code and equality (__hash__() and __eq__() return the same)? You can't do this with Java Sets either and I've needed it on multiple occasions. Doesn't it seem like it would be useful? Consider

Re: SV: Regarding coding style

2008-03-07 Thread Grant Edwards
On 2008-03-07, K Viltersten <[EMAIL PROTECTED]> wrote: >>> Personally, I dislike double spaces after sentences, but it is >>> not wrong to put them there any more than it is wrong not to >>> put them there. >> >> You're lucky my high school typing teacher didn't hear you say >> that... > > I'm un

Re: Regarding coding style

2008-03-07 Thread Jeroen Ruigrok van der Werven
-On [20080307 19:10], D'Arcy J.M. Cain ([EMAIL PROTECTED]) wrote: >The arguments for one over the other fall into these basic ones. Use >double spaces to make the document easier to read, especially by people >who read a lot and tend to skim to absorb as much information as >poss

Re: Regarding coding style

2008-03-07 Thread D'Arcy J.M. Cain
On 7 Mar 2008 17:40:08 GMT Jon Ribbens <[EMAIL PROTECTED]> wrote: > Well, no, it's to follow a particular person's choice out of the many > and various competing rules of "correct English usage". Personally, > I dislike double spaces after sentences, but it is not wrong to put > them there any more

SV: Regarding coding style

2008-03-07 Thread K Viltersten
>> Personally, I dislike double spaces after >> sentences, but it is not wrong to put them >> there any more than it is wrong not to put >> them there. > > You're lucky my high school typing teacher > didn't hear you say that... I'm unclear if your teacher was a double or single spacer. It's

Re: While executing the class definition which object is referenced by the first argument of the class method, Y r Object attributes not allowed as default arguments

2008-03-07 Thread Krishna
On Mar 6, 5:04 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 06 Mar 2008 22:48:42 -0200, Krishna <[EMAIL PROTECTED]> > escribi�: > > > > class Test(object): > > ... def __init__(self): > > ... self.a= 2 > > ... def func(self, k = self.a): > > ...

Re: Regarding coding style

2008-03-07 Thread Grant Edwards
On 2008-03-07, Jon Ribbens <[EMAIL PROTECTED]> wrote: > Personally, I dislike double spaces after sentences, but it is > not wrong to put them there any more than it is wrong not to > put them there. You're lucky my high school typing teacher didn't hear you say that... -- Grant Edwards

SV: Regarding coding style

2008-03-07 Thread K Viltersten
>> 2. You should use two spaces after a >> sentence-ending period. >> >> For heavens sake, why? I've always been >> obstructed by the double blanks but >> tolerated them. Now, that i read that >> it actually is a recommendation, i need >> to ask about the purpose. > > (a) It makes the ends of

Re: Regarding coding style

2008-03-07 Thread Jon Ribbens
On 2008-03-07, D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: >> 2. You should use two spaces after a sentence-ending period. >> >> For heavens sake, why? I've always been obstructed by the double >> blanks but tolerated them. Now, that i read that it actually is a >> recommendation, i need to ask ab

Re: system32 directory

2008-03-07 Thread Robert Dailey
On Fri, Mar 7, 2008 at 2:49 AM, Tim Golden <[EMAIL PROTECTED]> wrote: > > Ah. Sorry. I'm sure you can call it via ctypes (built in > from Python 2.5). But even if I'd realised that's what > you'd wanted, I'd probably have given the original answer > because pywin32 pretty much *is* standard library

Re: Converting a string to the most probable type

2008-03-07 Thread rockingred
Dates can be a pain. I wrote my own date program, simply because there are so many different ways to write a date: Mar 8, 2008 March 8th, 08 03/08/08 03-08-2008 And so on and so forth. The tricky bit is how to tell the difference between Day, Month and Year. I wrote a program to check the form

Re: Regarding coding style

2008-03-07 Thread Jeff Schwab
K Viltersten wrote: > I've been recommended reading of: > http://www.python.org/dev/peps/pep-0008/ > and in there i saw two things that i need to get elaborated. > > > 1. When writing English, Strunk and White apply. > > Where can i download it? Am i actually > expected to read the whole book?

Re: Regarding coding style

2008-03-07 Thread D'Arcy J.M. Cain
On Fri, 7 Mar 2008 16:44:10 + "Simon Brunning" <[EMAIL PROTECTED]> wrote: > On Fri, Mar 7, 2008 at 4:31 PM, K Viltersten <[EMAIL PROTECTED]> wrote: > > > > 1. When writing English, Strunk and > > White apply. > > I apply Fowler, PEP 8 be damned. ;-) Fowler's is good too but much more compre

Re: Regarding coding style

2008-03-07 Thread D'Arcy J.M. Cain
On Fri, 7 Mar 2008 17:31:35 +0100 "K Viltersten" <[EMAIL PROTECTED]> wrote: > I've been recommended reading of: > http://www.python.org/dev/peps/pep-0008/ > and in there i saw two things that i > need to get elaborated. > > > 1. When writing English, Strunk and > White apply. > > Where can i d

Re: Regarding coding style

2008-03-07 Thread Richard Brodie
"K Viltersten" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 1. When writing English, Strunk and White apply. Do they? I've never seen them ;) > 2. You should use two spaces after a sentence-ending period. > > For heavens sake, why? Most people find it easier to type two space

Re: Regarding coding style

2008-03-07 Thread Simon Brunning
On Fri, Mar 7, 2008 at 4:31 PM, K Viltersten <[EMAIL PROTECTED]> wrote: > > 1. When writing English, Strunk and > White apply. I apply Fowler, PEP 8 be damned. ;-) -- Cheers, Simon B. [EMAIL PROTECTED] http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python

Re: OT: Failed saving throw

2008-03-07 Thread Aahz
In article <[EMAIL PROTECTED]>, Aahz <[EMAIL PROTECTED]> wrote: > >For anyone who hasn't heard, E. Gary Gygax died yesterday. Some people >think we should build a tomb in his honor. ;-) ...and xkcd finally weighs in: http://xkcd.com/393/ -- Aahz ([EMAIL PROTECTED]) <*> http:/

Re: Keep a python script running after browser window closed

2008-03-07 Thread Mike Driscoll
On Mar 7, 10:28 am, sophie_newbie <[EMAIL PROTECTED]> wrote: > Hi, > > I have a cgi script that performs a very long computation that can > take several hours to complete. Is there any smart way that I can keep > this script running until it is finished (after the user has closed > the browser) and

Re: problem with join

2008-03-07 Thread nodrogbrown
> If the string is only used to open a file, and never shown to the user, > what you prefer is irrelevant, isn't it? guess thats right.. > Back to your code, try this: > > from os.path import join, normpath > folder = 'F:/brown/code/python/fgrp1' > names = ['amber1.jpg', 'amber3.jpg', 'amy1.jpg

Keep a python script running after browser window closed

2008-03-07 Thread sophie_newbie
Hi, I have a cgi script that performs a very long computation that can take several hours to complete. Is there any smart way that I can keep this script running until it is finished (after the user has closed the browser) and email them with the results. The email bit isn't the problem, I just do

Re: Regarding coding style

2008-03-07 Thread Michael Wieher
Placing 2 spaces after a period is standard, grammatically correct English, at least as I was taught... I don't know who Strunk or White are. Maybe Mr. Pink has a book you can refer to instead. 2008/3/7, K Viltersten <[EMAIL PROTECTED]>: > > I've been recommended reading of: > http://www.python.

  1   2   >