Re: parse date string having "EDT"

2011-06-20 Thread Ben Finney
Tim Roberts writes: > Right, because strptime doesn't support %Z. Au contraire: Support for the %Z directive is based on the values contained in tzname and whether daylight is true. Because of this, it is platform-specific except for recognizing UTC and GMT which are always know

Re: Missing python27.dll on Win 7 64-bit

2011-06-20 Thread Michel Claveau - MVP
Hi! In my Win è 64 bits, python27.dll (and others DLLs like pythoncom27.dll, pythoncomloader27.dll or pywintypes27.dll) are in C:\Windows\SysWOW64 And (my) Python 2.7.2 run perfectly. @-salutations -- Michel Claveau -- http://mail.python.org/mailman/listinfo/python-list

Re: parse date string having "EDT"

2011-06-20 Thread Tim Roberts
Junaid P V wrote: > >I was trying to parse a date string containing "EDT" time zone > >eg: 'Mon Jun 20 14:00:57 EDT 2011' > >I tried: > >datetime.strptime('Mon Jun 20 14:00:57 EDT 2011', '%a %b %d %H:%M:%S %Z %Y') > >But I get error Right, because strptime doesn't support %Z. You'll have to hand

Re: something about performence

2011-06-20 Thread Ken Seehart
On 6/20/2011 10:31 PM, Ken Seehart wrote: > On 6/20/2011 7:59 PM, king6c...@gmail.com wrote: >> Hi, >> I have two large files,each has more than 2 lines,and each >> line consists of two fields,one is the id and the other a value, >> the ids are sorted. >> >> for example: >> >> file1 >> (uin

Re: PEP 8 and indentation of continuation lines

2011-06-20 Thread Ben Finney
Ben Finney writes: > John Yeung writes: > > > So last week PEP 8 was updated to reflect this. All fine and good. I > > happen to prefer this style myself. But there remains an example > > further down (left over from earlier incarnations of PEP 8) which > > might go against this: > > > > if (wid

Re: [JOB] Python Programmer, Newport Beach, CA | 6-24 months - Relo OK

2011-06-20 Thread Chris Withers
On 09/06/2011 22:31, PHP Recruiter wrote: This is a contract/hourly 6-24 month on-site Python Programming job located in Newport Beach, CA paying $50.00 to $80.00 per hour depending on experience. Local candidates preferred, but all considered. Relocation expenses covered. I'd suggest submitt

Re: something about performence

2011-06-20 Thread Ken Seehart
On 6/20/2011 7:59 PM, king6c...@gmail.com wrote: > Hi, > I have two large files,each has more than 2 lines,and each > line consists of two fields,one is the id and the other a value, > the ids are sorted. > > for example: > > file1 > (uin_a y) > 1 1245 > 2 12333 > 3 324543 > 5 3464565 >

Re: PEP 8 and indentation of continuation lines

2011-06-20 Thread Ben Finney
John Yeung writes: > So last week PEP 8 was updated to reflect this. All fine and good. I > happen to prefer this style myself. But there remains an example > further down (left over from earlier incarnations of PEP 8) which > might go against this: > > if (width == 0 and height == 0 and > co

Re: Instances' __setitem__ methods

2011-06-20 Thread Chris Rebert
On Mon, Jun 20, 2011 at 6:42 PM, Spencer Pearson wrote: > I was recently trying to implement a dict-like object which would do > some fancy stuff when it was modified, and found that overriding the > __setitem__ method of an instance did not act the way I expected. The > help documentation (from h

Re: those darn exceptions

2011-06-20 Thread Chris Torek
In article Chris Angelico wrote: >Interesting concept of pulling out all possible exceptions. Would be >theoretically possible to build a table that keeps track of them, but >automated tools may have problems: > >a=5; b=7; c=12 >d=1/(a+b-c) # This could throw ZeroDivisionError > >if a+b>c: > d=

Re: parse date string having "EDT"

2011-06-20 Thread Ben Finney
Junaid P V writes: > I tried: > > datetime.strptime('Mon Jun 20 14:00:57 EDT 2011', '%a %b %d %H:%M:%S %Z %Y') > > But I get error When reporting that you get an error, please give the full error and traceback. My mind reading skills are telling me, though, that you're getting a ValueError bec

PEP 8 and indentation of continuation lines

2011-06-20 Thread John Yeung
Lurking on python-dev, I noticed a thread early this month (starting June 2) about possible additions to PEP 8 covering indentation of continuation lines. The recommendation was to double-indent continuation lines which are about to introduce a new suite, unless you are going to base your indentat

Re: Python scoping

2011-06-20 Thread Ben Finney
Chris Angelico writes: > On Tue, Jun 21, 2011 at 12:38 PM, Ben Finney > wrote: > > The *binding* is scoped. > > And the binding follows the exact same rules as anything else would. > It has scope and visibility. In terms of the OP, the binding IS like a > variable. Yes. So let's stop behaving

Re: those darn exceptions

2011-06-20 Thread Ben Finney
Chris Torek writes: > It can be pretty obvious. For instance, the os.* modules raise OSError > on errors. Not *only* OSError, of course. > The examples here are slightly silly until I reach the "real" code at > the bottom, but perhaps one will get the point: > > >>> import os > >>> os.k

Re: Is there any advantage or disadvantage to using sets over list comps to ensure a list of unique entries?

2011-06-20 Thread rusi
On Jun 21, 12:43 am, deathweaselx86 wrote: > Howdy guys, I am new. > > I've been converting lists to sets, then back to lists again to get > unique lists. Maybe you should consider whether its best to work with sets only and not use lists at all. This needs to be said because: 1. Most intros to p

Re: Instances' __setitem__ methods

2011-06-20 Thread Ethan Furman
Spencer Pearson wrote: I was recently trying to implement a dict-like object which would do some fancy stuff when it was modified, and found that overriding the __setitem__ method of an instance did not act the way I expected. The __magic__ methods are only looked up on the class, never the in

Re: Is there any advantage or disadvantage to using sets over list comps to ensure a list of unique entries?

2011-06-20 Thread Ethan Furman
Steven D'Aprano wrote: On Mon, 20 Jun 2011 12:43:52 -0700, deathweaselx86 wrote: I've been converting lists to sets, then back to lists again to get unique lists. I used to use list comps to do this instead. foo = ['1','2','3'] bar = ['2','5'] foo.extend([a for a in bar if a not in foo]) foo

Re: Python scoping

2011-06-20 Thread Chris Angelico
On Tue, Jun 21, 2011 at 12:38 PM, Ben Finney wrote: > The *binding* is scoped. > And the binding follows the exact same rules as anything else would. It has scope and visibility. In terms of the OP, the binding IS like a variable. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: those darn exceptions

2011-06-20 Thread Chris Angelico
On Tue, Jun 21, 2011 at 11:43 AM, Chris Torek wrote: > It can be pretty obvious.  For instance, the os.* modules raise > OSError on errors.  The examples here are slightly silly until > I reach the "real" code at the bottom, but perhaps one will get > the point: > >    >>> import os >    >>> os.ki

Re: Generator Frustration

2011-06-20 Thread Joel
On Jun 20, 9:42 pm, Terry Reedy wrote: > > A nomenclature note: a function with yield is a 'generator function'. It > is an instance of the 'function' class, same as for any other def > statement (or lambda expression). It returns an instance of class > 'generator, as you note here > >  > and wil

parse date string having "EDT"

2011-06-20 Thread Junaid P V
I was trying to parse a date string containing "EDT" time zone eg: 'Mon Jun 20 14:00:57 EDT 2011' I tried: datetime.strptime('Mon Jun 20 14:00:57 EDT 2011', '%a %b %d %H:%M:%S %Z %Y') But I get error -- http://mail.python.org/mailman/listinfo/python-list

something about performence

2011-06-20 Thread king6c...@gmail.com
Hi, I have two large files,each has more than 2 lines,and each line consists of two fields,one is the id and the other a value, the ids are sorted. for example: file1 (uin_a y) 1 1245 2 12333 3 324543 5 3464565 file2 (uin_b gift) 1 34545 3 6436466 4 35345646 5 463626

Re: Do we still need to inherit from "object" to create new-style classes?

2011-06-20 Thread Ben Finney
John Salerno writes: > I can't quite seem to find the answer to this anywhere. The book I'm > reading right now was written for Python 3.1 and doesn't use (object), > so I'm thinking that was just a way to force new-style classes in 2.x > and is no longer necessary in 3.x. Is that right? Not as

Re: Python scoping

2011-06-20 Thread Ben Finney
Chris Angelico writes: > On Tue, Jun 21, 2011 at 10:39 AM, Ben Finney > wrote: > > Instead, Python has objects, and references to those objects so you > > can get at them. The Python documentation, much to my frustration, > > calls these references “variables” even though that gives exactly >

Re: new string-formatting preferred? (was "What is this syntax ?")

2011-06-20 Thread Terry Reedy
On 6/20/2011 8:46 PM, Tim Chase wrote: On 06/20/2011 05:19 PM, Ben Finney wrote: “This method of string formatting is the new standard in Python 3.0, and should be preferred to the % formatting described in String Formatting Operations in new code.” http://docs.python.org/library/stdtypes.html#

Re: Do we still need to inherit from "object" to create new-style classes?

2011-06-20 Thread John Salerno
On Jun 20, 8:33 pm, Benjamin Kaplan wrote: > On Mon, Jun 20, 2011 at 6:26 PM, John Salerno wrote: > > I can't quite seem to find the answer to this anywhere. The book I'm > > reading right now was written for Python 3.1 and doesn't use (object), > > so I'm thinking that was just a way to force ne

those darn exceptions

2011-06-20 Thread Chris Torek
Exceptions are great, but... Sometimes when calling a function, you want to catch some or even all the various exceptions it could raise. What exceptions *are* those? It can be pretty obvious. For instance, the os.* modules raise OSError on errors. The examples here are slightly silly until I

Instances' __setitem__ methods

2011-06-20 Thread Spencer Pearson
I was recently trying to implement a dict-like object which would do some fancy stuff when it was modified, and found that overriding the __setitem__ method of an instance did not act the way I expected. The help documentation (from help(dict.__setitem__)) claims that "d.__setitem__(k,v)" is equiva

Re: Generator Frustration

2011-06-20 Thread Terry Reedy
On 6/20/2011 6:04 PM, Joel wrote: On Jun 4, 2:27 pm, "TommyVee" wrote: I'm using the SimPy package to run simulations. Anyone who's used this package knows that the way it simulates process concurrency is through the clever use of yield statements. Some of the code in my programs is very comple

Re: Boolean result of divmod

2011-06-20 Thread Terry Reedy
On 6/20/2011 8:28 PM, Gnarlodious wrote: What is the easiest way to get the first number as boolean? divmod(99.6, 30.1) Or do I have to say: flote, rem=divmod(99.6, 30.1) bool(flote) divmod(x,y) == x//y, x%y so bool(x//y) -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/pytho

Re: Do we still need to inherit from "object" to create new-style classes?

2011-06-20 Thread Benjamin Kaplan
On Mon, Jun 20, 2011 at 6:26 PM, John Salerno wrote: > I can't quite seem to find the answer to this anywhere. The book I'm > reading right now was written for Python 3.1 and doesn't use (object), > so I'm thinking that was just a way to force new-style classes in 2.x > and is no longer necessary

Do we still need to inherit from "object" to create new-style classes?

2011-06-20 Thread John Salerno
I can't quite seem to find the answer to this anywhere. The book I'm reading right now was written for Python 3.1 and doesn't use (object), so I'm thinking that was just a way to force new-style classes in 2.x and is no longer necessary in 3.x. Is that right? (The documentation doesn't mention obj

Re: Is there any advantage or disadvantage to using sets over list comps to ensure a list of unique entries?

2011-06-20 Thread Steven D'Aprano
On Mon, 20 Jun 2011 12:43:52 -0700, deathweaselx86 wrote: > Howdy guys, I am new. > > I've been converting lists to sets, then back to lists again to get > unique lists. > e.g > > Python 2.5.2 (r252:60911, Jan 20 2010, 21:48:48) [GCC 4.2.4 (Ubuntu > 4.2.4-1ubuntu3)] on linux2 Type "help", "copyr

Re: Python scoping

2011-06-20 Thread Steven D'Aprano
On Mon, 20 Jun 2011 15:35:35 -0700, gervaz wrote: > Hi all, can you explain me why this simple function works well (i.e. I > can call the print function using txt) in py > def test(value): > ... if value%5: txt = "hello" > ... else: txt = "test" > ... print(txt) > > while in oth

Re: Python scoping

2011-06-20 Thread Chris Angelico
On Tue, Jun 21, 2011 at 10:39 AM, Ben Finney wrote: > gervaz writes: > Python doesn't have variables the way C or many other languages have > them. > > Instead, Python has objects, and references to those objects so you can > get at them. The Python documentation, much to my frustration, calls >

Re: new string-formatting preferred? (was "What is this syntax ?")

2011-06-20 Thread Tim Chase
On 06/20/2011 05:19 PM, Ben Finney wrote: “This method of string formatting is the new standard in Python 3.0, and should be preferred to the % formatting described in String Formatting Operations in new code.” http://docs.python.org/library/stdtypes.html#str.format> Is there a good link to a

Re: Boolean result of divmod

2011-06-20 Thread MRAB
On 21/06/2011 01:28, Gnarlodious wrote: What is the easiest way to get the first number as boolean? divmod(99.6, 30.1) Or do I have to say: flote, rem=divmod(99.6, 30.1) bool(flote) divmod returns a tuple, so: bool(divmod(99.6, 30.1)[0]) -- http://mail.python.org/mailman/listinfo/python

Re: Python scoping

2011-06-20 Thread Ben Finney
gervaz writes: > Hi all, can you explain me why this simple function works well (i.e. I > can call the print function using txt) in py > > >>> def test(value): > ... if value%5: txt = "hello" > ... else: txt = "test" > ... print(txt) > > while in other languages like C the txt identif

Re: Boolean result of divmod

2011-06-20 Thread Chris Torek
In article <261fc85a-ca6b-4520-93ed-27e78bc21...@y30g2000yqb.googlegroups.com> Gnarlodious wrote: >What is the easiest way to get the first number as boolean? > >divmod(99.6, 30.1) divmod returns a 2-tuple: >>> divmod(99.6,30.1) (3.0, 9.2901) Therefore, you can subscript th

Re: running multiple scripts -- which way is more elegant?

2011-06-20 Thread Stephen Bunn
On Mon, Jun 20, 2011 at 11:19 PM, Florencio Cano wrote: > > import config_script obviously doesn't work and __import__(config_script) > > works from the python interpreter but fails in the script (ImportError: > > Import by filename is not supported.) > > You can use this: > > exec("import " + mod

Re: Rant on web browsers

2011-06-20 Thread Dan Stromberg
On Tue, Jun 14, 2011 at 1:46 AM, Chris Angelico wrote: > On Tue, Jun 14, 2011 at 6:39 PM, Martin P. Hellwig > wrote: > > On 14/06/2011 07:31, Chris Angelico wrote: > > > >> > >> But if anyone feels like writing an incompatible browser, please can > >> you add Python scripting? > > > > You might

Boolean result of divmod

2011-06-20 Thread Gnarlodious
What is the easiest way to get the first number as boolean? divmod(99.6, 30.1) Or do I have to say: flote, rem=divmod(99.6, 30.1) bool(flote) -- Gnarlie -- http://mail.python.org/mailman/listinfo/python-list

Re: Improper creating of logger instances or a Memory Leak?

2011-06-20 Thread Vinay Sajip
On Jun 20, 3:50 pm, foobar wrote: > Regarding adding a new logger for each thread - each thread represents > a telephone call in a data collection system. I need to be able to > cleanly provided call-loggingfor debugging to my programmers as well > as dataloggingand verification; having a single

Re: Is the mailing list to usenet gateway borked?

2011-06-20 Thread Steven D'Aprano
On Mon, 20 Jun 2011 16:49:33 +, Peter Pearson wrote: > On 20 Jun 2011 01:41:44 GMT, Steven D'Aprano wrote: >> The last couple of messages on this list show >> up fine on the mailman archives, but are empty posts on >> comp.lang.python. Is there a problem with the mail -> usenet gateway? > >

basic bytecode to machine code compiler (part 3)

2011-06-20 Thread Rouslan Korneychuk
My compiler now supports the x86-64 instruction set, in addition to x86. It also generates faster x86 machine code. Although it's designed to support 64-bit Windows, I have only tested it on Linux so far, and it doesn't support running with Windows' DEP yet. It's available at https://github.c

Re: Python scoping

2011-06-20 Thread Chris Angelico
On Tue, Jun 21, 2011 at 8:35 AM, gervaz wrote: > Hi all, can you explain me why this simple function works well (i.e. I > can call the print function using txt) in py > def test(value): > ...     if value%5: txt = "hello" > ...     else: txt = "test" > ...     print(txt) It's as though you h

Python scoping

2011-06-20 Thread gervaz
Hi all, can you explain me why this simple function works well (i.e. I can call the print function using txt) in py >>> def test(value): ... if value%5: txt = "hello" ... else: txt = "test" ... print(txt) while in other languages like C the txt identifier would be undefined? Is there

Re: Parsing a dictionary from a format string

2011-06-20 Thread Tim Johnson
* Tim Johnson [110620 13:00]: > > I think later today, I will run some time tests using the `re' > module as well as your function and the one above. OK: Functions follow: def grabBetween(src,begin,end): """Grabs sections of text between `begin' and `end' and returns a list of 0 or more sect

osaic - create photo mosaics w/ Python

2011-06-20 Thread Matteo Landi
Hi list, yesterday I released a new version of "osaic", a Python library which enables users to create photo mosaics in a very simple way. Once installed, a bare ``python -mosaic IMG1 IMG2 IMG3 ..`` is enough to create and show on screen a mosaic where IMG2, IMG3 and others are combined togeth

Re: What is this syntax ?

2011-06-20 Thread Ben Finney
Claudiu Popa writes: > Hello, (Please don't top-post. Instead, interleave your responses below each quoted part you're responding to, as in this message. See also .) > Isn't this similar to php interpolation? And qu

Re: Generator Frustration

2011-06-20 Thread Joel
On Jun 4, 2:27 pm, "TommyVee" wrote: > I'm using the SimPy package to run simulations. Anyone who's used this > package knows that the way it simulates process concurrency is through the > clever use of yield statements. Some of the code in my programs is very > complex and contains several repeat

Re: Parsing a dictionary from a format string

2011-06-20 Thread Tim Johnson
* Hans Mulder [110620 12:15]: > On 20/06/11 20:14:46, Tim Johnson wrote: > >Currently using python 2.6, but am serving some systems that have > >older versions of python (no earlier than. > >Question 1: > > With what version of python was str.format() first implemented? Duh! > It might be a ma

ANN: PyGUI 2.5.1

2011-06-20 Thread Gregory Ewing
PyGUI 2.5.1 is available: http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/ Minor update to fix missing distutils_extensions.py file. What is PyGUI? -- PyGUI is a cross-platform GUI toolkit designed to be lightweight and have a highly Pythonic API. -- Gregory Ewing greg.e

Re: Parsing a dictionary from a format string

2011-06-20 Thread Hans Mulder
On 20/06/11 20:14:46, Tim Johnson wrote: Currently using python 2.6, but am serving some systems that have older versions of python (no earlier than. Question 1: With what version of python was str.format() first implemented? That was 2.6, according to the online docs. Take a look at the do

Re: Is there any advantage or disadvantage to using sets over list comps to ensure a list of unique entries?

2011-06-20 Thread Ian Kelly
On Mon, Jun 20, 2011 at 1:43 PM, deathweaselx86 wrote: > Howdy guys, I am new. > > I've been converting lists to sets, then back to lists again to get > unique lists. > e.g > > Python 2.5.2 (r252:60911, Jan 20 2010, 21:48:48) > [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 > Type "help", "copyrigh

Is there any advantage or disadvantage to using sets over list comps to ensure a list of unique entries?

2011-06-20 Thread deathweaselx86
Howdy guys, I am new. I've been converting lists to sets, then back to lists again to get unique lists. e.g Python 2.5.2 (r252:60911, Jan 20 2010, 21:48:48) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> foo = ['1','2','3']

Re: Parsing a dictionary from a format string

2011-06-20 Thread Tim Johnson
* Tim Johnson [110620 10:28]: > Currently using python 2.6, but am serving some systems that have > older versions of python (no earlier than. > Question 1: > With what version of python was str.format() first implemented? > Question 2: > Given the following string: > S = 'Coordinates: {l

Re: Parsing a dictionary from a format string

2011-06-20 Thread Ian Kelly
On Mon, Jun 20, 2011 at 12:14 PM, Tim Johnson wrote: > Currently using python 2.6, but am serving some systems that have > older versions of python (no earlier than. > Question 1: >  With what version of python was str.format() first implemented? 2.6 > Question 2: >  Given the following string:

Re: What's the best way to write this base class?

2011-06-20 Thread Ian Kelly
On Mon, Jun 20, 2011 at 5:57 AM, Mel wrote: > Battle for Wesnoth is set up this way.  I don't know what the code does, but > you can go wild creating new classes of character by mixing up new > combinations of attribute settings in new configuration files, and injecting > them into the standard ga

Parsing a dictionary from a format string

2011-06-20 Thread Tim Johnson
Currently using python 2.6, but am serving some systems that have older versions of python (no earlier than. Question 1: With what version of python was str.format() first implemented? Question 2: Given the following string: S = 'Coordinates: {latitude}, {longitude}' Is there a python li

Re: What's the best way to write this base class?

2011-06-20 Thread Terry Reedy
On 6/20/2011 3:12 AM, Benjamin Kaplan wrote: On Sun, Jun 19, 2011 at 9:04 PM, John Salerno wrote: On Jun 19, 8:52 pm, Chris Kaynor wrote: Having a character class (along with possibly player character, non-player character, etc), make sense; however you probably want to make stuff like hea

Re: running multiple scripts -- which way is more elegant?

2011-06-20 Thread Terry Reedy
On 6/20/2011 2:51 AM, Stephen Bunn wrote: Thanks for the replies. I would like to use the second method because I plan to implement everything in python. The main problem of your second method is that you repeat the check function in each script. That will be a problem if you ever want to mo

Re: How to iterate on a changing dictionary

2011-06-20 Thread Terry Reedy
On 6/20/2011 10:30 AM, Florencio Cano wrote: To make an example: imaging Bingo.Shuffle the numbers, each number sorted should be removed from the container, how would it implemented? The structure seems a set -> unordered collection of unique elements. You can select a random element from the

Re: Is the mailing list to usenet gateway borked?

2011-06-20 Thread Tim Chase
On 06/19/2011 08:41 PM, Steven D'Aprano wrote: The last couple of messages on this list show up fine on the mailman archives, but are empty posts on comp.lang.python. Is there a problem with the mail -> usenet gateway? I haven't noticed any issues. I tend to send via email (python-list@pyth

Re: Is the mailing list to usenet gateway borked?

2011-06-20 Thread Peter Pearson
On 20 Jun 2011 01:41:44 GMT, Steven D'Aprano wrote: > The last couple of messages on this list show up > fine on the mailman archives, but are empty posts on comp.lang.python. Is > there a problem with the mail -> usenet gateway? I don't see any empty posts on comp.lang.python. Can we talk abo

Re: Compiling Python 3.2 on Cygwin fails

2011-06-20 Thread sewpafly
I was able to a little further by changing 2 lines in Makefile.pre.in. On line 170, changed: DLLLIBRARY= @DLLLIBRARY@ to: DLLLIBRARY= libpython$(VERSION).dll On line 509 it had: $(DLLLIBRARY) libpython$(VERSION).dll.a: $(LIBRARY_OBJS) which I changed to: $(DLLLIBRARY) libpython$(

Re: Improper creating of logger instances or a Memory Leak?

2011-06-20 Thread foobar
Yes, I asked it on stack overflow first and didn't see an quick reply. I'm trying to tighten up this code as much as possible in a final pre-production push; I apologize for being overly antsy about this. This is my pet project to upgrade our core systems from an ancient IBM language that Moses m

Re: How to iterate on a changing dictionary

2011-06-20 Thread Florencio Cano
> To make an example: imaging Bingo.Shuffle the numbers, each number sorted > should be removed from the container, how would it implemented? The structure seems a set -> unordered collection of unique elements. You can select a random element from the set with random.sample(container, num_of_ele

Re: running multiple scripts -- which way is more elegant?

2011-06-20 Thread Florencio Cano
> Unfortunately I have not been able to > work out how to get the imports to work. > > import config_script obviously doesn't work and __import__(config_script) > works from the python interpreter but fails in the script (ImportError: > Import by filename is not supported.) You can use this: exec

Re: How to iterate on a changing dictionary

2011-06-20 Thread TheSaint
Lie Ryan wrote: Thank you all for the information, really apreciated. > While there are legitimate reasons for iterating a dictionary, I'd > consider the alternatives first. Perhaps the correct answer is in what you said. For certain reasons, searching in a dictionary is the fastest method, se

Re: What's the best way to write this base class?

2011-06-20 Thread Mel
John Salerno wrote: > On Jun 19, 8:52 pm, Chris Kaynor wrote: > >> Having a character class (along with possibly player character, >> non-player character, etc), make sense; however you probably want to make >> stuff like health, resources, damage, and any other attributes not be >> handles by a

SQLObject 1.1.0

2011-06-20 Thread Oleg Broytman
Hello! I'm pleased to announce version 1.1.0, the first stable release of branch 1.1 of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be eas

Can't make a message/feedback-report content type on a IMEMultipart Message

2011-06-20 Thread Roberto Navarro - TusProfesionales.es
I'mt trying to automate arf (abuse reporting format) generation. RFC5965 (http://www.rfc-editor.org/rfc/rfc5965.txt) sets that the email message should contain three parts: - Human-readable (text/plain) - Machine-Readable (message/feedback-report) - Evidence (attached as a file). I'm trying t

Re: opening a file

2011-06-20 Thread Hans Mulder
On 20/06/11 08:14:14, Florencio Cano wrote: This works: infile=open('/foo/bar/prog/py_modules/this_is_a_test','r') This doesn't: infile=open('~/prog/py_modules/this_is_a_test','r') Can't I work with files using Unix expressions? You can use the glob module: http://docs.python.org/library/glob

Re: opening a file

2011-06-20 Thread Nobody
On Sun, 19 Jun 2011 23:00:38 -0700, Tim Hanson wrote: > This works: > infile=open('/foo/bar/prog/py_modules/this_is_a_test','r') > > This doesn't: > infile=open('~/prog/py_modules/this_is_a_test','r') > > Can't I work with files using Unix expressions? The argument is treated literally, just li

Is the mailing list to usenet gateway borked?

2011-06-20 Thread Steven D'Aprano
The last couple of messages on this list show up fine on the mailman archives, but are empty posts on comp.lang.python. Is there a problem with the mail -> usenet gateway? Who controls that? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: What is this syntax ?

2011-06-20 Thread Claudiu Popa
Hello, Isn't this similar to php interpolation? And quite readable imo. >>> import string >>> template = string.Template("$scheme://$host:$port/$route#$fragment") >>> template.substitute(scheme="http", host="google.com", port="80", route="", >>> fragment="") 'http://google.com:80/#' >>> Roy Sm

Re: What's the best way to write this base class?

2011-06-20 Thread Benjamin Kaplan
On Sun, Jun 19, 2011 at 9:04 PM, John Salerno wrote: > On Jun 19, 8:52 pm, Chris Kaynor wrote: > >> Having a character class (along with possibly player character, non-player >> character, etc), make sense; however you probably want to make stuff like >> health, resources, damage, and any other