Re: factory functions & methods

2009-03-11 Thread Aaron Brady
On Mar 11, 12:52 pm, Piet van Oostrum wrote: > >>>>> Aaron Brady (AB) wrote: > >AB> Hello, > >AB> I am creating a container.  I have some types which are built to be > >AB> members of the container.  The members need to know which container > >A

Re: converting a string to a function parameter

2009-03-13 Thread Aaron Brady
On Mar 13, 2:52 am, koranthala wrote: > Hi, >     Is it possible to convert a string to a function parameter? > Ex: > str = 'True, type=rect, sizes=[3, 4]' > and I should be able to use it as: > test(convert(str)) and the behaviour should be same as calling test > with those values : > i.e. test(T

Re: c++ extension, problem passing argument

2009-03-13 Thread Aaron Brady
On Mar 13, 12:03 pm, Matteo wrote: > Hi all, > > I wrote a few c++ classes for some data analysis on a physics > esperiment. Now I want to glue the lot with Python, so I built the > necessary wrap code with SWIG and compiled the library with Distutils. > All is fine, I can import the module and cl

Re: c++ extension, problem passing argument

2009-03-13 Thread Aaron Brady
On Mar 13, 1:34 pm, Matteo wrote: > hmmm... looks like SWIG has a problem with double pointers. I googled > around a bit and found: > > http://osdir.com/ml/programming.swig/2003-02/msg00029.html > > anyone knows how to write a small wrapper to do the appropriate > dereferencing? 'ctypes' may be a

Re: Memory efficient tuple storage

2009-03-13 Thread Aaron Brady
On Mar 13, 1:13 pm, "psaff...@googlemail.com" wrote: > Thanks for all the replies. > > First of all, can anybody recommend a good way to show memory usage? I > tried heapy, but couldn't make much sense of the output and it didn't > seem to change too much for different usages. Maybe I was just mak

Re: converting a string to a function parameter

2009-03-13 Thread Aaron Brady
On Mar 13, 3:21 pm, Paul McGuire wrote: > On Mar 13, 11:46 am, Aaron Brady wrote: > > > > > On Mar 13, 2:52 am, koranthala wrote: > > > > Hi, > > >     Is it possible to convert a string to a function parameter? > > > Ex: > > > str = 

Re: c++ extension, problem passing argument

2009-03-13 Thread Aaron Brady
On Mar 13, 5:42 pm, Matteo wrote: > On 13 Mar, 22:35, Aaron Brady wrote: > > > > > On Mar 13, 1:34 pm, Matteo wrote: > > > > hmmm... looks like SWIG has a problem with double pointers. I googled > > > around a bit and found: > > > >http://

Re: multiprocessing.sharedctypes and built-in locks

2009-03-14 Thread Aaron Brady
On Mar 14, 7:11 am, Ahmad Syukri bin Abdollah wrote: > I'm trying this on Python 3.0.1 > Consider the following code: > """ > import multiprocessing as mp > > def jambu(b,i,gl): >     for n in range(10): >        with gl[i]: >             b[i]+=2 >        with gl[3-i]: >             b[3-i]-=1

Re: Style question - defining immutable class data members

2009-03-15 Thread Aaron Brady
On Mar 15, 8:56 am, "Rhodri James" wrote: > On Sun, 15 Mar 2009 13:26:17 -, Matthew Woodcraft   > > wrote: > > [snip Gary Herron's explanation of instance attribute lookup > falling back to class attribute lookup] > > > It seems clear to me that Maxim understood all this when he asked his > >

Re: Style question - defining immutable class data members

2009-03-15 Thread Aaron Brady
On Mar 15, 12:39 pm, John Posner wrote: > (My apologies if the thread has already covered this.) I believe I understand > the WHAT in this situation, but I don't understand the WHY ... > > Given this class definition: > >   class Cls(object): >       x = 345 > > ... I observe the following, using

Re: Style question - defining immutable class data members

2009-03-15 Thread Aaron Brady
On Mar 15, 1:50 pm, "Rhodri James" wrote: > On Sun, 15 Mar 2009 17:55:25 -, Aaron Brady   > wrote: > > > On Mar 15, 12:39 pm, John Posner wrote: > >> (My apologies if the thread has already covered this.) I believe I   > >> understand the WHAT in

Re: multiprocessing.sharedctypes and built-in locks

2009-03-16 Thread Aaron Brady
On Mar 15, 11:42 pm, Ahmad Syukri b wrote: > On Mar 15, 6:19 am, Aaron Brady wrote: > > > > > Your code hung on my machine.  The call to 'main()' should be in an > > 'if __name__' block: > > > if __name__== '__main__': > >  

Re: is there an easy way to parse a nested list ?

2009-03-16 Thread Aaron Brady
On Mar 15, 6:44 pm, Stef Mientki wrote: > hello, > > I need to parse a nested list, given as a string, like this > > line = " A  [  B  [ C+2 ] + 3 ] " > > ( I probably can do it with find, but I guess that's not the most > elegant way, besides recusrion is not my strongest point) > > which should

Re: Style question - defining immutable class data members

2009-03-16 Thread Aaron Brady
On Mar 15, 9:54 pm, "Rhodri James" wrote: > On Sun, 15 Mar 2009 23:26:04 -, Aaron Brady   > wrote: > > > > > > > On Mar 15, 1:50 pm, "Rhodri James" > > wrote: > >> On Sun, 15 Mar 2009 17:55:25 -, Aaron Brady   > >&g

Newbie question: How do I add elements to **kwargs in a function?

2009-03-16 Thread Aaron Garrett
g it point to something else) that the changes would be reflected back out to the thing being passed in. So, why doesn't this work the way I expect it to? And, is there some other way to make this work to accomplish the same goal? Thank you in advance, Aaron -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question: How do I add elements to **kwargs in a function?

2009-03-16 Thread Aaron Garrett
On Mar 16, 9:59 pm, Chris Rebert wrote: > On Mon, Mar 16, 2009 at 7:48 PM, Aaron Garrett > > > > wrote: > > I have spent quite a bit of time trying to find the answer on this > > group, but I've been unsuccessful. Here is what I'd like to be able to > &g

Re: Mangle function name with decorator?

2009-03-17 Thread Aaron Brady
On Mar 17, 12:20 pm, Adam wrote: > Thanks, Andrew.  I'm trying to accomplish something with a > metaprogramming flavor, where, for the convenience of the programmer > and the clarity of code, I'd like to have a decorator or some other > mechanism do twiddling behind the scenes to make a class do s

Re: Mangle function name with decorator?

2009-03-17 Thread Aaron Brady
at bottom On Mar 17, 12:54 pm, "andrew cooke" wrote: > ah, ok.  then yes, you can do that with decorators.  you'd need hash > tables or something similar in a metaclass.  then the decorator would take > the given function, stick it in the appropriate hash table, and return a > function that does t

Re: Mangle function name with decorator?

2009-03-18 Thread Aaron Brady
On Mar 18, 8:47 am, Adam wrote: > On Mar 17, 1:49 pm, Aaron Brady wrote: > > > > > You would need a unique attribute to look for on values in the > > dictionary, which means you'd need to detect what functions you are > > renaming; possibly by using a

Re: Ordered Sets

2009-03-20 Thread Aaron Brady
On Mar 20, 1:50 pm, Scott David Daniels wrote: > Raymond Hettinger wrote: > > [Aahz] > >> The doubly-linked list part is what's sick and perverted. > > > The doubly-linked list part is what gives it big-oh running > > times the same as regular sets.  If the underlying sequence > > is stored as a l

Re: get rid of duplicate elements in list without set

2009-03-20 Thread Aaron Brady
On Mar 20, 5:07 pm, Michael Spencer wrote: > Alexzive wrote: snip > And, if you really want, you can get the body of this into 1-line, noting that > seen.add returns None, so the expression (item in seen or seen.add(item)) > evaluates to True if item is in seen, or None (and item is added to seen)

garbage collection / cyclic references

2009-03-20 Thread Aaron Brady
Hello, I was reading and Googling about garbage collection, reference counting, and the problem of cyclic references. Python's garbage collection module claims to be able to detect and break cyclic garbage. Some other languages merely prohibit it. Is this the place to ask about its technique?

Re: garbage collection / cyclic references

2009-03-21 Thread Aaron Brady
On Mar 20, 8:12 pm, "andrew cooke" wrote: > Aaron Brady wrote: > > [...] > > > caveats and fragilities?  If free software can do it, why isn't it all > > over the industry?  What disqualifies it from solved-problem status? > > the two dominant vi

Re: Creating Linked Lists in Python

2009-03-21 Thread Aaron Brady
On Mar 21, 8:11 am, "andrew cooke" wrote: > J-Burns wrote: snip > > For example, this means that there can be a start node supposedly. > > Having a value of 0. It is pointing to node 1 with the value of "a" > > and to node 2 with the value of "b". Trying to make something like an > > NFA. Where id

Re: garbage collection / cyclic references

2009-03-21 Thread Aaron Brady
On Mar 21, 7:54 am, "andrew cooke" wrote: > Paul Rubin wrote: > > "andrew cooke" writes: > >> the two dominant virtual machines - .net and the jvm both handle > >> circular > >> references with no problem whatever. > > > AFAIK, they also don't guarantee that finalizers ever run, much less > > run

Re: garbage collection / cyclic references

2009-03-21 Thread Aaron Brady
On Mar 21, 9:50 am, "andrew cooke" wrote: > Aaron Brady wrote: > > On Mar 21, 7:54 am, "andrew cooke" wrote: > >> they should not be used to do things like flushing and closing > >> files, for example. > > What is your basis for this claim, i

Re: garbage collection / cyclic references

2009-03-21 Thread Aaron Brady
On Mar 21, 10:28 am, Aaron Brady wrote: > On Mar 21, 9:50 am, "andrew cooke" wrote: > > > > > Aaron Brady wrote: > > > On Mar 21, 7:54 am, "andrew cooke" wrote: > > >> they should not be used to do things like flushing and closing &

Re: Creating Linked Lists in Python

2009-03-21 Thread Aaron Brady
On Mar 21, 10:47 am, grocery_stocker wrote: > On Mar 21, 6:38 am, Tim Chase wrote: > > > > > > For example, this means that there can be a start node supposedly. > > > Having a value of 0. It is pointing to node 1 with the value of "a" > > > and to node 2 with the value of "b". Trying to make som

Re: garbage collection / cyclic references

2009-03-21 Thread Aaron Brady
On Mar 21, 1:04 pm, John Nagle wrote: > Aaron Brady wrote: > > Hello, > > > I was reading and Googling about garbage collection, reference > > counting, and the problem of cyclic references. > > > Python's garbage collection module claims to be able to dete

Re: garbage collection / cyclic references

2009-03-22 Thread Aaron Brady
On Mar 21, 11:59 am, "andrew cooke" wrote: > Aaron Brady wrote: > > My point is, that garbage collection is able to detect when there are > > no program-reachable references to an object.  Why not notify the > > programmer (the programmer's objects) when t

regular expressions, stack and nesting

2009-03-22 Thread Aaron Brady
Hi, Every so often the group gets a request for parsing an expression. I think it would be significantly easier to do if regular expressions could modify a stack. However, since you might nearly as well write Python, maybe there is a compromise. Could the Secret Labs' regular expression engine

Re: regular expressions, stack and nesting

2009-03-22 Thread Aaron Brady
On Mar 22, 12:18 pm, Chris Rebert wrote: > 2009/3/22 Aaron Brady : > > > Hi, > > > Every so often the group gets a request for parsing an expression.  I > > think it would be significantly easier to do if regular expressions > > could modify a stack.  However, sin

garbage collection / reference cycles (cont.)

2009-03-24 Thread Aaron Brady
Hello, I am posting the code I mentioned on Saturday that collects garbage and cyclic garbage in a flattened two-step process. The code takes 122 lines incl. comments, with 100 in tests. It should be in a reply to this. My aim is a buffer-like object which can contain reference-counted objects.

Re: garbage collection / reference cycles (cont.)

2009-03-24 Thread Aaron Brady
On Mar 25, 12:11 am, Aaron Brady wrote: > Hello, > > I am posting the code I mentioned on Saturday that collects garbage > and cyclic garbage in a flattened two-step process.  The code takes > 122 lines incl. comments, with 100 in tests.  It should be in a reply > to this. >

Re: Any way to use a range as a key in a dictionary?

2009-03-26 Thread Aaron Brady
On Mar 26, 5:10 pm, "andrew cooke" wrote: > Mudcat wrote: > > I would like to use a dictionary to store byte table information to > > decode some binary data. The actual number of entries won't be that > > large, at most 10. That leaves the other 65525 entries as 'reserved' > > or 'other' but stil

dict view to list

2009-03-26 Thread Aaron Brady
Hi. Is there a possibility of the dict_values, dict_items, and dict_keys objects growing a 'tolist' method? It's one of those little things that contributes to one's user experience. P.S. Yes, yes, I know, -1. -- http://mail.python.org/mailman/listinfo/python-list

Re: dict view to list

2009-03-27 Thread Aaron Brady
On Mar 27, 7:14 am, alex23 wrote: > On Mar 27, 3:44 pm, Aaron Brady wrote: > > > Is there a possibility of the dict_values, dict_items, and dict_keys > > objects growing a 'tolist' method?  It's one of those little things > > that contributes to one'

Re: modifying a list element from a function

2009-03-27 Thread Aaron Brady
On Mar 27, 4:39 am, TP wrote: > Hi everybody, > > Be a the following list, containing list elements which second field is a > string. > > >>> a = [ [4, "toto"], [5, "cou"] ] > >>> a[0][1]="tou" > >>> a > > [[4, 'tou'], [5, 'cou']] > > OK. > > Now, I want: > * to do the same modification on the lis

Re: c.l.py dead, news at 11 (was Re: Mangle function name with decorator?)

2009-03-27 Thread Aaron Brady
On Mar 27, 8:15 pm, "andrew cooke" wrote: > Erik Max Francis wrote: > > [...] > > > And made all purdy-like: > > >    http://www.alcyone.com/tmp/python-list%20traffic.pdf > > That's very pretty, but neither the volume of posts, nor the quality of > the people posting here is really what I was talk

complaints about no replies last week

2009-03-28 Thread Aaron Brady
Hi, A week ago, I posted a question and an idea about Python's garbage collector. I got a few replies. Some days later, I posted a mock-up implementation of it, and got *NO* replies. Does this mean: a) It works b) It doesn't work c) It's not particularly applicable to Python at that point (par

Re: complaints about no replies last week

2009-03-28 Thread Aaron Brady
On Mar 28, 11:41 am, a...@pythoncraft.com (Aahz) wrote: > In article <2d80ec1b-5eb5-4e82-9a4a-36934dd53...@z9g2000yqi.googlegroups.com>, > Aaron Brady   wrote: > > > > >A week ago, I posted a question and an idea about Python's garbage > >collector.  I got a f

Re: c.l.py dead, news at 11 (was Re: Mangle function name with decorator?)

2009-03-28 Thread Aaron Brady
On Mar 29, 12:23 am, Steven D'Aprano wrote: > On Fri, 27 Mar 2009 19:57:41 -0700, Aaron Brady wrote: > > I see how c-l-py doesn't represent the full interests of Python, > > Python is a *programming language*. It doesn't have interests. It just > sits there, a bu

Re: garbage collection / reference cycles (cont.)

2009-03-29 Thread Aaron Brady
On Mar 25, 12:11 am, Aaron Brady wrote: > Hello, > > I am posting the code I mentioned on Saturday that collects garbage > and cyclic garbage in a flattened two-step process.  The code takes > 122 lines incl. comments, with 100 in tests.  It should be in a reply > to this. >

Re: garbage collection / reference cycles (cont.)

2009-03-29 Thread Aaron Brady
On Mar 25, 12:12 am, Aaron Brady wrote: > On Mar 25, 12:11 am, Aaron Brady wrote: > > Hello, > > > I am posting the code I mentioned on Saturday that collects garbage > > and cyclic garbage in a flattened two-step process.  The code takes > > 122 lines incl. co

Re: complaints about no replies last week

2009-03-29 Thread Aaron Brady
On Mar 28, 7:31 pm, ajaksu wrote: > Hi! > > Aaron Brady wrote: > > A week ago, I posted a question and an idea about Python's garbage > > collector.  I got a few replies. > > Some very nice, too :) Yes. > > Some days later, I posted a mock-up > >

Re: dict view to list

2009-03-29 Thread Aaron Brady
On Mar 27, 7:26 pm, Terry Reedy wrote: > Luis Gonzalez wrote: > > Yes, I know the python approach is to use built-ins. > > But wouldn't it be cool if we could do mydict.values().tolist() > > instead? > > Should we also give every collection a .toset(), .tofrozenset(), > .totuple(), and .todict() m

Re: Thoughts on language-level configuration support?

2009-03-31 Thread Aaron Brady
On Mar 30, 8:40 am, jfager wrote: > I've written a short post on including support for configuration down > at the language level, including a small preliminary half-functional > example of what this might look like in Python, available > athttp://jasonfager.com/?p=440. > > The basic idea is that

Re: Thoughts on language-level configuration support?

2009-04-01 Thread Aaron Brady
On Apr 1, 6:29 am, jfager wrote: > On Apr 1, 3:29 am, Kay Schluehr wrote: > > > > "Discoverable", as in built-in tools that let you have the following > > > conversation:  "Program, tell me all the things I can configure about > > > you" - "Okay, here they all are".  No digging through the source

pygame and socket.recv

2009-04-01 Thread Aaron Brady
Hi, I tried writing a small game on a pygame layer. The graphics are fine, and at the moment, it is not graphics intensive. It is multi- player, and for the communication, I am sending a pickle string across a LAN, once per frame. I'm observing some latency. It seems that socket.recv isn't per

Re: pygame and socket.recv

2009-04-01 Thread Aaron Brady
On Apr 1, 8:28 pm, Tim Wintle wrote: > On Wed, 2009-04-01 at 17:58 -0700, Aaron Brady wrote: > > I tried writing a small game on a pygame layer.  The graphics are > > fine, and at the moment, it is not graphics intensive.  It is multi- > > player, and for the communication,

Re: pygame and socket.recv

2009-04-01 Thread Aaron Brady
On Apr 1, 10:38 pm, Terry Reedy wrote: > Aaron Brady wrote: > > > My game loop looks like this: > > > poll events, get 1 at most > > send to server > > wait for server reply > > render entire frame > > I am very sure that commercial 'real-ti

Re: python for loop

2009-04-01 Thread Aaron Brady
On Apr 1, 11:58 pm, Lie wrote: > On Apr 1, 7:06 pm, Steven D'Aprano > > wrote: > > There is a major clash between the names of ordinals in human languages > > and zero-based counting. In human languages, the Nth-ordinal item comes > > in position N. You can keep that useful convention with zero-b

Re: python for loop

2009-04-01 Thread Aaron Brady
On Apr 2, 1:29 am, Steven D'Aprano wrote: > On Wed, 01 Apr 2009 21:58:47 -0700, Lie wrote: > > On Apr 1, 7:06 pm, Steven D'Aprano > > wrote: > > >> There is a major clash between the names of ordinals in human languages > >> and zero-based counting. In human languages, the Nth-ordinal item comes

Re: pygame and socket.recv

2009-04-02 Thread Aaron Brady
On Apr 2, 1:19 am, "Hendrik van Rooyen" wrote: > "Aaron Brady"  wrote: > > > Hi, > > > I tried writing a small game on a pygame layer.  The graphics are > > fine, and at the moment, it is not graphics intensive.  It is multi- > > player, an

Re: pygame and socket.recv

2009-04-02 Thread Aaron Brady
On Apr 2, 4:13 am, Tim Wintle wrote: > On Wed, 2009-04-01 at 18:45 -0700, Aaron Brady wrote: > > > My game loop looks like this: > > > poll events, get 1 at most > > send to server > > wait for server reply > > render entire frame > > The look I

Re: complaints about no replies last week

2009-04-02 Thread Aaron Brady
On Mar 31, 4:34 pm, Arnaud Delobelle wrote: > a...@pythoncraft.com (Aahz) writes: > > Arnaud Delobelle   wrote: > > >>There are no comments - I don't have the time to add any, sorry! > > > The margin is too small to contain the proof? > > I wish I could come up with such a resilient conjecture! >

Re: pygame and socket.recv

2009-04-02 Thread Aaron Brady
On Apr 2, 10:12 am, Miguel Prada wrote: > I don't know if this might be causing your problem, but most socket > implementations use quite a big buffer for incoming data by default. I > had a lot of trouble with another real-time networked application > until I realised this. Reducing this buffer t

Re: python for loop

2009-04-02 Thread Aaron Brady
On Apr 2, 6:34 pm, Tim Wintle wrote: > On Thu, 2009-04-02 at 15:16 -0700, Emile van Sebille wrote: > > Lou Pecora wrote: > > > Confusion only comes when you try to force the > > > defintion of one of them on the other and then say it's illogical or not > > > natural.  Both are natural. > > > Consi

Re: iterator question

2009-04-02 Thread Aaron Brady
On Apr 2, 5:17 pm, grocery_stocker wrote: > On Apr 2, 3:14 pm, grocery_stocker wrote: > > Discussion subject changed to "iterator question" by grocery_stocker Well, I thought it was funny. 'iteratoration'. Next, conversateration? -- http://mail.python.org/mailman/listinfo/python-list

Best way to pickle functions

2009-04-03 Thread Aaron Scott
I have a number of functions that I need to pickle without necessarily knowing their names in advance. My first thought was to put all the functions in a class, then pickle the class, but it doesn't really work like I expected it to. import cPickle class PickleClass:

Re: Best way to pickle functions

2009-04-03 Thread Aaron Brady
On Apr 3, 11:04 am, Aaron Scott wrote: > I have a number of functions that I need to pickle without necessarily > knowing their names in advance. My first thought was to put all the > functions in a class, then pickle the class, but it doesn't really > work like

Re: python for loop

2009-04-03 Thread Aaron Brady
On Apr 3, 10:43 am, alex23 wrote: > On Apr 3, 10:36 pm, Lou Pecora wrote: > > >  Aaron Brady wrote: > > > Did I tell you guys that 'natural' has 38 definitions at > > > dictionary.com? > > > Amazing.  I suggest you pick the one that fits best.

Re: Best way to pickle functions

2009-04-03 Thread Aaron Scott
> Pickling the source code is much sturdier.  It's very unlikely that > the same code runs differently in different interpreters.  It's much > more likely that the same code runs the same, or not at all. Okay, I've run into another problem. I've saved the code to a string, so I can call it up when

Re: Best way to pickle functions

2009-04-03 Thread Aaron Scott
Never mind. Solved the problem by putting the functions in a class and dumping that into a string. Then, when I need it, I executed the string to get myself the class, then created an instance of that class which gave me access to those functions along with the correct scope. Probably not the smart

Re: Best way to pickle functions

2009-04-03 Thread Aaron Scott
> Why not use import ?  Simply recreate the source file, if necessary, and > import it again. > Ah, you'd think it would be that easy :P The problem with just importing a module is that the module is then cached in memory. Multiple copies of the program are running on a server, and each of them h

Module caching

2009-04-03 Thread Aaron Scott
Is there a way to make a Python app running in mod_python with zero persistence? I have an app that should be resetting its variables every time you access it, but sometimes -- and only sometimes -- the variables persist through a couple refreshes. They'll even persist through multiple browsers, so

Re: Module caching

2009-04-03 Thread Aaron Scott
to "20", the next user who accesses the page with see the value as "20", even if their "custom values" file tries to set it differently. If anyone has experience with mod_python, either drop me a message here or e-mail me at aaron(at)manlab.com. I'd really apprec

Re: Module caching

2009-04-03 Thread Aaron Scott
Huzzah, another post. I just discovered that even physically deleting the variable doesn't work. The module storylab.game has the class InitGame, which contains "daemons = {}". A user runs the code, resulting in some values in "daemons": "{'berry2': , 'berry3': , 'berry1': }". These are pickled.

Re: Module caching

2009-04-03 Thread Aaron Scott
be easy enough to do, but I can't for the life of me find information on how to do it. Aaron -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to pickle functions

2009-04-03 Thread Aaron Brady
On Apr 3, 3:48 pm, Aaron Scott wrote: > > Why not use import ?  Simply recreate the source file, if necessary, and > > import it again. > > Ah, you'd think it would be that easy :P > > The problem with just importing a module is that the module is then > cached i

Re: Module caching

2009-04-04 Thread Aaron Scott
>         req.write(str(lab.game.settings.daemons)) >         del lab.game.settings >         req.write(str(lab.game.settings.daemons)) >         lab.game.settings = lab.game.InitGame() >         req.write(str(lab.game.settings.daemons)) > Sorry, that should have been: req.write(str(lab.g

Re: pygame and socket.recv

2009-04-04 Thread Aaron Brady
On Apr 2, 5:46 pm, Tim Wintle wrote: > On Thu, 2009-04-02 at 06:50 -0700, Aaron Brady wrote: > > It's just that if you register a collision in between the time that > > one object has changed its position and momentum, and the time you > > learn about it, you have

Re: pygame and socket.recv

2009-04-04 Thread Aaron Brady
On Apr 2, 4:13 am, Tim Wintle wrote: > On Wed, 2009-04-01 at 18:45 -0700, Aaron Brady wrote: > > > My game loop looks like this: > > > poll events, get 1 at most > > send to server > > wait for server reply > > render entire frame > > The look I

Re: group several methods under a attribute

2009-04-06 Thread Aaron Brady
On Apr 6, 5:40 am, jelle wrote: > Hi, > > I'm working on a pretty large class and I'd like to group several > methods under a attribute. > Its not convenient to chop up the class in several smaller classes, > nor would mixins really solve the issue. > So, what is a pythonic way of grouping several

Re: object knows which object called it?

2009-04-06 Thread Aaron Brady
On Apr 6, 9:53 am, Reckoner wrote: > hi, > > I have the following problem: I have two objects, say, A and B, which > are both legitimate stand-alone objects with lives of their own. > > A contains B as a property, so I often do > > A.B.foo() > > the problem is that some functions inside of B actua

Re: group several methods under a attribute

2009-04-06 Thread Aaron Brady
On Apr 6, 12:02 pm, Aaron Brady wrote: > On Apr 6, 5:40 am, jelle wrote: > > > Hi, > > > I'm working on a pretty large class and I'd like to group several > > methods under a attribute. > > Its not convenient to chop up the class in several smaller cla

hashing and collision detection

2009-04-07 Thread Aaron Brady
Hi group, You are making good on your promise from a year ago: "This is a helpful group. Give us more to go on, and you are likely to receive thousands of dollars worth of consulting for free." http://groups.google.com/group/comp.lang.python/msg/2e2906eaa804812c - Bryan Olson I have an idea, whic

Re: Module caching

2009-04-08 Thread Aaron Scott
a couple days to help with something else. I just didn't have time to catch up. In the end, we decided to convert everything from mod_python to CGI, which ended up getting us the functionality we were looking for. For development, MaxRequestsPerChild was already set to 1, but this didn't s

Re: safe eval of moderately simple math expressions

2009-04-09 Thread Aaron Brady
On Apr 9, 10:56 am, Joel Hedlund wrote: > Hi all! > > I'm writing a program that presents a lot of numbers to the user, and I > want to let the user apply moderately simple arithmentics to these > numbers. One possibility that comes to mind is to use the eval function, > but since that sends up al

Re: Scrap Posts

2009-04-10 Thread Aaron Brady
On Apr 9, 1:28 pm, Grant Edwards wrote: > On 2009-04-09, Avi wrote: >   2. Filter out everything posted from google groups. > >   3. Read the group via the mailing list (which has much better >      filtering). The mailing list is gatewayed by gmane.org if >      you prefer web or NNTP access ins

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Aaron Brady
On Apr 10, 7:54 pm, Steven D'Aprano wrote: > On Thu, 09 Apr 2009 13:13:50 -0400, Terry Reedy wrote: > > Joel Hedlund wrote: > >> Hi all! > > >> I'm writing a program that presents a lot of numbers to the user, and I > >> want to let the user apply moderately simple arithmentics to these > >> numbe

Re: weird try/finally behaviour

2009-04-11 Thread Aaron Brady
On Apr 10, 7:19 pm, Terry Reedy wrote: > Sylvain Thénault wrote: > > Hi there, > > > I've encountered the following behaviour which I found surprising: - > If you say 'print test()', you shoud see None printed after 'end' (at > least with 3.0) from the function falling off the end. > > The 'if Tru

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Aaron Brady
On Apr 11, 3:18 am, Joel Hedlund wrote: > Aaron Brady wrote: > > Would you be willing to examine a syntax tree to determine if there > > are any class accesses? > > Sure? How do I do that? I've never done that type of thing before so I > can't really say if i

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Aaron Brady
On Apr 11, 8:09 am, Paul McGuire wrote: > On Apr 11, 2:41 am, Aaron Brady wrote: > > > > > Why do I get the feeling that the authors of 'pyparsing' are out of > > breath? > > What kind of breathlessness do you mean?  I'm still breathing, last >

Re: Pathological regular expression

2009-04-11 Thread Aaron Brady
On Apr 11, 10:07 am, Steven D'Aprano wrote: > On Thu, 09 Apr 2009 02:56:00 -0700, David Liang wrote: > > Hi all, > > I'm having a weird problem with a regular expression (tested in 2.6 and > > 3.0): > > > Basically, any of these: > > _re_comments = re.compile(r'^(([^\\]+|\\.|"([^"\\]+|\\.)*")*)#.*

Re: Pathological regular expression

2009-04-11 Thread Aaron Brady
On Apr 11, 12:40 pm, Steven D'Aprano wrote: > On Sat, 11 Apr 2009 08:40:03 -0700, John Machin wrote: > >> To my mind, this is a bug in the RE engine. Is there any reason to not > >> treat it as a bug? > > > IMHO it's not a bug -- s/hang/takes a long time to compute/ > > > Just look at it: 2 + oper

Re: PyHeapTypeObject

2009-04-11 Thread Aaron Brady
On Apr 11, 7:36 pm, Brendan Miller wrote: > What's the point of PyHeapTypeObject in Include/object.h? Why does the > layout of object types need to be different on the heap vs statically > allocated? > > Thanks, > Brendan Does it need to be garbage collected, finalized, and deallocated? E.g. the

Re: Pathological regular expression

2009-04-11 Thread Aaron Brady
On Apr 11, 7:31 pm, Steven D'Aprano wrote: _ > My original test has now been running for close to ten hours now, and > still can't be interrupted with ctrl-C. However that's in Python 2.5, > having tried it in Python 2.6.2 they can be interrupted, so I'm satisfied > that this bug of "regex hangs t

Re: design question, metaclasses?

2009-04-12 Thread Aaron Brady
On Apr 12, 1:30 pm, Darren Dale wrote: > On Apr 11, 2:15 pm, Darren Dale wrote: > > _ > > > format1.Group # implementation of group in format1 > > format2.Group # ... > > Base.DerivedGroup # base implementation of DerivedGroup, not directly > > useful > > format1.DerivedGroup = Base.DerivedGroup(

Ann: WHIFF -- WSGI/HTTP INTEGRATED FILESYSTEM FRAMES

2009-04-12 Thread Aaron Watters
king a web application. Instead WHIFF is designed to provide a set of ingredients which can be easily combined to make web applications (with no need to refine your own sugar or mill your own wheat). I hope you like it. -- Aaron Watters === Why is a giraffe's neck so long? Because its head is

Re: Data Model:

2009-04-12 Thread Aaron Watters
ns when making this decision? > > Thanks! It looks to me that the two designs might be useful for different purposes. What are you trying to do? -- Aaron Watters whiff.sourceforge.net http://aaron.oirt.rutgers.edu/myapp/root/misc/erdTest -- http://mail.python.org/mailman/listinfo/python-list

Re: design question, metaclasses?

2009-04-12 Thread Aaron Brady
On Apr 12, 4:53 pm, Darren Dale wrote: > On Apr 12, 4:50 pm, Kay Schluehr wrote: > > > > > On 11 Apr., 20:15, Darren Dale wrote: > > > > I am working on a project that provides a high level interface to hdf5 > > > files by implementing a thin wrapper around h5py. > > > I would like to > > > gene

Re: Data Model:

2009-04-12 Thread Aaron Brady
On Apr 12, 9:14 pm, Anthony wrote: > I'm struggling on whether or not to implement GroupItem (below) with > two separate models, or with one model that has a distinguishing key: > > Given: > class ParentGroup: >     a group of values represented by class GroupItem > > class ChildGroup: >     a gro

Re: Python-list Digest, Vol 67, Issue 192

2009-04-12 Thread Aaron Brady
On Apr 12, 6:29 pm, Ryniek90 wrote: > Chris Rebert pisze: > > > > > On Sun, Apr 12, 2009 at 3:38 PM, Ryniek90 wrote: > > >>> Paul Rubin > >>> Ryniek90 writes: > > When i wanted to send an .iso file of 4GB length, i had traceback: > "OverflowError: request

Re: Data Model:

2009-04-12 Thread Aaron Brady
On Apr 12, 10:33 pm, Anthony wrote: > On Apr 12, 8:10 pm, Aaron Brady wrote: > > > > > On Apr 12, 9:14 pm, Anthony wrote: > > > > I'm struggling on whether or not to implement GroupItem (below) with > > > two separate models, or with one model

Re: Data Model:

2009-04-13 Thread Aaron Brady
On Apr 13, 2:29 am, Anthony wrote: > On Apr 12, 9:36 pm, Aaron Brady wrote: > > > > > On Apr 12, 10:33 pm, Anthony wrote: > > > > On Apr 12, 8:10 pm, Aaron Brady wrote: > > > > > On Apr 12, 9:14 pm, Anthony wrote: > > > > > >

Re: Using a decorator to *remove* parameters from a call

2009-04-13 Thread Aaron Brady
On Apr 13, 5:11 am, Michel Albert wrote: > A small foreword: This might look like a cherrypy-oriented post, and > should therefore go to the cherrypy group, but if you read to the end, > you'll see it's a more basic python problem, with cherrypy only as an > example. ;) > > From the decorator PEP

Re: Generators/iterators, Pythonicity, and primes

2009-04-13 Thread Aaron Brady
On Apr 13, 1:39 am, Arnaud Delobelle wrote: > Duncan Booth writes: > > Duncan Booth wrote: > > >> John Posner wrote: > > >>> Do know what in the itertools implementation causes adding a 'if p <= > >>> sqrt(n)' clause to *decrease* performance, while adding a > >>> 'takewhile()' clause *increase

Re: HTML Conversion in python

2009-04-13 Thread Aaron Watters
There are many other HTML generation approaches as indicated by the Wiki link previously. As far as I know the WHIFF approach is the most "compositional". Please correct me if I'm wrong. Thanks, -- Aaron Watters === 'To join the Guild I had to kill somebody, cruelly, with no

Re: Using a decorator to *remove* parameters from a call

2009-04-13 Thread Aaron Brady
On Apr 13, 8:25 am, azeem wrote: > On Apr 13, 3:45 pm, Aaron Brady wrote: snip > > @take_ab > > def f( c= 42, d= 'some' ): > >     print( 'in f, c= %r, d= %r'% ( c, d ) ) > > > f( a= 'paramA', b= 'paramB', c= 'other num

<    1   2   3   4   5   6   7   8   9   10   >