[issue22084] Mutating while iterating

2014-07-26 Thread Aaron Brady
New submission from Aaron Brady: Hi, I asked about the inconsistency of the RuntimeError being raised when mutating a container while iterating over it here [1], set and dict iteration on Aug 16, 2012. [1] http://www.gossamer-threads.com/lists/python/python/1004659 I posted a patch on the ML

Re: unit test strategy

2012-09-22 Thread Aaron Brady
On Sunday, September 16, 2012 3:01:11 PM UTC-5, Steven D'Aprano wrote: On Sun, 16 Sep 2012 11:38:15 -0700, Aaron Brady wrote: Here is an example of some repetitive code. for view_meth in [ dict.items, dict.keys, dict.values ]: dict0= dict( ( k, None ) for k in range( 10

Re: unit test strategy

2012-09-16 Thread Aaron Brady
On Sunday, September 16, 2012 2:42:09 AM UTC-5, Steven D'Aprano wrote: On Fri, 14 Sep 2012 19:59:29 -0700, Aaron Brady wrote: Hello, I've developing a test script. There's a lot of repetition. I want to introduce a strategy for approaching it, but I don't want the program

Re: unit test strategy

2012-09-15 Thread Aaron Brady
On Friday, September 14, 2012 10:32:47 PM UTC-5, David Hutto wrote: On Fri, Sep 14, 2012 at 11:26 PM, Dwight Hutto dwightdhu...@gmail.com wrote: On Fri, Sep 14, 2012 at 10:59 PM, Aaron Brady castiro...@gmail.com wrote: Hello, I've developing a test script. There's a lot

unit test strategy

2012-09-14 Thread Aaron Brady
Hello, I've developing a test script. There's a lot of repetition. I want to introduce a strategy for approaching it, but I don't want the program to be discredited because of the test script. Therefore, I'd like to know what people's reactions to and thoughts about it are. The first

Re: set and dict iteration

2012-09-08 Thread Aaron Brady
On Monday, September 3, 2012 8:59:16 PM UTC-5, Steven D'Aprano wrote: On Mon, 03 Sep 2012 21:50:57 -0400, Dave Angel wrote: On 09/03/2012 09:26 PM, Steven D'Aprano wrote: An unsigned C int can count up to 4,294,967,295. I propose that you say that is enough iterators for

Re: set and dict iteration

2012-09-08 Thread Aaron Brady
On Thursday, August 23, 2012 1:11:14 PM UTC-5, Steven D'Aprano wrote: On Thu, 23 Aug 2012 09:49:41 -0700, Aaron Brady wrote: [...] The patch for the above is only 40-60 lines. However it introduces two new concepts. The first is a linked list, a classic dynamic data

Re: set and dict iteration

2012-09-03 Thread Aaron Brady
On Monday, September 3, 2012 2:30:24 PM UTC-5, Ian wrote: On Sun, Sep 2, 2012 at 11:43 AM, Aaron Brady castiro...@gmail.com wrote: We could use a Python long object for the version index to prevent overflow. Combined with P. Rubin's idea to count the number of open iterators, most use

Re: set and dict iteration

2012-09-03 Thread Aaron Brady
On Monday, September 3, 2012 3:28:28 PM UTC-5, Dave Angel wrote: On 09/03/2012 04:04 PM, Aaron Brady wrote: On Monday, September 3, 2012 2:30:24 PM UTC-5, Ian wrote: On Sun, Sep 2, 2012 at 11:43 AM, Aaron Brady castiro...@gmail.com wrote: We could use a Python long object

Re: set and dict iteration

2012-09-02 Thread Aaron Brady
On Monday, August 27, 2012 2:17:45 PM UTC-5, Ian wrote: On Thu, Aug 23, 2012 at 10:49 AM, Aaron Brady castiro...@gmail.com wrote: The patch for the above is only 40-60 lines. However it introduces two new concepts. Is there a link to the patch? Please see below. It grew somewhat

Re: Looking for an IPC solution

2012-09-01 Thread Aaron Brady
On Friday, August 31, 2012 2:22:00 PM UTC-5, Laszlo Nagy wrote: There are just so many IPC modules out there. I'm looking for a solution for developing a new a multi-tier application. The core application will be running on a single computer, so the IPC should be using shared memory

Re: set and dict iteration

2012-08-27 Thread Aaron Brady
On Thursday, August 23, 2012 1:11:14 PM UTC-5, Steven D'Aprano wrote: On Thu, 23 Aug 2012 09:49:41 -0700, Aaron Brady wrote: [...] The patch for the above is only 40-60 lines. However it introduces two new concepts. The first is a linked list, a classic dynamic data

Re: set and dict iteration

2012-08-23 Thread Aaron Brady
On Saturday, August 18, 2012 9:28:32 PM UTC-5, Aaron Brady wrote: On Saturday, August 18, 2012 5:14:05 PM UTC-5, MRAB wrote: On 18/08/2012 21:29, Aaron Brady wrote: On Friday, August 17, 2012 4:57:41 PM UTC-5, Chris Angelico wrote: On Sat, Aug 18, 2012 at 4:37 AM, Aaron Brady

Re: set and dict iteration

2012-08-18 Thread Aaron Brady
On Friday, August 17, 2012 4:57:41 PM UTC-5, Chris Angelico wrote: On Sat, Aug 18, 2012 at 4:37 AM, Aaron Brady castiro...@gmail.com wrote: Is there a problem with hacking on the Beta? Nope. Hack on the beta, then when the release arrives, rebase your work onto it. I doubt

Re: set and dict iteration

2012-08-18 Thread Aaron Brady
On Saturday, August 18, 2012 5:14:05 PM UTC-5, MRAB wrote: On 18/08/2012 21:29, Aaron Brady wrote: On Friday, August 17, 2012 4:57:41 PM UTC-5, Chris Angelico wrote: On Sat, Aug 18, 2012 at 4:37 AM, Aaron Brady castiro...@gmail.com wrote: Is there a problem with hacking

Re: set and dict iteration

2012-08-17 Thread Aaron Brady
On Thursday, August 16, 2012 6:07:40 PM UTC-5, Ian wrote: On Thu, Aug 16, 2012 at 4:55 PM, Ian Kelly ian.g.ke...@gmail.com wrote: On Thu, Aug 16, 2012 at 12:00 PM, Aaron Brady castiro...@gmail.com wrote: The inconsistency is, if we remove an element from a set and add another during

Re: set and dict iteration

2012-08-17 Thread Aaron Brady
On Thursday, August 16, 2012 8:01:39 PM UTC-5, Paul Rubin wrote: Ian Kelly ian.g.ke...@gmail.com writes: With regard to key insertion and deletion while iterating over a dict or set, though, there is just no good reason to be doing that (especially as the result is very

Re: set and dict iteration

2012-08-17 Thread Aaron Brady
On Thursday, August 16, 2012 9:30:42 PM UTC-5, Paul Rubin wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: Luckily, Python is open source. If anyone thinks that sets and dicts should include more code protecting against mutation-during-iteration, they are more

Re: set and dict iteration

2012-08-17 Thread Aaron Brady
On Thursday, August 16, 2012 9:24:44 PM UTC-5, Steven D'Aprano wrote: On Thu, 16 Aug 2012 19:11:19 -0400, Dave Angel wrote: On 08/16/2012 05:26 PM, Paul Rubin wrote: Dave Angel d...@davea.name writes: Everything else is implementation defined. Why should an implementation be

set and dict iteration

2012-08-16 Thread Aaron Brady
Hello, I observed an inconsistency in the behavior of 'set' and 'dict' iterators. It is by design according to the docs. ''' http://docs.python.org/dev/library/stdtypes.html#dict-views iter(dictview). Iterating views while adding or deleting entries in the dictionary may raise a

Re: persistent composites

2009-06-20 Thread Aaron Brady
On Jun 19, 7:00 am, Rhodri James rho...@wildebst.demon.co.uk wrote: On Fri, 19 Jun 2009 14:24:34 +0100, Aaron Brady castiro...@gmail.com   wrote: You are not being any help, Rhodri, in your question. To you, perhaps not.  To me, it has at least had the effect of making what you're trying

Re: Rich comparison methods don't work in sets?

2009-06-20 Thread Aaron Brady
On Jun 20, 9:27 am, MRAB pyt...@mrabarnett.plus.com wrote: Gustavo Narea wrote: Hello again, everybody. Thank you very much for your responses. You guessed right, I didn't use the __hash__ method (and I forgot to mention that, sorry). And unfortunately, I think I can't make them

Re: persistent composites

2009-06-19 Thread Aaron Brady
On Jun 17, 3:53 pm, Rhodri James rho...@wildebst.demon.co.uk wrote: On Wed, 17 Jun 2009 16:06:22 +0100, Aaron Brady castiro...@gmail.com   wrote: On Jun 16, 10:09 am, Mike Kazantsev mk.frag...@gmail.com wrote: On Tue, 16 Jun 2009 06:57:13 -0700 (PDT) Aaron Brady castiro...@gmail.com

Re: fastest native python database?

2009-06-19 Thread Aaron Brady
On Jun 17, 8:28 pm, per perfr...@gmail.com wrote: hi all, i'm looking for a native python package to run a very simple data base. i was originally using cpickle with dictionaries for my problem, but i was making dictionaries out of very large text files (around 1000MB in size) and pickling

Re: Rich comparison methods don't work in sets?

2009-06-19 Thread Aaron Brady
On Jun 19, 12:42 pm, Chris Rebert c...@rebertia.com wrote: On Fri, Jun 19, 2009 at 12:02 PM, Gustavo Naream...@gustavonarea.net wrote: Hello, everyone. I've noticed that if I have a class with so-called rich comparison methods (__eq__, __ne__, etc.), when its instances are included in a

Re: Exotic Logics

2009-06-19 Thread Aaron Brady
On Jun 17, 10:32 am, Aaron Brady castiro...@gmail.com wrote: On Jun 17, 10:23 am, Mensanator mensana...@aol.com wrote: snip I think high and low /voltages/, though continuous and approximate, might satisfy this. There are no such things as electrons, I've got a Tesla coil if you'd

Re: persistent composites

2009-06-19 Thread Aaron Brady
On Jun 19, 7:45 am, a...@pythoncraft.com (Aahz) wrote: In article be292347-1011-4bb6-b8e9-a5d738827...@u10g2000vbd.googlegroups.com, Aaron Brady  castiro...@gmail.com wrote: You are not being any help, Rhodri, in your question.   Maybe not, but honestly, you're getting pretty close

Re: Regarding Python is scripting language or not

2009-06-18 Thread Aaron Brady
On Jun 18, 6:07 am, Jochen Schulz m...@well-adjusted.de wrote: Terry Reedy: Jochen Schulz wrote: If, by object-oriented you mean everything has to be put into classes, then Python is not object-oriented. That depends on what you mean by 'put into classes' (and 'everything'). :) What

Re: persistent composites

2009-06-17 Thread Aaron Brady
On Jun 16, 10:09 am, Mike Kazantsev mk.frag...@gmail.com wrote: On Tue, 16 Jun 2009 06:57:13 -0700 (PDT) Aaron Brady castiro...@gmail.com wrote: Making the charitable interpretation that this was the extent of c-l- py's support and enthusiasm for my idea, I will now go into mourning

Re: Question about None

2009-06-17 Thread Aaron Brady
On Jun 17, 5:47 am, Bruno Desthuilliers bruno. 42.desthuilli...@websiteburo.invalid wrote: John Yeung a écrit : But mathematically speaking, it's intuitive that nothing would match any type. IOW, what's the OP is after is not the None type, but some yet unexisting Anything type !-) The

Re: Executing a python script while it is running

2009-06-17 Thread Aaron Brady
On Jun 16, 3:48 pm, Zach Hobesh hob...@gmail.com wrote: A lot more information would be useful.  What version of Python, and what operating system environment?  Exactly what would you like to happen when the batch file is invoked a second time? I'm running Python 2.6.2 on Windows.  I'm

Re: Exotic Logics

2009-06-17 Thread Aaron Brady
On Jun 17, 1:44 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: I was staring at a logic table the other day, and I asked myself, what if one wanted to play with exotic logics; how might one do it? This might be

Re: Exotic Logics

2009-06-17 Thread Aaron Brady
On Jun 17, 1:28 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: I was staring at a logic table the other day, and I asked myself, what if one wanted to play with exotic logics; how might one do it? First question:

Re: Exotic Logics

2009-06-17 Thread Aaron Brady
On Jun 17, 10:04 am, Aaron Brady castiro...@gmail.com wrote: snip You (OP) may be interested in the definitions of the fuzzy operators: and( x, y ) := min( x, y ) or( x, y ) := max( x, y ) not( x ) := 1 (one)- x nand( x, y ) := not( and( x, y ) ) = 1- min( x, y ) Defining 'xor' as '( x

Re: Exotic Logics

2009-06-17 Thread Aaron Brady
On Jun 17, 10:05 am, pdpi pdpinhe...@gmail.com wrote: On Jun 17, 5:37 pm, Lie Ryan lie.1...@gmail.com wrote: Steven D'Aprano wrote: On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: I was staring at a logic table the other day, and I asked myself, what if one wanted to

Re: Exotic Logics

2009-06-17 Thread Aaron Brady
On Jun 17, 10:23 am, Mensanator mensana...@aol.com wrote: On Jun 17, 11:59 am, Aaron Brady castiro...@gmail.com wrote: On Jun 17, 1:44 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Tue, 16 Jun 2009 22:46:14 -0700, William Clifford wrote: I was staring

Re: persistent composites

2009-06-16 Thread Aaron Brady
On Jun 15, 4:56 pm, Aaron Brady castiro...@gmail.com wrote: On Jun 15, 11:10 am, Paul Rubin http://phr...@nospam.invalid wrote: Aaron Brady castiro...@gmail.com writes: A real-world application of persistent data structures can be found here: http://stevekrenzel.com/persistent-list

Re: persistent composites

2009-06-15 Thread Aaron Brady
On Jun 15, 5:45 am, Diez B. Roggisch de...@nospam.web.de wrote: Aaron Brady wrote: Hi, please forgive the multi-posting on this general topic. Some time ago, I recommended a pursuit of keeping 'persistent composite' types on disk, to be read and updated at other times by other processes

Re: persistent composites

2009-06-15 Thread Aaron Brady
On Jun 14, 10:18 am, Jaime Fernandez del Rio jaime.f...@gmail.com wrote: On Sun, Jun 14, 2009 at 4:27 PM, Aaron Bradycastiro...@gmail.com wrote: Before I go and flesh out the entire interfaces for the provided types, does anyone have a use for it? A real-world application of persistent

Re: Question about None

2009-06-15 Thread Aaron Brady
On Jun 14, 9:50 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Sun, 14 Jun 2009 19:14:10 -0400, Terry Reedy wrote: Steven D'Aprano wrote: So-called vacuous truth. It's often useful to have all([]) return true, but it's not *always* useful -- there are reasonable cases

Re: persistent composites

2009-06-15 Thread Aaron Brady
On Jun 15, 8:37 am, a...@pythoncraft.com (Aahz) wrote: In article 79mtt7f1r480...@mid.uni-berlin.de, Diez B. Roggisch de...@nospam.web.de wrote: Aaron Brady wrote: Some time ago, I recommended a pursuit of keeping 'persistent composite' types on disk, to be read and updated at other times

Re: persistent composites

2009-06-15 Thread Aaron Brady
On Jun 15, 11:10 am, Paul Rubin http://phr...@nospam.invalid wrote: Aaron Brady castiro...@gmail.com writes: A real-world application of persistent data structures can be found here: http://stevekrenzel.com/persistent-list Jaime, thanks for the link.  I contacted its author. You might

Re: Different types of dicts with letter before the curly braces.

2009-06-14 Thread Aaron Brady
On Jun 14, 4:02 am, kindly kin...@gmail.com wrote: I am sure people have thought of this before, but I cant find where. I think that python should adapt a way of defining different types of mapping functions by proceeding a letter before the curly brackets. i.e   ordered = o{},  multidict =

Re: Different types of dicts with letter before the curly braces.

2009-06-14 Thread Aaron Brady
On Jun 14, 6:30 am, kindly kin...@gmail.com wrote: On Jun 14, 1:59 pm, Steven D'Aprano snip I am glad the ordered dict will be in 2.7 and 3.1. I was just imagining what would be the next step in definition of structures. New languages like clojure have adopted the dict as top level.  I

persistent composites

2009-06-14 Thread Aaron Brady
Hi, please forgive the multi-posting on this general topic. Some time ago, I recommended a pursuit of keeping 'persistent composite' types on disk, to be read and updated at other times by other processes. Databases provide this functionality, with the exception that field types in any given

Re: persistent composites

2009-06-14 Thread Aaron Brady
On Jun 14, 8:24 am, Steven D'Aprano st...@removethis.cybersource.com.au wrote: Aaron Brady wrote: Some time ago, I recommended a pursuit of keeping 'persistent composite' types on disk, to be read and updated at other times by other processes.  Databases provide this functionality

Re: Question about None

2009-06-14 Thread Aaron Brady
On Jun 14, 10:02 am, Arnaud Delobelle arno...@googlemail.com wrote: snip guilt, it doesn't mean they will be convicted.  There needs to be enough evidence to convince the jury.  So it would be something like: if sum(guilt_weight(e) for e in evidence) GUILT_THRESHOLD:    the defendant is

Re: Question about None

2009-06-14 Thread Aaron Brady
On Jun 14, 12:37 pm, Paul Rubin http://phr...@nospam.invalid wrote: Andre Engels andreeng...@gmail.com writes: snip type thingy. A car is a single car. Nothing is zero cars, which is not a car, just like two cars is not a car. That seems to confuse values with collections of them.  A car is

Re: can it be shorter?

2009-06-08 Thread Aaron Brady
On Jun 7, 6:13 pm, Paul Rubin http://phr...@nospam.invalid wrote: Aaron Brady castiro...@gmail.com writes: url+= { '/': '' }.get( url[ -1 ], '/' ) Shorter is always better. url = url.rstrip('/') + '/' I was joking. Sheesh. -- http://mail.python.org/mailman/listinfo/python-list

Re: can it be shorter?

2009-06-08 Thread Aaron Brady
On Jun 8, 9:50 am, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Aaron Brady wrote: Shorter is always better. url+= { '/': '' }.get( url[ -1 ], '/' ) Why bother with spaces or 3 letter-wide token, check this  :o) : x+={'/':''}.get(x[-1],'/') Apart from joking, the following

Re: can it be shorter?

2009-06-07 Thread Aaron Brady
On Jun 6, 8:07 am, tsangpo tsangpo.newsgr...@gmail.com wrote: I want to ensure that the url ends with a '/', now I have to do thisa like below. url = url + '' if url[-1] == '/' else '/' Is there a better way? url+= { '/': '' }.get( url[ -1 ], '/' ) Shorter is always better. --

Re: fastest way to test file for string?

2009-06-05 Thread Aaron Brady
On Jun 5, 5:50 am, kj no.em...@please.post wrote: Hi.  I need to implement, within a Python script, the same functionality as that of Unix's    grep -rl some_string some_directory I.e. find all the files under some_directory that contain the string some_string. snip The 'mmap.mmap' class

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

Re: hash and __eq__

2009-05-30 Thread Aaron Brady
On May 30, 12:11 pm, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Sat, 30 May 2009 11:20:47 -0700 (PDT), Aaron Brady castiro...@gmail.com 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 too

Re: try except inside exec

2009-05-29 Thread Aaron Brady
On May 29, 8:21 am, Michele Petrazzo michele.petra...@remove_me_unipex.it 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

Re: try except inside exec

2009-05-29 Thread Aaron Brady
On May 29, 9:55 am, Michele Petrazzo michele.petra...@remove_me_unipex.it wrote: Aaron Brady wrote: STR = class Globals:    err = 0 def a_funct():    try:       1/0    except ZeroDivisionError:       import traceback       Globals.err = traceback.format_exc() exec STR

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 the

Re: Adding a Par construct to Python?

2009-05-19 Thread Aaron Brady
On May 19, 11:20 pm, Paul Rubin http://phr...@nospam.invalid wrote: Steven D'Aprano ste...@remove.this.cybersource.com.au 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

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 st...@remove-this- cybersource.com.au 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 usual reasons such as code bloat

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 ste...@remove.this.cybersource.com.au 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

Re: Self function

2009-05-06 Thread Aaron Brady
On May 6, 2:23 am, Arnaud Delobelle arno...@googlemail.com wrote: On May 5, 10:20 pm, Aaron Brady castiro...@gmail.com wrote: def auto( f ):     def _inner( *ar, **kw ):         return f( _inner, *ar, **kw )     return _inner Quoting myself near the start of this thread: Here's

Re: Self function

2009-05-06 Thread Aaron Brady
On May 6, 6:49 am, Lie Ryan lie.1...@gmail.com 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

Re: object query assigned variable name?

2009-05-06 Thread Aaron Brady
On May 6, 12:56 am, John O'Hagan resea...@johnohagan.com wrote: On Tue, 5 May 2009, Sion Arrowsmith wrote: John O'Hagan  resea...@johnohagan.com wrote: I can see that it's tantalizing, though, because _somebody_ must know about the assignment; after all, we just executed it! Except we

Re: Self function

2009-05-05 Thread Aaron Brady
On May 5, 2:50 pm, Steve Howell showel...@yahoo.com wrote: On May 4, 11:08 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au 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

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

2009-05-05 Thread Aaron Brady
On May 5, 2:17 pm, George Oliver georgeolive...@gmail.com wrote: On May 5, 11:59 am, Dave Angel da...@ieee.org 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

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 try to the following variant to see if it's usable: def thisfunc(fun

Re: Why bool( object )?

2009-05-01 Thread Aaron Brady
On May 1, 4:30 am, Steven D'Aprano st...@remove-this- cybersource.com.au 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

Re: Multiprocessing Pool and functions with many arguments

2009-05-01 Thread Aaron Brady
On Apr 29, 1:01 pm, psaff...@googlemail.com 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

Re: Multiprocessing.Queue - I want to end.

2009-05-01 Thread Aaron Brady
On Apr 30, 3:49 pm, Luis Zarrabeitia ky...@uh.cu 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

Re: subprocess shared environments

2009-05-01 Thread Aaron Brady
On May 1, 12:09 am, Robert Dailey rcdai...@gmail.com 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

Re: Why bool( object )?

2009-04-29 Thread Aaron Brady
On Apr 28, 9:54 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au 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 0

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 csw...@gmail.com 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

Why bool( object )?

2009-04-28 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 lie.1...@gmail.com 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() returns False

Re: Why bool( object )?

2009-04-28 Thread Aaron Brady
On Apr 28, 2:39 am, Steven D'Aprano ste...@remove.this.cybersource.com.au 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

Re: suggestion on a complicated inter-process communication

2009-04-27 Thread Aaron Brady
On Apr 27, 10:59 pm, Way csw...@gmail.com 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 gunterhenrik...@gmail.com 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

Re: relation class

2009-04-26 Thread Aaron Brady
On Apr 24, 1:18 am, Aaron Brady castiro...@gmail.com wrote: On Apr 22, 11:34 pm, Aaron Brady castiro...@gmail.com wrote: On Apr 22, 11:52 am, Aaron Brady castiro...@gmail.com wrote: On Apr 22, 12:09 am, Chris Rebert c...@rebertia.com 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 scott.dani...@acm.org 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

Re: relation class

2009-04-24 Thread Aaron Brady
On Apr 22, 11:34 pm, Aaron Brady castiro...@gmail.com wrote: On Apr 22, 11:52 am, Aaron Brady castiro...@gmail.com wrote: On Apr 22, 12:09 am, Chris Rebert c...@rebertia.com wrote: On Tue, Apr 21, 2009 at 5:51 PM, Aaron Brady castiro...@gmail.com wrote: Hi all, I think Python

Re: relation class

2009-04-22 Thread Aaron Brady
On Apr 22, 12:09 am, Chris Rebert c...@rebertia.com wrote: On Tue, Apr 21, 2009 at 5:51 PM, Aaron Brady castiro...@gmail.com wrote: Hi all, I think Python should have a relation class in the standard library. Fat chance. Perhaps I'm not understanding relation correctly, but are you

Re: relation class

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

Re: generating random tuples in python

2009-04-21 Thread Aaron Brady
On Apr 20, 11:04 pm, per perfr...@gmail.com wrote: On Apr 20, 11:08 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au 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,

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 rahul03...@gmail.com 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

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 m...@microcorp.co.za wrote:  Aaron Brady casti.@gmail.com wrote: On Apr 18, 4:44 am, Hendrik van Rooyen m...@microcorp.co.za wrote: to untangle some spaghetti code. He did not mention if the spaghetti was actually doing it's job, bug free, which

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 m...@microcorp.co.za wrote: baykus b..@gmail.com 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

Re: python alternatives to C structs??

2009-04-18 Thread Aaron Brady
On Apr 18, 2:25 pm, KoolD sourya...@gmail.com 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;

Re: Overriding methods per-object

2009-04-18 Thread Aaron Brady
On Apr 17, 9:41 pm, Steven D'Aprano st...@remove-this- cybersource.com.au 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()

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. What I

Re: Man Bites Python

2009-04-17 Thread Aaron Brady
On Apr 17, 3:33 am, Vito De Tullio zak.mc.kra...@libero.it 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. --

Re: Accessing a parse tree

2009-04-17 Thread Aaron Brady
On Apr 17, 4:03 am, Clarendon jine...@hotmail.com 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

Re: Accessing a parse tree

2009-04-17 Thread Aaron Brady
On Apr 17, 8:22 am, John Machin sjmac...@lexicon.net 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...

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 programm not until

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 castiro...@gmail.com 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 yourself

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 castiro...@gmail.com wrote: 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

Re: Help improve program for parsing simple rules

2009-04-17 Thread Aaron Brady
On Apr 17, 12:15 pm, Paul McGuire pt...@austin.rr.com wrote: On Apr 17, 10:43 am, John Machin sjmac...@lexicon.net 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

Re: Lambda alternative?

2009-04-17 Thread Aaron Brady
On Apr 17, 1:43 pm, J. Cliff Dyer j...@sdf.lonestar.org wrote: On Thu, 2009-04-16 at 13:33 +0200, Hrvoje Niksic wrote: mousemeat mousem...@gmail.com 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:

Re: Help improve program for parsing simple rules

2009-04-17 Thread Aaron Brady
On Apr 17, 2:01 pm, Paul McGuire pt...@austin.rr.com wrote: On Apr 17, 1:26 pm, Aaron Brady castiro...@gmail.com 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 called my

Re: Man Bites Python

2009-04-17 Thread Aaron Brady
On Apr 17, 7:03 pm, AD. anton.l...@gmail.com wrote: On Apr 17, 11:11 pm, Aaron Brady castiro...@gmail.com 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 Python a mutable type? Just don't

  1   2   3   4   5   6   >