Ten rules to becoming a Python community member.

2011-08-13 Thread rantingrick
Follow these simply rules to become an accepted member of the Python community. 1. Bash rantingrick and Xah Lee every chance you get. 2. Bash people who bash rick or xah because their basing made rick's or xah's words pass through your

Re: How do I convert String into Date object

2011-08-13 Thread MrPink
I found this solution. Python: Convert String Date to Date Object http://slaptijack.com/programming/python-convert-string-date-to-date-object/ On Aug 13, 3:14 pm, MrPink wrote: > Is this the correct way to convert a String into a Date? > I only have dates and no time. > > import time, datetime >

Re: allow line break at operators

2011-08-13 Thread rantingrick
On Aug 12, 4:06 pm, Seebs wrote: > On 2011-08-12, Chris Angelico wrote: > > > Why is left-to-right inherently more logical than > > multiplication-before-addition? > > I'd say it's certainly "more Pythonic in a vacuum". > Multiplication-before-addition, and all the related rules, require > you to

Re: allow line break at operators

2011-08-13 Thread rantingrick
On Aug 12, 7:39 pm, Seebs wrote: > Consider the hypothetical array syntax: > >         a = [ >             1, >             2 >         b = [ >             3, >             4 > > This *bugs* me.  It's perfectly legible, and if you define it that way, it's > unambiguous and everything, but... It b

Data issues with Django and Apache

2011-08-13 Thread John Gordon
I'm devleoping a website using the Django framework along with Apache, and I'm seeing some odd data issues. During the course of navigating through the website content, a user will cause the creation of some data records with a limited lifespan. These data records have a create_dt field which is a

Re: allow line break at operators

2011-08-13 Thread rantingrick
On Aug 12, 7:39 pm, Seebs wrote: > I was overjoyed when I saw that Ruby would let me write 1_048_576. I'll have to admit that Ruby has a few very interesting ideas, this being one of them. We all know how impossible it can be to eyeball parse a very long number like this. Having the interpretor

Re: allow line break at operators

2011-08-13 Thread rantingrick
On Aug 12, 7:39 pm, Seebs wrote: > Well, that's the thing. > > In a case like: > >         if foo: >                 if bar: >                         blah >         blah > > I notice that *NOTHING* lines up with "if bar:".  And that affects me > about the way unmatched brackets do. For me, i be

Re: allow line break at operators

2011-08-13 Thread rantingrick
On Aug 12, 5:03 pm, Steven D'Aprano wrote: > Responding to Rick's standard {EDIT} posts > is like wrestling with a {EDIT} > [...] > Save yourself a lot of aggravation and kill-file him now. Kindly allow Walter E. Kurtz to shine some light on this situation: """ Pig after pig, cow after cow, vil

Re: How do I convert String into Date object

2011-08-13 Thread Roy Smith
In article <83822ecb-3643-42c6-a2bf-0187c07d3...@a10g2000yqn.googlegroups.com>, MrPink wrote: > Is this the correct way to convert a String into a Date? > I only have dates and no time. You have already received a number of good replies, but let me throw out one more idea. If you ever need t

Re: Relative import from script with same name as package

2011-08-13 Thread Chris Angelico
On Sun, Aug 14, 2011 at 12:55 AM, OKB (not okblacke) wrote: > sys.path = sys.path[1:] + [''] > > (That is, move the current directory to the end of the search path > instead of the beginning.) > Or, equivalently: sys.path.append(sys.path.pop(0)) ChrisA -- http://mail.python.org/mailman/listinf

Re: Relative import from script with same name as package

2011-08-13 Thread OKB (not okblacke)
OKB (not okblacke) wrote: > But why? That __future__ import is supposed to make > absolute > imports the default, so why is "import thetest" importing > thetest.py instead of the package called thetest? The absolute > import should make it look in sys.path first and not try to

Relative import from script with same name as package

2011-08-13 Thread OKB (not okblacke)
I'm using Python 2.6.5. I have a directory structure like this: thetest/ __init__.py thetest.py theother.py __init__.py is an empty file. theother.py contains a function foo(). The package is accessible from sys.path, so that if I open the interpreter and do "

Re: How do I convert String into Date object

2011-08-13 Thread MrPink
BTW, here is the Python version I'm using. Will this make a difference with the solutions you guys provided? Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Also, what editor do you guys use? There are so many to chose from. On Aug 13, 4:11 pm, Rafa

Re: How do I convert String into Date object

2011-08-13 Thread Peter Otten
MrPink wrote: > I have file of records delimited by spaces. > I need to import the date string and convert them into date datatypes. > > '07/27/2011' 'Event 1 Description' > '07/28/2011' 'Event 2 Description' > '07/29/2011' 'Event 3 Description' > > I just discovered that my oDate is not an obje

Re: How do I convert String into Date object

2011-08-13 Thread Rafael Durán Castañeda
You can use datetime objects: >>> dt1 = datetime.datetime.strptime('07/27/2011',"%m/%d/%Y") >>> dt2 =datetime.datetime.strptime('07/28/2011',"%m/%d/%Y") >>> dt1 == dt2 False >>> dt1 > dt2 False >>> dt1 < dt2 True >>> dt1 - dt2 datetime.timedelta(-1) On 13/08/11 21:26, MrPink wrote: I have file

Re: How do I convert String into Date object

2011-08-13 Thread Chris Rebert
On Sat, Aug 13, 2011 at 12:14 PM, MrPink wrote: > Is this the correct way to convert a String into a Date? > I only have dates and no time. > > import time, datetime > > oDate = time.strptime('07/27/2011', '%m/%d/%Y') > print oDate from datetime import datetime the_date = datetime.strptime('07/27

Re: How do I convert String into Date object

2011-08-13 Thread MrPink
I have file of records delimited by spaces. I need to import the date string and convert them into date datatypes. '07/27/2011' 'Event 1 Description' '07/28/2011' 'Event 2 Description' '07/29/2011' 'Event 3 Description' I just discovered that my oDate is not an object, but a structure and not a d

How do I convert String into Date object

2011-08-13 Thread MrPink
Is this the correct way to convert a String into a Date? I only have dates and no time. import time, datetime oDate = time.strptime('07/27/2011', '%m/%d/%Y') print oDate Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Re: Dialog boxes in curses

2011-08-13 Thread fab
Thanks all for your suggestions, I'll look into them. See you. -- F. Delente -- http://mail.python.org/mailman/listinfo/python-list

Re: Dialog boxes in curses

2011-08-13 Thread Thorsten Kampe
* f...@slick.airforce-one.org (13 Aug 2011 15:21:01 GMT) > I want to have dialog boxes (a message with Yes/No/Cancel options, > possibly with keyboard accels) in python + curses. Use Python Dialog[1] which is basically a wrapper for dialog boxes around ncurses. Thorsten [1] http://pythondialog.s

Re: Dialog boxes in curses

2011-08-13 Thread Nicholas Cole
On Sat, Aug 13, 2011 at 4:37 PM, Irmen de Jong wrote: > On 13-8-2011 17:21, f...@slick.airforce-one.org wrote: >> Hello. >> >> I've googled for hints but I didn't find anything, I hope it's not an >> RTFM question :^) >> >> I want to have dialog boxes (a message with Yes/No/Cancel options, >> poss

Re: Dialog boxes in curses

2011-08-13 Thread Irmen de Jong
On 13-8-2011 17:21, f...@slick.airforce-one.org wrote: > Hello. > > I've googled for hints but I didn't find anything, I hope it's not an > RTFM question :^) > > I want to have dialog boxes (a message with Yes/No/Cancel options, > possibly with keyboard accels) in python + curses. > > Does anyon

Dialog boxes in curses

2011-08-13 Thread fab
Hello. I've googled for hints but I didn't find anything, I hope it's not an RTFM question :^) I want to have dialog boxes (a message with Yes/No/Cancel options, possibly with keyboard accels) in python + curses. Does anyone have a pointer to docs about this? Thanks! -- F. Delente -- http://

Re: Java is killing me! (AKA: Java for Pythonheads?)

2011-08-13 Thread rav
On Aug 12, 1:35 pm, MRAB wrote: > On 12/08/2011 18:02, kj wrote: > > > > > > > > > > > *Please* forgive me for asking a Java question in a Python forum. > > My only excuse for this no-no is that a Python forum is more likely > > than a Java one to have among its readers those who have had to > > d

Re: thread and process

2011-08-13 Thread Dave Angel
On 01/-10/-28163 02:59 PM, 守株待兔 wrote: please see my code: import os import threading print threading.currentThread() print "i am parent ",os.getpid() ret = os.fork() print "i am here",os.getpid() print threading.currentThread() if ret == 0: print threading.currentThread() els

Re: thread and process

2011-08-13 Thread Carl Banks
On Saturday, August 13, 2011 2:09:55 AM UTC-7, 守株待兔 wrote: > please see my code: > import os > import  threading > print  threading.currentThread()  > print "i am parent ",os.getpid() > ret  =  os.fork() > print  "i am here",os.getpid() > print  threading.currentThread() > if  ret  ==  0: >   

Re: generate and send mail with python: tutorial

2011-08-13 Thread aspineux
On Aug 13, 3:00 am, Ben Finney wrote: > Ben Finney writes: > > What is the process if the OP, or someone to whom the OP delegates > > authority, wants to [contribute their work to the Python > > documentation]? > > The answer is partly at http://docs.python.org/documenting/>: > >     If you’re in

Re: thread and process

2011-08-13 Thread aspineux
On Aug 13, 11:09 am, "守株待兔" <1248283...@qq.com> wrote: > please see my code: > import os > import threading > print threading.currentThread() > print "i am parent ",os.getpid() > ret = os.fork() > print "i am here",os.getpid() > print threading.currentThread() > if ret == 0: > p

thread and process

2011-08-13 Thread 守株待兔
please see my code: import os import threading print threading.currentThread() print "i am parent ",os.getpid() ret = os.fork() print "i am here",os.getpid() print threading.currentThread() if ret == 0: print threading.currentThread() else: os.wait() print thre