Re: subprocess.Popen inheriting

2008-12-20 Thread Aaron Brady
On Dec 20, 7:06 pm, Aaron Brady wrote: > On Dec 18, 7:21 pm, "Gabriel Genellina" > wrote: > > > > > En Thu, 18 Dec 2008 19:46:45 -0200, Aaron Brady   > > escribió: > snip > > > Will it take calling > > > 'CreatePipe' fr

Re: trapping all method calls in a class...

2008-12-21 Thread Aaron Brady
On Dec 21, 1:32 am, "Chris Rebert" wrote: > On Sat, Dec 20, 2008 at 11:12 PM, Piyush Anonymous > > wrote: > > hi, > > i need to trap all method calls in a class in order to update a counter > > which is increased whenever a method is called and decreased whenever method > > returns. in order to t

Re: How to transfer data structure or class from Python to C/C++?

2008-12-21 Thread Aaron Brady
a data > structure 'Tdemo' to this function. After some process in Python, I > want it return 'Tdemo1' back to the C/C++ application. snip This is a correction of: Oct 17, 5:03 pm, "Aaron \"Castironpi\" Brady" http://groups.google.com/group/comp.lang.py

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 20, 8:26 pm, Steven D'Aprano wrote: > On Sat, 20 Dec 2008 17:55:35 -0800, Aaron Brady wrote: snip > > This behavior is currently legal: > > >>>> "%i %%i" % 0 % 1 > > '0 1' > > > So, just extend it.  (Unproduced.) >

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 20, 8:49 pm, MRAB wrote: > Aaron Brady wrote: > > On Dec 20, 7:38 pm, Steven D'Aprano > cybersource.com.au> wrote: > >> Instead of just whinging, how about making a suggestion to fix it? Go on, > >> sit down for an hour or ten and try to work out h

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 21, 7:34 am, Marc 'BlackJack' Rintsch wrote: > On Sun, 21 Dec 2008 12:45:32 +, Duncan Booth wrote: > > You seem to have made an unwarranted assumption, namely that a binary > > operator has to compile to a function with two operands. There is no > > particular reason why this has to alw

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 21, 8:50 am, Steve Holden wrote: > r wrote: snip > > This all really comes down to the new python users. Yea, i said it. > > Not rabid fanboys like Steven and myself.(i can't speak for walter but > > i think he would agree) Are we going to make sure joe-blow python > > newbie likes the lang

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 21, 10:31 am, MRAB wrote: > Aaron Brady wrote: > > On Dec 20, 8:49 pm, MRAB wrote: > >> Aaron Brady wrote: > >>> On Dec 20, 7:38 pm, Steven D'Aprano >>> cybersource.com.au> wrote: > >>>> Instead of just whinging, how about mak

Re: Are python objects thread-safe?

2008-12-21 Thread Aaron Brady
On Dec 21, 12:51 pm, RajNewbie wrote: > Say, I have two threads, updating the same dictionary object - but for > different parameters: > Please find an example below: > a = {file1Data : '', >        file2Data : ''} > > Now, I send it to two different threads, both of which are looping > infinitely

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 21, 10:58 am, MRAB wrote: > Aaron Brady wrote: > > On Dec 21, 10:31 am, MRAB wrote: snip > >> The original format is a string. The result of '%' is a string if > >> there's only 1 placeholder to fill, or a (partial) format object (class > >

Re: New Python 3.0 string formatting - really necessary?

2008-12-21 Thread Aaron Brady
On Dec 21, 6:14 pm, MRAB wrote: > Aaron Brady wrote: > > On Dec 21, 10:58 am, MRAB wrote: > >> Aaron Brady wrote: > >>> On Dec 21, 10:31 am, MRAB wrote: > > snip > >>>> The original format is a string. The result of '%' is a strin

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Aaron Brady
On Dec 21, 8:42 pm, MRAB wrote: > Aaron Brady wrote: > > On Dec 21, 6:14 pm, MRAB wrote: snip > >> Yes, I suggested that earlier, but it isn't needed because you can > >> create a format object with "Format(string)". However, most of the time >

iterating initalizations

2008-12-22 Thread Aaron Stepp
index = index.append(rhythm.rhythmTwist(b, c)) This doesn't do what I expect (probably because I don't have a clue what I'm doing!): initalizing, then filling new arrays, each new one called A[ ], then B[ ], etc. This seems very un-pythonic, and I'm sure there is a right

Re: Are python objects thread-safe?

2008-12-22 Thread Aaron Brady
On Dec 22, 2:59 am, Duncan Booth wrote: > RajNewbie wrote: > > Say, I have two threads, updating the same dictionary object - but for > > different parameters: > > Please find an example below: > > a = {file1Data : '', > >        file2Data : ''} > > > Now, I send it to two different threads, both

Re: New Python 3.0 string formatting - really necessary?

2008-12-22 Thread Aaron Brady
On Dec 22, 11:40 am, r wrote: > On Dec 22, 8:58 am, walterbyrd wrote: > > > > > On Dec 21, 12:28 pm, Bruno Desthuilliers > > > wrote: > > > Strange enough, > > > no one seems to complain about PHP or Ruby's performances... > > > A few years back, there was a certain amount of chest thumping, whe

Re: Python's popularity

2008-12-22 Thread Aaron Brady
On Dec 22, 4:07 pm, r wrote: > On Dec 22, 3:15 pm, je.s.t...@hehxduhmp.org wrote: > > > r wrote: > > > We see where you stand. And also see that by removing your comments > > > from the archive in 5 days, how small your acorns really are. > > > Also, it is pretty hard to take such accusations ser

Re: iterating initalizations

2008-12-22 Thread Aaron Stepp
On Dec 22, 2008, at 10:15 PM, r wrote: I can't check you code because i don't have these modules but here is the code with proper indention import random from rtcmix import * from chimes_source import * from rhythmblock import * from pitchblock import * indexrand = random.Random() indexrand.se

Re: iterating initalizations

2008-12-22 Thread Aaron Stepp
On Dec 22, 2008, at 10:43 PM, Chris Rebert wrote: On Mon, Dec 22, 2008 at 7:32 PM, Aaron Stepp wrote: Thanks for the help so far, I think I'm starting to get a hang of the syntax. I think I need to state my goal more clearly. Instead of writing a long list of initializations li

Re: Python's popularity

2008-12-23 Thread Aaron Brady
On Dec 23, 2:33 am, "Hendrik van Rooyen" wrote: > "r" wrote: > >Now thats the kind of friendly banter this group could use. Instead of > >people acting as if their bowel-movements smell like bakery fresh > >cinnamon rolls! > > What an amazing thing to say! > > Doesn't yours? > > - Hendrik You th

Re: Very basic question

2008-12-23 Thread Aaron Brady
On Dec 23, 4:46 am, Sengly wrote: > Hello all, > > I would like to calculate a string expression to a float. For example, > I have ('12/5') and I want 2.4 as a result. I tried to use eval but it > only gives me 2 instead of 2.5 > > Help!!! > > Regards, > > Sengly >>> float('12')/float('5') 2.3999

Re: wxPython.button.disabled still catching clicks

2008-12-23 Thread Aaron Brady
On Dec 23, 4:50 am, mynthon wrote: > Hello! (sorry for my english) > > I have a problem with buttons in wxPython. When button is disabled > (by .Disable() or .Enable(False)) it is grayed out but still receive > clicks. > > Eg. i have button that disable itself, runs long action and enable > itself

Re: iterating initalizations

2008-12-23 Thread Aaron Stepp
arguments are being passed as zeros! I assume this has to do with WHEN I'm referencing self.__A and self.__B? AS On Dec 23, 2008, at 10:20 AM, Steve Holden wrote: D'Arcy J.M. Cain wrote: On Mon, 22 Dec 2008 22:32:17 -0500 Aaron Stepp wrote: Instead of writing a long list of initi

Re: On Whose Desktop

2008-12-23 Thread Aaron Brady
On Dec 23, 8:19 am, Steve Holden wrote: > Fuzzyman wrote: > > On Dec 23, 12:06 pm, Steve Holden wrote: > >> Thanks to Barry Warsaw the "On Your Desktop" blog now has a new entry: > > >>  http://onyourdesktop.blogspot.com/ > > >> Who would you like to see profiled next? > > > Guido (of course), Br

Re: Are python objects thread-safe?

2008-12-23 Thread Aaron Brady
On Dec 23, 7:30 am, Duncan Booth wrote: > Aaron Brady wrote: > > Th.1   Th.2 > > a=X > >        a=Y > > a=Z > > > You are saying that if 'a=Z' interrupts 'a=Y' at the wrong time, the > > destructor for 'X' or 'Y' m

Re: ctypes & strings

2008-12-27 Thread Aaron Brady
On Dec 27, 2:03 pm, "Gabriel Genellina" wrote: > En Sat, 27 Dec 2008 10:54:32 -0200, Hendrik van Rooyen   > escribió: > > > The c routine will actually break Python's normal string > > immmutability and give you back a changed ins. > > ...so don't do that! > If you require a mutable string to pas

Re: game engine (as in rules not graphics)

2008-12-27 Thread Aaron Brady
On Dec 27, 3:02 pm, Martin wrote: > Hello, > > I'd like to get in touch with game development a bit. I'm not talking > about graphics but rather the game rules itself. Something > likehttp://en.wikipedia.org/wiki/Monopoly_(game)#Rules, is there even a > general approach to that or should I just g

Re: C API: array of floats/ints from python to C and back

2008-12-27 Thread Aaron Brady
On Dec 27, 6:06 pm, Scott David Daniels wrote: > Daniel Fetchinson wrote: > > I have a list to begin with which will be passed to the C function. > >  > I assume converting the list to an array.array and passing that to the C > > > function doesn't make any difference in terms of speed since t

Re: "return" in def

2008-12-29 Thread Aaron Brady
On Dec 28, 11:56 am, Gerard Flanagan wrote: > On Dec 28, 5:19 pm, Roger wrote: > > > Hi Everyone, > [...] > > When I define a method I always include a return statement out of > > habit even if I don't return anything explicitly: > > > def something(): > >         # do something > >         retur

Re: Get a list of functions in a file

2008-12-29 Thread Aaron Brady
On Dec 29, 3:50 am, "Chris Rebert" wrote: > On Sun, Dec 28, 2008 at 11:26 PM, member Basu wrote: > > I'm putting some utility functions in a file and then building a simple > > shell interface to them. Is their some way I can automatically get a list of > > all the functions in the file? I could

Re: Read-Write Lock vs primitive Lock()

2008-12-29 Thread Aaron Brady
On Dec 29, 4:17 am, k3xji wrote: > On 29 Aralýk, 11:52, "Gabriel Genellina" > wrote: > > > En Mon, 29 Dec 2008 05:56:10 -0200, k3xji escribió: > snip > > > class wthread(threading.Thread): > > >     def run(self): > > >             try: > > >                 #GLOBAL_LOCK.acquireWrite() > > >    

Re: poblem regarding opening a html file

2008-12-29 Thread Aaron Brady
On Dec 29, 6:10 am, "Hendrik van Rooyen" wrote: > Sibtey Mehdi  wrote: > >Hi > >            I have a GUI application (wxpython) that calls another GUI > > Application. I m using os.system (cmd) >to launch>The second GUI, in the > second GUI I m trying to open the html file using the > > os.startf

Re: game engine (as in rules not graphics)

2008-12-29 Thread Aaron Brady
; > Programming Associates. > > From: Aaron Brady [mailto:castiro...@gmail.com] > > Sent: Sunday, 28 December 2008 1:22 p.m. > > Not my expertise but here are my $0.02.  You are looking for ways to > > represent rules: buying a house is legal in such and such situati

Re: multiprocessing vs thread performance

2008-12-29 Thread Aaron Brady
On Dec 29, 8:52 am, mk wrote: > Hello everyone, > > After readinghttp://www.python.org/dev/peps/pep-0371/I was under > impression that performance of multiprocessing package is similar to > that of thread / threading. However, to familiarize myself with both > packages I wrote my own test of spawn

Re: why cannot assign to function call

2008-12-29 Thread Aaron Brady
On Dec 29, 12:01 am, scsoce wrote: > I have a function return a reference, and want to assign to the > reference, simply like this: >  >>def f(a) >           return a >      b = 0 >     * f( b ) = 1* > but the last line will be refused as "can't assign to function call". > In my thought , the assi

Re: HTML Correctness and Validators

2008-12-29 Thread Aaron Gray
onsideration on the correctness >of the doc they produces. > >HTML Correctness and Validators >. http://xahlee.org/js/html_correctness.html Do you enjoy spamming comp.lang.functional with OT cross-posts ? Regards, Aaron -- http://mail.python.org/mailman/listinfo/python-list

SQL, lite lite lite

2008-12-29 Thread Aaron Brady
Hi all, About a year ago, I posted an idea I was having about thread synchronization to the newsgroup. However, I did not explain it well, and I really erred on the side of brevity. (After some finagling, Mr. Bieber and I decided it wasn't exactly anything groundbreaking.) But I think the brevi

Re: why cannot assign to function call

2008-12-29 Thread Aaron Brady
On Dec 29, 1:05 pm, Scott David Daniels wrote: > John Machin wrote: > > On Dec 29, 5:01 pm, scsoce wrote: > >> I have a function return a reference, > > > Stop right there. You don't have (and can't have, in Python) a > > function which returns a reference that acts like a pointer in C or C+ > >

Re: multiprocessing vs thread performance

2008-12-29 Thread Aaron Brady
On Dec 29, 6:05 pm, "James Mills" wrote: > On Tue, Dec 30, 2008 at 12:52 AM, mk wrote: > > Hello everyone, > > > After readinghttp://www.python.org/dev/peps/pep-0371/I was under > > impression that performance of multiprocessing package is similar to that of > > thread / threading. However, to fa

Re: why cannot assign to function call

2008-12-29 Thread Aaron Brady
On Dec 29, 6:06 pm, Miles wrote: > On Mon, Dec 29, 2008 at 1:01 AM, scsoce wrote: > > I have a function return a reference, and want to assign to the reference, > > simply like this: > >>>def f(a) > >         return a > >    b = 0 > >   * f( b ) = 1* > > but the last line will be refused as "can'

Re: "return" in def

2008-12-29 Thread Aaron Brady
On Dec 29, 7:00 pm, Steven D'Aprano wrote: > On Mon, 29 Dec 2008 05:31:17 -0800, Aaron Brady wrote: > > One style of coding I heard about once only permits returns at the end > > of a function.  It claims it makes it easier to see the function as a > > mathematical obj

Re: get method

2008-12-29 Thread Aaron Brady
On Dec 29, 8:02 pm, Steven D'Aprano wrote: > On Mon, 29 Dec 2008 17:38:36 -0800, Ross wrote: > > On Dec 29, 8:07 pm, Scott David Daniels wrote: > >> Ross wrote: > >> > ... Use get to write histogram more concisely. You should be able to > >> > eliminate the if statement. > > >> > def histogram(s)

Re: multiprocessing vs thread performance

2008-12-29 Thread Aaron Brady
On Dec 29, 7:40 pm, "James Mills" wrote: > On Tue, Dec 30, 2008 at 11:34 AM, Aaron Brady wrote: > > The OP may be interested in Erlang, which Wikipedia (end-all, be-all) > > claims is a 'distribution oriented language'. snip > I'm presently looking a

Re: multiprocessing vs thread performance

2008-12-30 Thread Aaron Brady
On Dec 29, 9:08 pm, "James Mills" wrote: > On Tue, Dec 30, 2008 at 12:52 PM, Aaron Brady wrote: > > On Dec 29, 7:40 pm, "James Mills" > > wrote: > >> On Tue, Dec 30, 2008 at 11:34 AM, Aaron Brady wrote: > >> > The OP may be interested in

Re: why cannot assign to function call

2008-12-30 Thread Aaron Brady
On Dec 30, 8:21 am, John O'Hagan wrote: > On Tue, 30 Dec 2008, Aaron Brady wrote: > > [...] > > > On a technicality, to avert a flaming, "change the value of 'b'" is an > > ambiguous phrase. There are two interpretations of "change what '

Re: thread, multiprocessing: communication overhead

2008-12-30 Thread Aaron Brady
On Dec 30, 9:46 am, mk wrote: > Hello everyone, > > This time I decided to test communication overhead in multithreaded / > multiprocess communication. The results are rather disappointing, that > is, communication overhead seems to be very high. In each of the > following functions, I send 10,000

Re: SQL, lite lite lite

2008-12-30 Thread Aaron Brady
On Dec 30, 11:16 am, prueba...@latinmail.com wrote: > On Dec 29, 1:06 pm, Aaron Brady wrote: snip > > My idea is to create a 'Relation' class.  The details are basically > > open, such as whether to back it with 'sqllite3', 'shelve', 'mmap&#x

Re: multiprocessing vs thread performance

2008-12-31 Thread Aaron Brady
On Dec 29, 9:29 am, mk wrote: > Christian Heimes wrote: > > mk wrote: > >> Am I doing smth wrong in code below? Or do I have to use > >> multiprocessing.Pool to get any decent results? > > > You have missed an important point. A well designed application does > > neither create so many threads nor

Re: greenlets and how they can be used

2008-12-31 Thread Aaron Brady
On Dec 30, 9:40 pm, "James Mills" wrote: > Hey all, > > The "greenlet" fromhttp://codespeak.net/py/dist/greenlet.html > is a rather interesting way of handling flow of control. > > I can't seem to find anything else on the subject > except for the above link and the most recent version > 0.2 and i

Re: Easy-to-use Python GUI

2008-12-31 Thread Aaron Brady
On Dec 29, 5:49 pm, "Joel Koltner" wrote: > Thanks to everyone who responded; I'll be checking out the various toolkits > people have listed! > > ---Joel There is wxFormBuilder, which stores a GUI design in XML format. It may be lengthy, but your data reside in a data structure, and your program

Re: Pass by reference

2008-12-31 Thread Aaron Brady
On Dec 31, 5:30 am, iu2 wrote: > Hi, > > Is it possible somehow to change a varible by passing it to a > function? > > I tried this: > > def change_var(dict0, varname, val): >   dict0[varname] = val > > def test(): >   a = 100 >   change_var(locals(), 'a', 3) >   print a > > But test() didn't work

Re: SQL, lite lite lite

2008-12-31 Thread Aaron Brady
On Dec 30, 2:52 pm, Bruno Desthuilliers wrote: > Aaron Brady a écrit : > > > On Dec 30, 11:16 am, prueba...@latinmail.com wrote: > (snip) > >> You really do like to reinvent the wheels do you? :-) Nothing wrong > >> with that. Just be aware that most people t

Re: why cannot assign to function call

2008-12-31 Thread Aaron Brady
On Dec 31, 1:39 am, Tim Roberts wrote: > Aaron Brady wrote: > > >I think the problem goes deeper than just English.  In any language > >that has a plural, the propositions in question come out as, 'one > >thing is two things' or 'two things are one thing&#

Re: multiprocessing vs thread performance

2008-12-31 Thread Aaron Brady
On Dec 31, 6:19 pm, Paul Rubin <http://phr...@nospam.invalid> wrote: > Aaron Brady writes: > > I had an idea.  You could use 'multiprocessing' for synchronization, > > and just use an mmap for the actual communication.  (I think it's a > > good i

Re: game engine (as in rules not graphics)

2009-01-01 Thread Aaron Brady
On Dec 29 2008, 8:52 am, Aaron Brady wrote: > On Dec 29, 4:14 am, Martin wrote: > > > Hi, > > > 2008/12/29 Phil Runciman : > > > > See: Chris Moss, Prolog++: The Power of Object-Oriented and Logic > > > Programming (ISBN 0201565072) > > > &

Re: SQL, lite lite lite

2009-01-01 Thread Aaron Brady
On Jan 1, 7:43 am, Bruno Desthuilliers wrote: > Aaron Brady a écrit : > > > > > On Dec 30, 2:52 pm, Bruno Desthuilliers > > wrote: > >> Aaron Brady a écrit : > > >>> On Dec 30, 11:16 am, prueba...@latinmail.com wrote: > >> (snip

Re: If your were going to program a game...

2009-01-01 Thread Aaron Brady
On Jan 1, 2:55 pm, "Chris Rebert" wrote: > On Thu, Jan 1, 2009 at 12:24 PM, excord80 wrote: > > On Jan 1, 2:37 pm, Kay Schluehr wrote: > > >> There is no solution to this problem from a Python perspective. Do > >> what everyone does right now: [snip] > > > It still surprises me that no one has i

Re: Testing if an index is in a slice

2009-01-01 Thread Aaron Brady
On Jan 1, 12:12 pm, mma...@gmx.net wrote: > Hi > > I would like to check if an index is in a slice or not without > iterating over the slice. > > Something like: > > >>> isinslice(36, slice(None, 34, -1)) > > True > > I would like to use the batteries if possible. > However, I looked in the docs, p

Re: Is there a better algorithm?

2009-01-02 Thread Aaron Brady
On Jan 2, 12:11 pm, Kottiyath wrote: > I have the following list of tuples: > L = [(1, 2), (3, 4, 5), (6, 7)] > > I want to loop through the list and extract the values. > The only algorithm I could think of is:>>> for i in l: > > ...  u = None > ...  try: > ...   (k, v) = i > ...  except ValueErr

Re: why cannot assign to function call

2009-01-03 Thread Aaron Brady
On Jan 3, 11:25 am, John O'Hagan wrote: > On Tue, 30th Dec 2008, Aaron Brady wrote: > >Accepting that, I'll adopt the terms John proposed, 'change' vs. > >'exchange', the former when the material configuration changes, the > >latter when the comm

Re: why cannot assign to function call

2009-01-05 Thread Aaron Brady
On Jan 4, 1:28 am, Steven D'Aprano wrote: > I'm answering both John and Aaron's comments in the following. Mostly > John at the start, Aaron toward the end. > > On Sat, 03 Jan 2009 15:42:47 -0800, Aaron Brady wrote: > > On Jan 3, 11:25 am, John O'Hagan wrote

Re: why cannot assign to function call

2009-01-06 Thread Aaron Brady
On Jan 6, 8:03 am, Mark Wooding wrote: > Steven D'Aprano wrote: snip > > It seems that you don't include in the Python community all those who > > use the term "name binding" instead of variable assignment > > specifically because it gives new users a clue that Python is not the > > same as C. >

Re: formatted 'time' data in calculations

2009-01-07 Thread Aaron Hill
time2 = time1 time1 = '' elif x == '\n': self.hours = self.hours + abs(((float(time2)-float(time1))/60)/60) time2 = '' time1 = '' self.total.SetValue('%2f' % self.hours) [/code] Oops wrong person, sorry about that. This time it should go to the mailing list Aaron Hill -- http://mail.python.org/mailman/listinfo/python-list

Re: mmap only supports string

2009-01-08 Thread Aaron Brady
On Jan 7, 8:14 pm, Neal Becker wrote: > Problem is, AFAIK a string can only be created as a copy of some other data.   > Say I'd like to take some large object and read/write to/from mmap object.  A > good way to do this would be the buffer protocol.  Unfortunately, mmap only > supports string.

Re: why cannot assign to function call

2009-01-08 Thread Aaron Brady
On Jan 8, 1:45 am, Steven D'Aprano wrote: > On Wed, 07 Jan 2009 10:17:55 +, Mark Wooding wrote: snip > > The `they're just objects' model is very simple, but gets tied up in > > knots explaining things.  The `it's all references' model is only a > > little more complicated, but explains everyt

Re: why cannot assign to function call

2009-01-09 Thread Aaron Brady
On Jan 9, 4:01 am, Steven D'Aprano wrote: > On Thu, 08 Jan 2009 18:33:50 +, Mark Wooding wrote: > > [Steven's message hasn't reached my server, so I'll reply to it here. > > Sorry if this is confusing.] > > > Aaron Brady wrote: > >> On J

Re: loops

2008-10-18 Thread Aaron Brady
Gandalf wrote: > On Oct 18, 12:39 pm, Duncan Booth <[EMAIL PROTECTED]> > wrote: >> Gandalf <[EMAIL PROTECTED]> wrote: >> > how can I do width python a normal for loop width tree conditions like >> > for example : >> >> > for x=1;x<=100;x+x: >> >     print x >> >> What you wrote would appear to be

Re: Help with Iteration

2008-10-18 Thread Aaron Brady
Chris McComas wrote: > actually i'm running it online, with a mysql db. so in the db there is > a table CollegeYear with the following fields: > > name > rating > change > wp > > then another table Games > > date > year > team_1 > team_1_score > team_2 > team_2_score > > it goes through and calcula

Re: Interoperating with C

2008-10-18 Thread Aaron Brady
Michele wrote: > Hi there, > I would like to call C functions in a Python program, passing > user-defined objects and primitive python types (str, ints, etc.); of > course I also want to receive data from these functions, manipulating it > in my python program. > First of all: is this possible? >

Re: default value in __init__

2008-10-18 Thread Aaron Brady
Steven D'Aprano wrote: > On Sat, 18 Oct 2008 09:17:28 +1300, Lawrence D'Oliveiro wrote: > >> In message >> <[EMAIL PROTECTED]>, >> Aaron "Castironpi" Brady wrote: >> >>> The purpose of a parameter is something that the caller can

Re: Help with Iteration

2008-10-18 Thread Aaron Brady
Chris McComas wrote: > On Oct 18, 3:46 pm, Aaron Brady <[EMAIL PROTECTED]> wrote: >> Chris McComas wrote: >> > actually i'm running it online, with a mysql db. so in the db there is >> > a table CollegeYear with the following fields: >> >> &

Re: memory use with regard to large pickle files

2008-10-18 Thread Aaron Brady
Catherine Moroney wrote: > I'm writing a python program that reads in a very large > "pickled" file (consisting of one large dictionary and one > small one), and parses the results out to several binary and hdf > files. > > The program works fine, but the memory load is huge. The size of > the pi

Re: default value in __init__

2008-10-19 Thread Aaron Brady
Steven D'Aprano wrote: > On Sun, 19 Oct 2008 02:52:52 +0000, Aaron Brady wrote: > >> Steven D'Aprano wrote: >> >>> On Sat, 18 Oct 2008 09:17:28 +1300, Lawrence D'Oliveiro wrote: >>> >>>> In message >>>> <[EMAIL

Re: xor: how come so slow?

2008-10-19 Thread Aaron Brady
Steven D'Aprano wrote: > On Sun, 19 Oct 2008 04:38:04 +, Tim Roberts wrote: > >> Steven D'Aprano <[EMAIL PROTECTED]> wrote: >>> >>>On Fri, 17 Oct 2008 20:51:37 +1300, Lawrence D'Oliveiro wrote: >>> Is piece really meant to be random? If so, your create_random_block function isn't ach

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-19 Thread Aaron Brady
Duncan Booth wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >> In Linux, config files should go into: >> >> ~/./ or /etc// >> >> In Windows (which versions?) then should go into the Documents And >> Settings folder, where ever that is. >> >> There's no single string which can represent

Re: Help with Iteration

2008-10-19 Thread Aaron Brady
Hendrik van Rooyen wrote: > Aaron Brady wrote: > >>while 1: >>calculate_stuff( ) >>if stuff < 0.5: >>break > > The thought police will come and get you. > > You are doing things by "side effect"! > You are using a glo

Re: Help with Iteration

2008-10-19 Thread Aaron Brady
On Oct 19, 12:27 pm, "Eric Wertman" <[EMAIL PROTECTED]> wrote: > >> Aaron Brady wrote: > > >>> while 1: > >>>    calculate_stuff( ) > >>>    if stuff < 0.5: > >>>        break > > >> The thought police

Re: Help with Iteration

2008-10-19 Thread Aaron Brady
On Oct 19, 8:47 pm, Asun Friere <[EMAIL PROTECTED]> wrote: > On Oct 20, 6:10 am, Aaron Brady <[EMAIL PROTECTED]> wrote: > > [snip] > > > If customers are stupid, should you sell stupid software? > > That's a hypothetical question with which we need

Re: Python equivalent for C module

2008-10-20 Thread Aaron Brady
On Oct 20, 12:19 pm, Derek Martin <[EMAIL PROTECTED]> wrote: snip > > I'm specifically trying to avoid having to create a debug object and > pass it around... All modules should have visibility into the state of > whether DEBUG is turned on or off, and be able to use dprint().  Can > Python do this

Re: Mail reader & spam

2008-10-20 Thread Aaron Brady
On Oct 13, 2:19 pm, Cousin Stanley <[EMAIL PROTECTED]> wrote: > > I'm hesitating to change news readers > > > >   You might try the python-based  XPN  news client at > >      http://xpn.altervista.org/index-en.html > >   I've used it for the past few years >   and like it very much .

Re: Python equivalent for C module

2008-10-20 Thread Aaron Brady
On Oct 20, 3:08 pm, [EMAIL PROTECTED] (Ville M. Vainio) wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > > STDOUT is for *normal* program outputs. Debug informations, > > warnings, and all verbosity should go to STDERR. > > Actually, stderr is for errors, by convention. It's rather impoli

What was that, what was it?

2008-10-20 Thread Aaron Brady
The bartender said I have to talk. Actually, she didn't. Python's a darned good comp. language. Versatile, elegant, refined. The Pythoneers on the newsgroup are half-way decent, too. Attentive, judicious. I feel like there's a "but", but that's probably my own traumatic past personal life. B

Re: How to transfer data structure or class from Python to C/C++?

2008-10-21 Thread Aaron Brady
On Oct 21, 12:46 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 17 Oct 2008 20:03:44 -0300, Aaron "Castironpi" Brady   > <[EMAIL PROTECTED]> escribió: > > > > > On Oct 16, 9:10 am, Hongtian <[EMAIL PROTECTED]> wrote: > &g

Re: importing a class thru a variable?

2008-10-21 Thread Aaron Brady
On Oct 21, 6:07 pm, john <[EMAIL PROTECTED]> wrote: > Hi, > This is probably a question of questionable sanity, due to the fact I A question of questionable? Unacceptable. None of those, please. Yes, __import__ will do dynamics. Check your terminology. 'arguments that get passed to the class'

Re: Building truth tables

2008-10-25 Thread Aaron Brady
On Oct 24, 5:53 am, andrea <[EMAIL PROTECTED]> wrote: > On 26 Set, 20:01, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> > wrote: > > > > > Good idea.  If you want prefixed operators: 'and( a, b )' instead of > > 'a an

Re: Consequences of importing the same module multiple times in C++?

2008-10-25 Thread Aaron Brady
On Oct 24, 2:23 pm, Robert Dailey <[EMAIL PROTECTED]> wrote: > Hi, > > I'm currently using boost::python::import() to import Python modules, > so I'm not sure exactly which Python API function it is calling to > import these files. I posted to the Boost.Python mailing list with > this question and

Re: big objects and avoiding deepcopy?

2008-10-25 Thread Aaron Brady
On Oct 24, 1:11 pm, Reckoner <[EMAIL PROTECTED]> wrote: > I am writing an algorithm that takes objects (i.e. graphs with > thousands of nodes) into a "hypothetical" state. I need to keep a > history of these  hypothetical objects depending on what happens to > them later. Note that these hypothetic

Re: big objects and avoiding deepcopy?

2008-10-28 Thread Aaron Brady
On Oct 27, 1:10 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Robert Kern: > >> This is similar to implementing "Undo" functionality in applications.< > > > In a quite-high-level language (like Python, but not necessarily in > > Python itself) it may become eventually ad

Re: Database specialized in storing directed graphs?

2008-10-28 Thread Aaron Brady
On Oct 27, 7:32 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > I was wondering if anyone had any advice on this. > > This is not to study graph theory; I'm using the graph to represent a > problem domain.  The graphs could be arbitrarily large, and could > easily have millions of nodes, and most nodes

Re: Finding the instance reference of an object

2008-10-28 Thread Aaron Brady
On Oct 27, 2:11 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > On Oct 27, 2008, at 12:19 PM, [EMAIL PROTECTED] wrote: > > > I think this "uncontrived" example addresses the C/Python difference > > fairly directly (both were tested): > > That's correct, but of course, C is a decades-old language barely

Re: Do I need a lock here?

2008-10-28 Thread Aaron Brady
On Oct 28, 3:29 pm, jasiu85 <[EMAIL PROTECTED]> wrote: > On Oct 27, 10:12 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > > > > jasiu85 schrieb: > > > > Hey, > > > > Please take a look at the code of the two threads below: > > > > COMMON_DICT = {} > > > > def thread_1(): > > >     global COMM

Re: explanation of values, references, assignment, and method calls

2008-10-28 Thread Aaron Brady
On Oct 28, 11:30 am, Bruno Desthuilliers wrote: > Joe Strout a écrit : > > > I've tried to write up this topic in a clear, step-by-step manner, with > > the help of diagrams and short examples from several different OOP > > languages.  I hope it will help clear up the confusion that seems to be >

Re: Regarding shared memory

2008-10-30 Thread Aaron Brady
On Oct 29, 11:13 pm, gaurav kashyap <[EMAIL PROTECTED]> wrote: > Dear all, > > I have a server program that listens to a particular port and a number > of client programs that connect to the server. > > Now i want to put some data in form of python list in main memory on > server.Hence whenver a cl

Re: Restricted Execution of untrusted code

2008-10-30 Thread Aaron Brady
On Oct 30, 6:35 am, "Emanuele D'Arrigo" <[EMAIL PROTECTED]> wrote: > I noticed that this issue has been discussed in this newsgroup > periodically over the years and I seem to understand that - > comprehensive- safe/restricted execution of untrusted code in python > is currently quite hard to achie

Re: Finding the instance reference of an object

2008-10-30 Thread Aaron Brady
On Oct 30, 9:05 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 31 Oct 2008 13:58:13 +1300, greg wrote: > > Dale Roberts wrote: > snip > > > If they understand how assignment works in Python, that tells them all > > they need to know. > > Nonsense. Maybe I missed this p

Re: Restricted Execution of untrusted code

2008-10-30 Thread Aaron Brady
On Oct 30, 3:50 pm, Aaron Brady <[EMAIL PROTECTED]> wrote: > On Oct 30, 6:35 am, "Emanuele D'Arrigo" <[EMAIL PROTECTED]> wrote: > > > > > I noticed that this issue has been discussed in this newsgroup > > periodically over the years and

Re: Finding the instance reference of an object

2008-10-31 Thread Aaron Brady
On Oct 31, 4:23 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 30 Oct 2008 19:55:57 -0700, Aaron Brady wrote: snip > > After that's established, we > > can proceed to evaluating what 'call by value' would behave like, which &

Re: Finding the instance reference of an object

2008-11-02 Thread Aaron Brady
On Oct 31, 3:23 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 30 Oct 2008 19:55:57 -0700, Aaron Brady wrote: > > On Oct 30, 9:05 pm, Steven D'Aprano <[EMAIL PROTECTED] > > cybersource.com.au> wrote: > >> On Fri, 31 Oc

Re: Unyeilding a permutation generator

2008-11-02 Thread Aaron Brady
On Nov 2, 3:34 pm, [EMAIL PROTECTED] wrote: > Hello, can someone please help. > > I found the following code athttp://code.activestate.com/recipes/252178/ > > def all_perms(str): >     if len(str) <=1: >         yield str >     else: >         for perm in all_perms(str[1:]): >             for i in

Re: wrapping a method function call?

2008-11-03 Thread Aaron Brady
On Nov 3, 3:57 am, [EMAIL PROTECTED] wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > Now you can monkey patch class A if you want. It's probably not a great > > idea to do this in production code, as it will effect class A everywhere. > > This is perfect for me.  The code in question is bas

Re: Finding the instance reference of an object

2008-11-03 Thread Aaron Brady
On Nov 2, 10:13 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sun, 02 Nov 2008 13:23:11 -0800, Aaron Brady wrote: > > But, doing so, an object is not the same as a reference to it, and all > > Python does is pass and copy references. > > No, that's what a

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