Re: Handling test data that depends on temporal data (that might change while the test runs)

2008-05-15 Thread Erik Jones
(self, now=None): if not now: import datetime now = datetime.datetime.now() . That way you can feed it values when testing to validate the calculations but leave it up to the datetime module to fill in the used value in production. -- Erik Jones [EMAIL PROTECTED

Re: basic if stuff- testing ranges

2007-11-26 Thread Erik Jones
grep through the folder to get a clue, which shows how poor the index is (to me)! Then use one of the quick references here: http://rgruet.free.fr/. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere

Re: basic if stuff- testing ranges

2007-11-26 Thread Erik Jones
) is not asking if x is between 1 and 20 but, rather, if x is a member of the values genereated by the range function with params 1 and 20. So, yes, using range() Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere

Re: fork/exec with input redirection

2007-11-26 Thread Erik Jones
to accomplish what I'm going for? Read up on the docs for the subprocess module. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com

Re: a simple tcp server sample

2007-11-07 Thread Erik Jones
that and be glad to get a hint. Thanks in advance That's when it stops being simple. You'll need to spawn threads or fork off separate processes to do that. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere

Re: pygresql

2007-11-04 Thread Erik Jones
think this is the problem or am I going astray somewhere else? Thank you very much in advance for any assistance, James. You shouldn't be using psycopg, it's not supported anymore. Use psycopg2 which is in active development and has no dependecies on any of the mx libraries. Erik Jones

Re: Copy database with python..

2007-11-03 Thread Erik Jones
, you should join one of the postgres mailing lists. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com -- http://mail.python.org

Re: Can local function access local variables in main program?

2007-11-03 Thread Erik Jones
... print x ... noglobal(x) # ??? ... x = 0# now this is local x foo() 12345 print x 12345 Why would you need to do that? It would be confusing. Just use a different variable name for the local. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401

Re: Parallel insert to postgresql with thread

2007-10-25 Thread Erik Jones
or standard (as with a lot of MySQL). Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com -- http://mail.python.org/mailman/listinfo/python

Re: Parallel insert to postgresql with thread

2007-10-25 Thread Erik Jones
On Oct 25, 2007, at 10:12 AM, Jean-Paul Calderone wrote: On Thu, 25 Oct 2007 09:46:54 -0500, Erik Jones [EMAIL PROTECTED] wrote: [snip] Fortunately, in his case, that's not necessarily true. If they do all their work with the same connection then, yes, but there are other problems

OT Re: Parallel insert to postgresql with thread

2007-10-25 Thread Erik Jones
If you're not Scott Daniels, beware that this conversation has gone horribly off topic and, unless you have an interest in PostreSQL, you may not want to bother reading on... On Oct 25, 2007, at 9:46 PM, Scott David Daniels wrote: Erik Jones wrote: On Oct 25, 2007, at 7:28 AM, Scott David

Re: greatest and least of these...

2007-10-23 Thread Erik Jones
there since if they didn't enter any input, the length of the list should just be zero. The exception is because you're not ensure that nums is ever initialized. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations

Re: web.py postgresql error

2007-10-22 Thread Erik Jones
/db.py, line 265, in connect import pgdb as db ImportError: No module named pgdb any thoughts would be greatly appreciated. thanks, doug Apparently you don't have pgdb installed or it's path isn't in your PYTHONPATH environment variable. Erik Jones Software Developer | Emma® [EMAIL

Re: Can't Write to PostGIS PostGreSQL database via psycopg2

2007-10-22 Thread Erik Jones
condition of your update query did not, in fact, match any existing rows in your table. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com

Re: Order of tuples in dict.items()

2007-10-15 Thread Erik Jones
be the same, but the result is different. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com -- http://mail.python.org/mailman/listinfo

Re: Order of tuples in dict.items()

2007-10-15 Thread Erik Jones
On Oct 15, 2007, at 6:07 PM, Steven D'Aprano wrote: On Mon, 15 Oct 2007 14:11:27 -0700, John Machin wrote: On Oct 16, 12:47 am, Erik Jones [EMAIL PROTECTED] wrote: Not between two consecutive reads, no. However, after any resizing of a dict the result of Python's hash function for any

Re: Python on imac

2007-10-14 Thread Erik Jones
window manager is not X11-based. Fink can also install GTK+, etc. for you. Other than that, most things should work as on Linux, more or less. He doesn't need Fink for up to date Python version as os x binaries are available from the www.python.org. Erik Jones Software Developer | Emma® [EMAIL

Re: PEP idea: Instrumented Python

2007-10-12 Thread Erik Jones
On Oct 12, 2007, at 12:10 PM, Jean-Paul Calderone wrote: On Fri, 12 Oct 2007 11:33:11 -0500, Erik Jones [EMAIL PROTECTED] wrote: [snip] This got me thinking about building a module that could be included by projects that creates a socket and responds to messages on that socket

Re: PEP idea: Instrumented Python

2007-10-12 Thread Erik Jones
module in Paste to see what he does. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com -- http://mail.python.org/mailman/listinfo

stderr is a lame hack?

2007-10-12 Thread Erik Jones
) of the failure(s) are printed to stdout (why not stderr? because stderr is a lame hack 0.2 wink), and the final line of output is Test failed.. What does he mean by stderr being a lame hack? Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma

Re: Keeping track of subclasses and instances?

2007-10-11 Thread Erik Jones
that the database has way more tables than you'd actually want to manually maintain model classes/files for. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http

Re: storing meta data on dictionary keys

2007-10-11 Thread Erik Jones
On Oct 11, 2007, at 1:36 AM, Andreas Kraemer wrote: On Oct 10, 9:00 pm, Erik Jones [EMAIL PROTECTED] wrote: If you're sure that 1. this use case won't grow and 2. that you'll only be the only person ever using code, then it's your choice of preference. Both of those points are equally

Re: storing meta data on dictionary keys

2007-10-11 Thread Erik Jones
On Oct 11, 2007, at 2:25 PM, Andreas Kraemer wrote: On Oct 11, 10:17 am, Erik Jones [EMAIL PROTECTED] wrote: No, duck typing and inheritance are two different things. Duck typing is when you implement the same operations as another object or class, whereas with inheritance you get the same

Re: I'm starting to think like a Pythonista

2007-10-10 Thread Erik Jones
] # make a list containing 11 - 99 odds only big_odds = [x for x in list(xrange(100)) if x % 2 != 0 and x 9] big_odds = range(11, 100, 2) Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market

Re: I'm starting to think like a Pythonista

2007-10-10 Thread Erik Jones
' Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com -- http://mail.python.org/mailman/listinfo/python-list

Re: storing meta data on dictionary keys

2007-10-10 Thread Erik Jones
On Oct 10, 2007, at 6:40 PM, Andreas Kraemer wrote: On Oct 9, 9:18 pm, Erik Jones [EMAIL PROTECTED] wrote: So, do you not keep references to your nodes anywhere but the actual graph dict? I kind of agree with Chris here in that two dicts will work. One for the nodes, indexed

Re: The fundamental concept of continuations

2007-10-09 Thread Erik Jones
a . in a sentence as a form of address would be as unintelligible as it has been in these two sentences. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online

Re: storing meta data on dictionary keys

2007-10-09 Thread Erik Jones
object at 0x76c50: 'whatever for node blah', __main__.Node object at 0x76d30: 'whatever for node foo'} graph[nodes['foo']]'whatever for node foo' Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere

Re: mutable objects as dictionary keys

2007-10-09 Thread Erik Jones
in the context of graph algorithms etc., and it has always been a delightful coding experience! I can definitely see how this would be useful for the real world example you mentioned for pruning trees and what-not. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401

Re: migrating to packages

2007-10-03 Thread Erik Jones
' situation? Because i *really* want to keep the FROM PACKAGE import B syntax. http://www.python.org/doc/current/tut/ node8.html#SECTION00840 Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere

Re: global variables

2007-10-02 Thread Erik Jones
and a method is called on it before it is bound which results in the exception. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com -- http

Re: Python 3.0 migration plans?

2007-09-28 Thread Erik Jones
? These things matter... :) Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.0 migration plans?

2007-09-28 Thread Erik Jones
. So, please, quit. I'd prefer you didn't leave and, instead, decided to actually, actively get along with the others here. I think some of the question you've begun threads with have been both good and valid. It's just that you need some work on your e-people skills, man. Erik Jones

Re: True of False

2007-09-27 Thread Erik Jones
'exceptions.TypeError': argument of type 'bool' is not iterable What's going on there? That is weird. Given 270, what's happening in 268. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market

Re: True of False

2007-09-27 Thread Erik Jones
On Sep 27, 2007, at 12:29 PM, Erik Jones wrote: On Sep 27, 2007, at 11:47 AM, Marc 'BlackJack' Rintsch wrote: On Thu, 27 Sep 2007 09:33:34 -0700, koutoo wrote: I tried writing a true and false If statement and didn't get anything? I read some previous posts, but I must be missing

Re: A question on python performance.

2007-09-26 Thread Erik Jones
Utilities package: http:// pypi.python.org/pypi/Gnosis_Utils/1.2.1-a Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com -- http

Re: Delete values from a string using the index

2007-09-26 Thread Erik Jones
] del l[1] l [1, 3] Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused about 'positive lookbehind assertion'

2007-09-25 Thread Erik Jones
') m2 == None True So, it matches 'def' but only if it is immediately preceded by 'abc'. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http

Re: newb: Simple regex problem headache

2007-09-21 Thread Erik Jones
number strings with or without a decimal point, try '\d*\.?\d*' Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com -- http

Re: Google and Python

2007-09-19 Thread Erik Jones
. What they are saying here is that they have built a highly optimizing custom web server in C++ that services web requests for services of applications written in any of the three listed languages. So, yes, in this case it is what is often Apache in other installations. Erik Jones Software

Re: Google and Python

2007-09-19 Thread Erik Jones
On Sep 19, 2007, at 4:01 PM, TheFlyingDutchman wrote: On Sep 19, 1:02 pm, Erik Jones [EMAIL PROTECTED] wrote: is usually Apache at most sites? No an http server and application server are two different things. An http server services requests of a web server those requests can be for static

Re: Python 3K or Python 2.9?

2007-09-15 Thread Erik Jones
if you step out of this particular box, you'll realize that it really is a pointless one. Saying, because that's how Python does it may be the only valid reason, but that argument is about on par with a six year old's just because Erik Jones Software Developer | Emma® [EMAIL PROTECTED

Re: how to join array of integers?

2007-09-15 Thread Erik Jones
On Sep 15, 2007, at 8:56 AM, Arnau Sanchez wrote: js escribió: On 9/15/07, Summercool [EMAIL PROTECTED] wrote: in Python... is the method to use ,.join() ? but then it must take a list of strings... not integers... any fast method? print ''.join([str(i) for i in [1,2,3]]) It's

Re: how to join array of integers?

2007-09-15 Thread Erik Jones
' IIRC, map's status as a builtin is going away. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com -- http://mail.python.org/mailman

Re: Python Classes

2007-08-28 Thread Erik Jones
where *some* defaulting behavior makes sense, but that's what frameworks and DSLs are for. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http

Re: Haskell like (c:cs) syntax

2007-08-28 Thread Erik Jones
): head, tail = l[0], l[1:] or, front, last = l[:len(l) - 1], l[len(l) - 1] Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com

Re: comparing two lists

2007-08-23 Thread Erik Jones
you could do something like (using the reverse iteration solution mentioned in another reply): for i in range(len(memlist) -1, -1, -1): if memlist[[i].toHash() not in dblist: del memlist[i] Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401

Re: Database intensive application

2007-08-13 Thread Erik Jones
On Aug 12, 2007, at 7:44 AM, Viewer T. wrote: and Yes, Python has awesome database support and can satisfy almost all database needs. Wow. Nobody ever told me Python was *that* kind of language :) Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888

Re: yield keyword usage

2007-07-30 Thread Erik Jones
the condition a max is not longer true in the fibonacci function at which point the function will return without yielding a value and the main loop (for n in ...) will terminate. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma

Re: Python in Nashville

2007-07-21 Thread Erik Jones
Me! Did you just move here? On Jul 20, 2007, at 10:22 PM, Patrick Altman wrote: Anyone on this group writing Python code in Nashville, TN? -- http://mail.python.org/mailman/listinfo/python-list Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888

Re: How to determine which method was used in an inheritance heirarchy?

2007-07-16 Thread Erik Jones
On Jul 16, 2007, at 1:31 AM, Erik Jones wrote: On Jul 16, 2007, at 12:53 AM, Michele Simionato wrote: On Jul 16, 7:18 am, Erik Jones [EMAIL PROTECTED] wrote: On Jul 15, 2007, at 11:23 PM, Michele Simionato wrote: On Jul 16, 5:51 am, Erik Jones [EMAIL PROTECTED] wrote: Say you're given

Re: How to determine which method was used in an inheritance heirarchy?

2007-07-16 Thread Erik Jones
On Jul 16, 2007, at 12:53 AM, Michele Simionato wrote: On Jul 16, 7:18 am, Erik Jones [EMAIL PROTECTED] wrote: On Jul 15, 2007, at 11:23 PM, Michele Simionato wrote: On Jul 16, 5:51 am, Erik Jones [EMAIL PROTECTED] wrote: Say you're given a call event frame for a method call. How can you

Re: How to determine which method was used in an inheritance heirarchy?

2007-07-16 Thread Erik Jones
On Jul 16, 2007, at 3:37 AM, Gabriel Genellina wrote: En Mon, 16 Jul 2007 03:56:18 -0300, Erik Jones [EMAIL PROTECTED] escribió: Perhaps an even better example of what I'm trying to do would be in order (this is minus any exception handling): import sys def mytrace(frame, event, arg

Re: How to determine which method was used in an inheritance heirarchy?

2007-07-16 Thread Erik Jones
On Jul 16, 2007, at 10:35 AM, Chris Mellon wrote: On 7/16/07, Erik Jones [EMAIL PROTECTED] wrote: On Jul 16, 2007, at 3:37 AM, Gabriel Genellina wrote: En Mon, 16 Jul 2007 03:56:18 -0300, Erik Jones [EMAIL PROTECTED] escribió: Perhaps an even better example of what I'm trying to do would

Re: How to organize control access to source code ?

2007-07-16 Thread Erik Jones
on filesystem level permissions. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate market in style. Visit us online at http://www.myemma.com -- http://mail.python.org/mailman/listinfo/python-list

How to determine which method was used in an inheritance heirarchy?

2007-07-15 Thread Erik Jones
Say you're given a call event frame for a method call. How can you tell if the code being executed came from a super class of the object or class the method was called on? Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps

Re: How to determine which method was used in an inheritance heirarchy?

2007-07-15 Thread Erik Jones
On Jul 15, 2007, at 11:23 PM, Michele Simionato wrote: On Jul 16, 5:51 am, Erik Jones [EMAIL PROTECTED] wrote: Say you're given a call event frame for a method call. How can you tell if the code being executed came from a super class of the object or class the method was called on? Erik