Re: Python inside C++

2009-04-13 Thread Aaron Brady
On Apr 13, 8:41 am, Kushal Kumaran wrote: > On Wed, Apr 15, 2009 at 8:56 AM, AJ Mayorga wrote: > > Hello all, > > > I am looking for a way  to statically compile pythonxx.dll into my C++ > > application, so that I can use It as an internal scripting language and > > either run the native python c

Re: Who is your daddy: Can I find what object instantiates another object?

2009-04-13 Thread Aaron Brady
On Apr 13, 6:50 pm, Steven D'Aprano wrote: > On Mon, 13 Apr 2009 19:12:21 +0200, Diez B. Roggisch wrote: > >> Can the Parser object know who its Daddy is? > > > Yes, by Daddy telling him so. That's how nature does it, and how you > > should do it. Or do you think that because DNA-tests are availab

Re: sharing/swapping items between lists

2009-04-13 Thread Aaron Brady
On Apr 13, 10:04 am, Ross wrote: > On Apr 11, 1:10 pm, a...@pythoncraft.com (Aahz) wrote: > > > > > In article > > <4fd78ac3-ba83-456b-b768-3a0043548...@f19g2000vbf.googlegroups.com>, > > > Ross   wrote: > > > >I'm trying to design an iterator that produces two lists. The first > > >list will be

Re: sharing/swapping items between lists

2009-04-14 Thread Aaron Brady
On Apr 13, 11:52 pm, Aaron Brady wrote: > On Apr 13, 10:04 am, Ross wrote: > > > > > On Apr 11, 1:10 pm, a...@pythoncraft.com (Aahz) wrote: > > > > In article > > > <4fd78ac3-ba83-456b-b768-3a0043548...@f19g2000vbf.googlegroups.com>, > >

Re: segmentation fault while using ctypes

2009-04-14 Thread Aaron Brady
On Apr 14, 6:04 pm, sanket wrote: > On Apr 14, 4:00 pm, MRAB wrote: > > > > > sanket wrote: > > > Hello All, > > > > I am dealing with this weird bug. > > > I have a function in C and I have written python bindings for it using > > > ctypes. > > > > I can call this function for couple of times an

Re: Network game using mysql

2009-04-14 Thread Aaron Brady
On Apr 14, 4:14 pm, Tino Wildenhain wrote: > Hi, > > > > João Abrantes wrote: > > Good evening, > > > I am making an online game that stores its data in a mysql database. The > > thing is that I can't allow the players to interact directly with the > > important tables of database (they could chea

Re: sharing/swapping items between lists

2009-04-14 Thread Aaron Brady
On Apr 14, 12:37 pm, Ross wrote: > On Apr 14, 10:34 am, Ross wrote: > > > > > On Apr 14, 5:57 am, a...@pythoncraft.com (Aahz) wrote: > > > > In article > > > , > > > > Ross   wrote: > > > >On Apr 13, 9:08=A0am, a...@pythoncraft.com (Aahz) wrote: > > > >> In article > > > >> > > >com>, > > > >>

Re: segmentation fault while using ctypes

2009-04-14 Thread Aaron Brady
On Apr 14, 6:45 pm, Aaron Brady wrote: > On Apr 14, 6:04 pm, sanket wrote: > > > > > On Apr 14, 4:00 pm, MRAB wrote: > > > > sanket wrote: > > > > Hello All, > > > > > I am dealing with this weird bug. > > > > I have a functio

Re: sharing/swapping items between lists

2009-04-14 Thread Aaron Brady
On Apr 14, 7:01 pm, Aaron Brady wrote: > On Apr 14, 12:37 pm, Ross wrote: > > > > > On Apr 14, 10:34 am, Ross wrote: > > > > On Apr 14, 5:57 am, a...@pythoncraft.com (Aahz) wrote: > > > > > In article > > > > , > > > > >

Re: any(), all() and empty iterable

2009-04-14 Thread Aaron Brady
On Apr 14, 7:32 pm, John O'Hagan wrote: > On Tue, 14 Apr 2009, Mark Dickinson wrote: > > On Apr 14, 7:21 pm, Luis Alberto Zarrabeitia Gomez > > > wrote: > > > It's more than that. Python's following the rules here. Maybe it could be > > > documented better, for those without a background in logic

Re: sharing/swapping items between lists

2009-04-15 Thread Aaron Brady
On Apr 14, 9:45 pm, Ross wrote: > On Apr 14, 7:18 pm, Aaron Brady wrote: > > > > > On Apr 14, 7:01 pm, Aaron Brady wrote: > > > > On Apr 14, 12:37 pm, Ross wrote: > > > > > On Apr 14, 10:34 am, Ross wrote: > > > > > > On Apr 1

Re: how to know argument name with which a function of extended c called

2009-04-15 Thread Aaron Brady
On Apr 15, 3:52 am, John Machin wrote: > On Apr 15, 6:13 pm, rahul wrote: > > > > > On Apr 14, 6:24 pm, John Machin wrote: > > > > On Apr 14, 10:35 pm, rahul wrote: > > > > > Hi, > > > >   i need to write a 'c extension function' in this function i need to > > > > change argument value with  wh

Re: Calling user defined functions from a different script..

2009-04-15 Thread Aaron Brady
On Apr 15, 6:33 am, "venutaurus...@gmail.com" wrote: > Hello all, >           I have a situation where I need to call functions present in > a different script whose hierarchy is something like below: > > C:\Pythonlib\uitl\script1.py {Place where my functions definitions are > present} > > C:\Scri

Re: sharing/swapping items between lists

2009-04-15 Thread Aaron Brady
On Apr 15, 6:57 am, samwyse wrote: > On Apr 14, 7:01 pm, Aaron Brady wrote: > > > Here is an idea.  Create a list of all possible pairs, using > > itertools.combinations.  You'll notice everyone gets equal play time > > and equal time against each other on a pa

Re: sharing/swapping items between lists

2009-04-15 Thread Aaron Brady
On Apr 14, 9:45 pm, Ross wrote: > On Apr 14, 7:18 pm, Aaron Brady wrote: > > > > > On Apr 14, 7:01 pm, Aaron Brady wrote: > > > > On Apr 14, 12:37 pm, Ross wrote: > > > > > On Apr 14, 10:34 am, Ross wrote: > > > > > > On Apr 1

Re: Using Python after a few years of Ruby

2009-04-15 Thread Aaron Watters
me testing the comments feature :) ). Back in the old days you could at least count on someone yelling at you about how your design was such a bad idea -- Aaron Watters === HELP! HELP! I'M BEING REPRESSED! -- http://mail.python.org/mailman/listinfo/python-list

Re: sharing/swapping items between lists

2009-04-15 Thread Aaron Brady
On Apr 15, 11:29 am, samwyse wrote: > On Apr 15, 8:56 am, Aaron Brady wrote: > > > > > The randomizing solution isn't quite suitable for 16 teams.  With 5 > > teams/1 court, and 5 teams/2 courts, 6 teams/2 courts, the solution > > comes within seconds.  For 7 t

Re: WHIFF - was: Re: Using Python after a few years of Ruby

2009-04-15 Thread Aaron Watters
etter way to explain what I mean. -- Aaron Watters ( http://whiff.sourceforge.net ) === Sisyphus got ripped. -- http://mail.python.org/mailman/listinfo/python-list

Re: Lambda alternative?

2009-04-16 Thread Aaron Brady
On Apr 16, 5:25 am, mousemeat wrote: > On 16 Apr, 10:21, Hrvoje Niksic wrote: > > > > > mousemeat writes: > > > Thank you for everyone's explanations, help and interest on this > > > one.  I have reworked my code as described and promised myself not > > > to use lambdas ever again (i still think

Re: WHIFF - was: Re: Using Python after a few years of Ruby

2009-04-16 Thread Aaron Watters
wledge. I'm looking forward to learning otherwise. Please don't be too harsh. -- Thanks, Aaron Watters === If all the economists in the world were placed end to end they'd still point in different directions. -- http://mail.python.org/mailman/listinfo/python-list

Re: large db question about no joins

2009-04-16 Thread Aaron Brady
On Apr 16, 1:45 pm, Daniel Fetchinson wrote: > [off but interesting topic] > > Hi folks, I've come across many times the claim that 'joins are bad' > for large databases because they don't scale. Okay, makes sense, we > agree. But what I don't get, although I watched a couple of online > videos on

Re: Help improve program for parsing simple rules

2009-04-16 Thread Aaron Brady
On Apr 16, 10:57 am, prueba...@latinmail.com wrote: > Another interesting task for those that are looking for some > interesting problem: > I inherited some rule system that checks for programmers program > outputs that to be ported: given some simple rules and the values it > has to determine if t

Re: Accessing a parse tree

2009-04-16 Thread Aaron Brady
On Apr 16, 10:16 pm, John Machin wrote: > On Apr 17, 8:55 am, Clarendon wrote: > > > > > Hello! > > > I need a program that accesses a parse tree based on the designated > > words (terminals) within the tree. For instance, in: > > > I came a long way in changing my habit. > > > (ROOT > >   (S > >

Re: Non-secure execution environment

2009-04-17 Thread Aaron Brady
On Apr 17, 1:47 am, roge...@gmail.com wrote: > Hi, > > I am C++ guy for the most part and don't know much of Python, so, > please, bear with me if I am asking errrm..idiotic question. > > Old rexec module provided kinda 'secure' execution environment. I am > not looking for security at this point.

Re: Man Bites Python

2009-04-17 Thread Aaron Brady
On Apr 17, 3:33 am, Vito De Tullio wrote: > Mikael Olofsson wrote: > > I don't think the guy in question finds it that funny. > > I don't think the python in question finds it that funny. > > -- > By ZeD Man bites python. Python bites dog. Dog bites man. The end. -- http://mail.python.org/mailma

Re: Accessing a parse tree

2009-04-17 Thread Aaron Brady
On Apr 17, 4:03 am, Clarendon wrote: > Thank you very much for this information. It seems to point me to the > right direction. However, I do not fully understand the flatten > function and its output. Some indices seem to be inaccurate. I tried > to find this function at nltk.tree.Tree.flatten, b

Re: Accessing a parse tree

2009-04-17 Thread Aaron Brady
On Apr 17, 8:22 am, John Machin wrote: > On 17/04/2009 7:32 PM, Clarendon wrote: > > > Dear John Machin > > I presume that you replied to me instead of the list accidentally. > > > > > So sorry about the typo. It should be: "the program should *see* that > > the designated *words* are..." > > > "a

Re: get text from rogramms runn by subprocess.Popen immediatetly

2009-04-17 Thread Aaron Brady
On Apr 16, 8:02 am, Rüdiger Ranft <_r...@web.de> wrote: > Diez B. Roggisch schrieb: > > > Rüdiger Ranft schrieb: > >> Hi all, > > >> I need to call some programms and catch their stdout and stderr streams. > >> While the Popen class from subprocess handles the call, I get the > >> results of the pr

Re: Non-secure execution environment

2009-04-17 Thread Aaron Brady
On Apr 17, 11:19 am, roge...@gmail.com wrote: > On Apr 17, 7:06 am, Aaron Brady wrote: snip > > It depends what you mean by secure environment.  One option is to > > create a subprocess, to just limit access your variables.  Another is > > to compile and examine their code y

Re: Help improve program for parsing simple rules

2009-04-17 Thread Aaron Brady
On Apr 17, 7:37 am, prueba...@latinmail.com wrote: > On Apr 16, 3:59 pm, Aaron Brady wrote: > > > > > On Apr 16, 10:57 am, prueba...@latinmail.com wrote: > > > > Another interesting task for those that are looking for some > > > interesting problem: > &g

Re: Help improve program for parsing simple rules

2009-04-17 Thread Aaron Brady
On Apr 17, 12:15 pm, Paul McGuire wrote: > On Apr 17, 10:43 am, John Machin wrote: snip > not only does this handle > "0.00 LE A LE 4.00", but it could also evaluate "0.00 LE A LE 4.00 LE > E > D".  (I see that I should actually do some short-circuiting here - > if ret is false after calling fn(v

Re: Lambda alternative?

2009-04-17 Thread Aaron Brady
On Apr 17, 1:43 pm, "J. Cliff Dyer" wrote: > On Thu, 2009-04-16 at 13:33 +0200, Hrvoje Niksic wrote: > > mousemeat writes: > > > > Correct me if i am wrong, but i can pickle an object that contains a > > > bound method (it's own bound method). > > > No, you can't: > > > >>> import cPickle as p >

Re: Help improve program for parsing simple rules

2009-04-17 Thread Aaron Brady
On Apr 17, 2:01 pm, Paul McGuire wrote: > On Apr 17, 1:26 pm, Aaron Brady wrote: > > > Hi, not to offend; I don't know your background.   > > Courtesy on Usenet!!!  I'm going to go buy a lottery ticket! > > Not to worry, I'm a big boy.  People have even

Re: Man Bites Python

2009-04-17 Thread Aaron Brady
On Apr 17, 7:03 pm, "AD." wrote: > On Apr 17, 11:11 pm, Aaron Brady wrote: > > > Man bites python. > > Python bites dog. > > Dog bites man. > > or just: > > man,python bites python,man > > No need for the temporary value in Python. Is Py

Re: Overriding methods per-object

2009-04-17 Thread Aaron Brady
On Apr 17, 8:22 pm, Pavel Panchekha wrote: > I've got an object which has a method, __nonzero__ > The problem is, that method is attached to that object not that class > > > a = GeneralTypeOfObject() > > a.__nonzero__ = lambda: False > > a.__nonzero__() > > False > > But: > > > bool(a) > > True >

Re: large db question about no joins

2009-04-17 Thread Aaron Brady
On Apr 17, 3:16 pm, "Martin P. Hellwig" wrote: > Daniel Fetchinson wrote: > > > > > > > In an relational database setting you would have a table for artists, > > a table for cd's and a table for songs and a table for comments where > > people can comment on songs. All of this with obvious foreign

Re: send() to a generator in a "for" loop with continue(val)??

2009-04-17 Thread Aaron Brady
On Apr 17, 3:59 pm, Dale Roberts wrote: > I've started using generators for some "real" work (love them!), and I > need to use send() to send values back into the yield inside the > generator. When I want to use the generator, though, I have to > essentially duplicate the machinery of a "for" loop

Re: Overriding methods per-object

2009-04-17 Thread Aaron Brady
On Apr 17, 9:28 pm, Pavel Panchekha wrote: > > The docs don't say you can do that: > > Thanks, hadn't noticed that. > > > Should you be able to? > > I'd say so. In my case, I need a class that can encapsulate any > object, add a few methods to it, and spit something back that works > just like the

Re: Something weird about re.finditer()

2009-04-17 Thread Aaron Brady
On Apr 17, 9:37 pm, Steven D'Aprano wrote: > On Sat, 18 Apr 2009 12:37:09 +1200, Lawrence D'Oliveiro wrote: > > In message , > > Steven D'Aprano wrote: > > >> BTW, testing for None with == is not recommended, because one day > >> somebody might pass your function some strange object that compares

Re: Is there a programming language that is combination of Python andBasic?

2009-04-18 Thread Aaron Brady
On Apr 18, 4:44 am, "Hendrik van Rooyen" wrote: > "baykus" wrote: > > I guess I did not articulate myself well enough. I was just looking > > for a toy to play around. I never suggested that Python+Basic would be > > better than Python and everyone should use it. Python is Python and > > Basic is

Re: python alternatives to C structs??

2009-04-18 Thread Aaron Brady
On Apr 18, 2:25 pm, KoolD wrote: > Hey all, > I need to convert a C code to python please help me figure out how to > do > it. > Suppose the C program's like: > > > typedef struct _str > { > int a; > char *b; > int c;}str; > > int main() > { > str mbr; > fd=ope

Re: Overriding methods per-object

2009-04-18 Thread Aaron Brady
On Apr 17, 9:41 pm, Steven D'Aprano wrote: > On Fri, 17 Apr 2009 18:22:49 -0700, Pavel Panchekha wrote: > > I've got an object which has a method, __nonzero__ The problem is, that > > method is attached to that object not that class > > >> a = GeneralTypeOfObject() > >> a.__nonzero__ = lambda: Fal

Re: Too early implementation

2009-04-18 Thread Aaron Watters
months but I think I started/restarted 3 times before I was happy with the basic approach and could move forward past step (3). -- Aaron Watters http://aaron.oirt.rutgers.edu/myapp/docs/W1500.whyIsWhiffCool === Software time estimation rule: How long could it possibly take? Double that. Switch

Re: Is there a programming language that is combination of Python andBasic?

2009-04-19 Thread Aaron Brady
On Apr 19, 3:05 am, "Hendrik van Rooyen" wrote: >  "Aaron Brady" wrote: > > On Apr 18, 4:44 am, "Hendrik van Rooyen" wrote: > > >> to untangle some spaghetti code. He did not mention if > >> the spaghetti was actually doing it'

Re: generating random tuples in python

2009-04-21 Thread Aaron Brady
On Apr 20, 11:04 pm, per wrote: > On Apr 20, 11:08 pm, Steven D'Aprano > > > > wrote: > > On Mon, 20 Apr 2009 11:39:35 -0700, per wrote: > > > hi all, > > > > i am generating a list of random tuples of numbers between 0 and 1 using > > > the rand() function, as follows: > > > > for i in range(0,

relation class

2009-04-21 Thread Aaron Brady
Hi all, I think Python should have a relation class in the standard library. Fat chance. I want to write a recipe for it, but I don't know how. I want your advice on some of the trade-offs, what it should look like, what the pitfalls are, different strengths and weaknesses, etc. Fundamentally,

Re: problem with PyMapping_SetItemString()

2009-04-21 Thread Aaron Brady
On Apr 21, 2:25 am, rahul wrote: > i have a c extension snip >           dict=PyEval_GetLocals(); snip >           PyMapping_SetItemString(dict,varname,newVar_pyvalue); snip > than first two test cases runs correctly and gives result for var1 > "value changed"  but 3rd test case not gives correct

Re: relation class

2009-04-22 Thread Aaron Brady
On Apr 22, 12:09 am, Chris Rebert wrote: > On Tue, Apr 21, 2009 at 5:51 PM, Aaron Brady wrote: > > Hi all, > > > I think Python should have a relation class in the standard library. > > Fat chance. > > Perhaps I'm not understanding "relation&qu

Re: relation class

2009-04-22 Thread Aaron Brady
On Apr 22, 11:52 am, Aaron Brady wrote: > On Apr 22, 12:09 am, Chris Rebert wrote: > > > On Tue, Apr 21, 2009 at 5:51 PM, Aaron Brady wrote: > > > Hi all, > > > > I think Python should have a relation class in the standard library. > > > Fat chance. >

OT: a metacomment on feedback comments

2009-04-23 Thread Aaron Watters
and the FCK wisiwig editor, checked in to the repository and demoed in the documentation, but not tarred up in a release yet. At least I'm having fun with it! -- Aaron Watters http://aaron.oirt.rutgers.edu/myapp/docs/W1500.whyIsWhiffCool === ban dhmo! http://www.dhmo.org/ -- http:/

Re: OT: a metacomment on feedback comments

2009-04-23 Thread Aaron Watters
te for my initial thoughts inspired by J.B's comments. [BTW: I had to back out a handful of mootools coolnesses because they broke in horrible ways under IE8 -- I apologize if you saw a blank page or any other weirdness.] Thanks again! -- Aaron Watters http://aaron.oirt.rutgers.edu/mya

Re: relation class

2009-04-23 Thread Aaron Brady
On Apr 22, 11:34 pm, Aaron Brady wrote: > On Apr 22, 11:52 am, Aaron Brady wrote: > > > On Apr 22, 12:09 am, Chris Rebert wrote: > > > > On Tue, Apr 21, 2009 at 5:51 PM, Aaron Brady wrote: > > > > Hi all, > > > > > I think Python s

Re: relation class

2009-04-26 Thread Aaron Brady
On Apr 24, 1:18 am, Aaron Brady wrote: > On Apr 22, 11:34 pm, Aaron Brady wrote: > > > On Apr 22, 11:52 am, Aaron Brady wrote: > > > > On Apr 22, 12:09 am, Chris Rebert wrote: > > > > > On Tue, Apr 21, 2009 at 5:51 PM, Aaron Brady > > > >

Re: Lisp mentality vs. Python mentality

2009-04-26 Thread Aaron Brady
On Apr 26, 10:52 am, Scott David Daniels wrote: > Travis wrote: > > ... I've noticed that every one of you is wrong about programming. > > Since I can't say it effectively, here's someone who can: > >http://www.youtube.com/watch?v=XHosLhPEN3k > > > That's the answer. > > That is a wonderful link.

Re: OT: a metacomment on feedback comments

2009-04-27 Thread Aaron Watters
Regarding feedback about WHIFF -- WSGI/HTTP Integrated Filesystems Frames On Apr 23, 3:43 pm, Aaron Watters wrote: > On Apr 23, 11:54 am, Johannes Bauer wrote: > > > To sum it up, I think it's a neat idea, but it's not really intuitive. > > After being quite sta

Re: suggestion on a complicated inter-process communication

2009-04-27 Thread Aaron Brady
On Apr 27, 10:59 pm, Way wrote: > Hello friends, > > I have a little messy situation on IPC. Please if you can, give me > some suggestion on how to implement. Thanks a lot! > > -> denotes create > > MainProcess -> Process1 -> Process3 (from os.system) >                    | >                     -

Re: Light (general) Inter-Process Mutex/Wait/Notify Synchronization?

2009-04-27 Thread Aaron Brady
On Apr 28, 12:20 am, Gunter Henriksen wrote: > > If you don't want to use a 3rd party module you could > > use the multiprocessing module > > That is definitely good for when I have a tree of > processes which are all Python applications.  I use > it for that.  But I am looking for something where

Why bool( object )?

2009-04-27 Thread Aaron Brady
What is the rationale for considering all instances true of a user- defined type? Is it strictly a practical stipulation, or is there something conceptually true about objects? ''' object.__bool__(self) If a class defines neither __len__() nor __bool__(), all its instances are considered true. ''

Re: Why bool( object )?

2009-04-28 Thread Aaron Brady
On Apr 28, 1:35 am, Lie Ryan wrote: > Aaron Brady wrote: > > What is the rationale for considering all instances true of a user- > > defined type?   > > User-defined objects (or type) can override .__len__() [usually > container types] or .__nonzero__() to make bool() re

Re: Why bool( object )?

2009-04-28 Thread Aaron Brady
On Apr 28, 2:39 am, Steven D'Aprano wrote: > On Mon, 27 Apr 2009 23:11:11 -0700, Aaron Brady wrote: > > What is the rationale for considering all instances true of a user- > > defined type?  Is it strictly a practical stipulation, or is there > > something conce

Re: Why bool( object )?

2009-04-29 Thread Aaron Brady
On Apr 28, 9:54 pm, Steven D'Aprano wrote: > On Tue, 28 Apr 2009 11:59:18 -0700, Aaron Brady wrote: > >> To steal an idiom from Laura: Python has a float-shaped Nothing 0.0, a > >> list-shaped Nothing [], a dict-shaped Nothing {}, an int-shaped Nothing > >>

Re: suggestion on a complicated inter-process communication

2009-04-29 Thread Aaron Brady
Um, that's the limit of what I'm familiar with, I'm afraid. I'd have to experiment. On Apr 28, 10:44 am, Way wrote: > Thanks a lot for the reply. I am not familiar with multi-process in > Python. I am now using something like: snip > However, in this case, Process5's stdout cannot be passed to >

Re: Why bool( object )?

2009-05-01 Thread Aaron Brady
On May 1, 4:30 am, Steven D'Aprano wrote: > On Fri, 01 May 2009 16:30:19 +1200, Lawrence D'Oliveiro wrote: > > I have never written anything so unbelievable in my life. And I hope I > > never will. > > I didn't say you did. If anyone thought I was quoting Lawrence's code, > I'd be surprised. It wa

Re: Multiprocessing Pool and functions with many arguments

2009-05-01 Thread Aaron Brady
On Apr 29, 1:01 pm, "psaff...@googlemail.com" wrote: > I'm trying to get to grips with the multiprocessing module, having > only used ParallelPython before. > > based on this example: > > http://docs.python.org/library/multiprocessing.html#using-a-pool-of-w... > > what happens if I want my "f" to

Re: Multiprocessing.Queue - I want to end.

2009-05-01 Thread Aaron Brady
On Apr 30, 3:49 pm, Luis Zarrabeitia wrote: > Hi. I'm building a script that closely follows a producer-consumer model. In > this case, the producer is disk-bound and the consumer is cpu-bound, so I'm > using the multiprocessing module (python2.5 with the multiprocessing backport > from google.cod

Re: subprocess & shared environments

2009-05-01 Thread Aaron Brady
On May 1, 12:09 am, Robert Dailey wrote: > I'm currently calling subprocess.call() on a batch file (in Windows) > that sets a few environment variables that are needed by further > processes started via subprocess.call(). How can I persist the > environment modifications by the first call() functi

Re: Self function

2009-05-05 Thread Aaron Brady
On May 5, 2:50 pm, Steve Howell wrote: > On May 4, 11:08 pm, Steven D'Aprano > > wrote: > > > I propose a small piece of sugar. When a function is entered, Python > > creates an ordinary local name in the function's local namespace, and > > binds the function itself to that name. Two possibilitie

Re: call function of class instance with no assigned name?

2009-05-05 Thread Aaron Brady
On May 5, 2:17 pm, George Oliver wrote: > On May 5, 11:59 am, Dave Angel wrote: > > > 1) forget about getattr() unless you have hundreds of methods in your > > map.  The real question is why you need two maps. What good is the > > "command string" doing you?   Why not just map the keyvalues direc

Re: Self function

2009-05-05 Thread Aaron Brady
On May 5, 3:54 pm, bearophileh...@lycos.com wrote: > Aaron Brady: > > > >>> def auto( f ): > > > ...     def _inner( *ar, **kw ): > > ...             return f( g, *ar, **kw ) > > ...     g= _inner > > ...     return g > > Looks nice, I'll

Re: Self function

2009-05-06 Thread Aaron Brady
On May 6, 2:23 am, Arnaud Delobelle wrote: > On May 5, 10:20 pm, Aaron Brady wrote: > > > def auto( f ): > >     def _inner( *ar, **kw ): > >         return f( _inner, *ar, **kw ) > >     return _inner > > Quoting myself near the start of this thread: > &

Re: Self function

2009-05-06 Thread Aaron Brady
On May 6, 6:49 am, Lie Ryan wrote: > Luis Zarrabeitia wrote: > > Btw, is there any way to inject a name into a function's namespace? > > Following > > the python tradition, maybe we should try to create a more general solution! > > How about a mechanism to pass arguments that are optional to acce

Re: object query assigned variable name?

2009-05-06 Thread Aaron Brady
On May 6, 12:56 am, John O'Hagan wrote: > On Tue, 5 May 2009, Sion Arrowsmith wrote: > > John O'Hagan   wrote: > > >I can see that it's tantalizing, though, because _somebody_ must know > > > about the assignment; after all, we just executed it! > > > Except we haven't, if we're talking about repo

Re: Why there is a parameter named "self" for classmethod function?

2009-05-07 Thread Aaron Brady
On May 7, 1:29 am, Steven D'Aprano wrote: > On Thu, 07 May 2009 00:39:28 -0400, Terry Reedy wrote: > > Functions that refer to neither the class nor an instance thereof can > > usually be moved outside the class altogether.  Python is not Java.  I > > believe staticmethod() was mainly added becaus

Re: Why there is a parameter named "self" for classmethod function?

2009-05-09 Thread Aaron Brady
On May 8, 7:52 pm, Steven D'Aprano wrote: > On Thu, 07 May 2009 04:27:15 -0700, Aaron Brady wrote: > >> Can be, but if there's reason enough to keep it with a class, there's > >> no reason not to. > > > That's a bit of hyperbole; the usu

Re: Adding a Par construct to Python?

2009-05-19 Thread Aaron Brady
On May 17, 7:05 am, jer...@martinfamily.freeserve.co.uk wrote: > From a user point of view I think that adding a 'par' construct to > Python for parallel loops would add a lot of power and simplicity, > e.g. > > par i in list: >     updatePartition(i) > > There would be no locking and it would be t

Re: Adding a Par construct to Python?

2009-05-19 Thread Aaron Brady
On May 19, 11:20 pm, Paul Rubin wrote: > Steven D'Aprano writes: > > (4) the caller is responsible for making sure he never shares data while > > looping over it. > > > I don't think I've missed any possibilities. You have to pick one of > > those four. > > I wonder

Ann: Nucular full text search 0.5 +boolean queries +unicode fixes

2009-05-20 Thread Aaron Watters
ular is pure Python. Nucular indexes and retrieves data quickly. Nucular has a funny name. More information about Nucular including links to documentation, and releases is available at http://nucular.sourceforge.net Thanks: Rene Maurer and Matt Chaput and others for comments, suggestions, patches.

Re: Adding a Par construct to Python?

2009-05-28 Thread Aaron Brady
On May 27, 11:07 pm, Steven D'Aprano wrote: > On Wed, 27 May 2009 12:58:02 +, Albert van der Horst wrote: > > >>And how is reduce() supposed to know whether or not some arbitrary > >>function is commutative? > > > Why would it or need it? A Python that understands the ``par'' keyword > > is su

Re: try except inside exec

2009-05-29 Thread Aaron Brady
On May 29, 8:21 am, Michele Petrazzo wrote: > Hi all, > I want to execute a python code inside a string and so I use the exec > statement. The strange thing is that the try/except couple don't catch > the exception and so it return to the main code. > Is there a solution to convert or make this co

Re: try except inside exec

2009-05-29 Thread Aaron Brady
On May 29, 9:55 am, Michele Petrazzo wrote: > Aaron Brady wrote: > > STR = """ > > class Globals: > >    err = 0 > > def a_funct(): > >    try: > >       1/0 > >    except ZeroDivisionError: > >       import traceback > >

hash and __eq__

2009-05-30 Thread Aaron Brady
I am writing a mapping object, and I want to ask about the details of __hash__ and __eq__. IIUC if I understand correctly, the Python dict's keys' hash codes are looked up first in O( 1 ), then all the matching hash entries are compared on equality in O( n ). That is, the hash code just really na

Re: hash and __eq__

2009-05-30 Thread Aaron Brady
On May 30, 12:11 pm, Dennis Lee Bieber wrote: > On Sat, 30 May 2009 11:20:47 -0700 (PDT), Aaron Brady > declaimed the following in > gmane.comp.python.general: > > > P.S.  I always feel like my posts should start like, "A mapping object > > am writing I."  Not t

Re: Python is slow

2008-05-23 Thread Aaron Lance
Troll much? -- http://mail.python.org/mailman/listinfo/python-list

Writing a function from within Python

2008-05-28 Thread Aaron Scott
Is it possible to change the content of a function after the function has been created? For instance, say I make a class: class MyClass: def ClassFunction(self): return 1 And I create an object: MyObject = MyClass() Is there any way to cha

Re: marshal.dumps quadratic growth and marshal.dump not allowing file-like objects

2008-06-18 Thread Aaron Watters
aranoid, whereas pickle is a security disaster waiting to happen unless you are extremely cautious... yet again. Sorry, I know a even a monkey learns after 3 times... -- Aaron Watters === http://www.xfeedme.com/nucular/pydistro.py/go?FREETEXT=disaster -- http://mail.python.org/mailman/listinfo/python-list

Error importing modules with mod_python

2008-07-21 Thread Aaron Scott
t_module execfile(file, module.__dict__) File "C:\htdocs\python\index.py", line 2, in from storylab import * ImportError: No module named storylab --- What am I doing wrong? Any insight would be greatly appreciated. Thanks, Aaron -- http://mail.python.org/mailman/listinfo/python-list

Using variables across modules

2008-07-23 Thread Aaron Scott
I'm having some trouble understanding how Python handles variables across multiple modules. I've dug through the documentation, but I still find myself at a loss. When you import a module, are you creating an instance of the variables within? For instance, if I have one file, "variables.py", which

Re: Using variables across modules

2008-07-23 Thread Aaron Scott
> Just wirte test code ! variables.py: myvar = 5 print myvar foo.py: from variables import * def PrintVar(): print myvar bar.py: from variables import * from foo import * print myvar myvar = 2 print myvar PrintVar() "python bar.py"

Re: Using variables across modules

2008-07-23 Thread Aaron Scott
t; > hope this helps! > Awesome. After reading those two pages, I was able to correct the code and get things up and running. Thanks! Aaron -- http://mail.python.org/mailman/listinfo/python-list

object-relational mappers

2008-04-01 Thread Aaron Watters
s to say I feel that they all make me learn so much about the internals and features of the O-R mapper itself that I would be better off rolling my own queries on an as-needed basis without wasting so many brain cells. comments? -- Aaron Watters === http://www.xfeedme.com/nucular/pydistro

april fools email backfires

2008-04-02 Thread Aaron Watters
would be a great idea; it's about time; gotta do something about this mess... -- Aaron Watters === http://www.xfeedme.com/nucular/pydistro.py/go?FREETEXT=other+surprises -- http://mail.python.org/mailman/listinfo/python-list

Re: object-relational mappers

2008-04-02 Thread Aaron Watters
nd in emergencies it can save you a lot of pain. But if you use it too often and too seriously you end up with really big problems. -- Aaron Watters === http://www.xfeedme.com/nucular/pydistro.py/go?FREETEXT=mysterious+objects -- http://mail.python.org/mailman/listinfo/python-list

Re: april fools email backfires

2008-04-02 Thread Aaron Watters
On Apr 2, 11:07 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > > Can you post a link? > > -- Paul Sorry. It came from private email. And I don't want to get anyone in trouble... -- Aaron Watters === http://www.xfeedme.com/nucular/pydistro.py/go?FREETEXT=

CPython VM & byte code resources wanted

2008-04-08 Thread Aaron Gray
Hi, I am looking to study the CPython source code, but I cannot seem to find the VM code. Also is there any where a detailed list of the opcodes ? Many thanks in advance, Aaron -- http://mail.python.org/mailman/listinfo/python-list

Re: CPython VM & byte code resources wanted

2008-04-08 Thread Aaron Gray
"Aaron Gray" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I am looking to study the CPython source code, but I cannot seem to find > the VM code. Found it :) Python/ceval.c > Also is there any where a detailed list of the op

Re: CPython VM & byte code resources wanted

2008-04-08 Thread Aaron Gray
>Bytecodes: >http://docs.python.org/lib/bytecodes.html > >VM: >Python/ceval.c Thanks, Aaron -- http://mail.python.org/mailman/listinfo/python-list

Re: Profiling programs/scripts?

2008-04-11 Thread Aaron Watters
Python installations. The profile "run" function will run the tests function and print a report on the timings and counts it found. More info here: http://docs.python.org/lib/profile.html -- Aaron Watters === http://www.xfeedme.com/nucular/pydistro.py/go?FREETEXT=emulate+perl -- ht

Re: Tremendous slowdown due to garbage collection

2008-04-14 Thread Aaron Watters
hink the default behaviour of the gc is pretty silly. I tend to disable automatic gc and explicitly put in collections when I know I'm done with some big operation these days. -- Aaron Watters === http://www.xfeedme.com/nucular/pydistro.py/go?FREETEXT=dumb+slow -- http://mail.python.org/mailman/listinfo/python-list

Re: Tremendous slowdown due to garbage collection

2008-04-15 Thread Aaron Watters
igned to stream results sequentially from disk whenever possible. The one place where it doesn't do this very well (proximity searches) shows the most problems with performance (under bad circumstances like searching for two common words in proximity). -- Aaron Watters === http://www.xf

Re: py3k s***s

2008-04-16 Thread Aaron Watters
istake :) (but I still think full stackless would be much better, which python seems to be very slowly moving towards.) -- Aaron Watters === http://www.xfeedme.com/nucular/pydistro.py/go?FREETEXT=nonsense -- http://mail.python.org/mailman/listinfo/python-list

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