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: 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: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: 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: 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: 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: 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: 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

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: 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

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: 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 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: 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 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: 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: 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: 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
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: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: 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: 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: 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: 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: 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

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

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

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'], >>

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: 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: 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: 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: 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: 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: 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: 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

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: 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

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: 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: 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: 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 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: 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 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

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

<    1   2