Re: English-like Python

2009-01-22 Thread Aaron Brady
On Jan 22, 2:17 am, Steven D'Aprano wrote: > On Wed, 21 Jan 2009 08:17:34 -0700, Joe Strout wrote: > > But of course.  Any method call is legal only if the form of the call > > matches the method prototype -- if you try to call a function that > > requires 4 parameters, and give it only 3, that's

subclass PyDictObject -- any gotchas?

2009-01-22 Thread Aaron Brady
Hello all, I am trying to create a mapping class similar to the base dictionary, but with some added behaviors that affect pointers on a low level. I have a bare-bones version I compiled with MinGW, and it is working! I want to know if there is anything that is going to bite me later, when I sta

Re: subclass PyDictObject -- any gotchas?

2009-01-22 Thread Aaron Brady
On Jan 22, 7:49 am, Aaron Brady wrote: > Hello all, > > I am trying to create a mapping class similar to the base dictionary, > but with some added behaviors that affect pointers on a low level.  I > have a bare-bones version I compiled with MinGW, and it is working!  I > want t

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-23 Thread Aaron Brady
On Jan 23, 7:01 pm, Mark Wooding wrote: > Steven D'Aprano writes: > > I did? Where did I make that assumption? > > I inferred it from the juxtaposition, apparently in error.  Sorry. > > > What I said was that the model "The code is the whole team's ownership" > > doesn't work well for large proje

ob_type in shared memory

2009-01-25 Thread Aaron Brady
Hello, I am writing an extension using shared memory. I need a data type that is able to reassign its 'ob_type' field depending on what process is calling it. Object 'A' is of type 'Ta'. When process 'P' is looking at it, it needs to have an 'ob_type' that is 'Ta' as process 'P' sees it. When

Re: ob_type in shared memory

2009-01-26 Thread Aaron Brady
Hi Mark, nice to have your comment. On Jan 25, 9:47 pm, Mark Wooding wrote: > Aaron Brady writes: snip > > Object 'A' is of type 'Ta'.  When process 'P' is looking at it, it > > needs to have an 'ob_type' that is 'Ta' as process

Re: ob_type in shared memory

2009-01-26 Thread Aaron Brady
Hi, Mark, Do you mind if I approach you off the group about this? Aaron On Jan 25, 9:47 pm, Mark Wooding wrote: > Aaron Brady writes: > > I am writing an extension using shared memory.  I need a data type > > that is able to reassign its 'ob_type' field dependi

Re: ob_type in shared memory

2009-01-26 Thread Aaron Brady
On Jan 26, 9:20 pm, Aaron Brady wrote: > Hi, Mark, snip > On Jan 25, 9:47 pm, Mark Wooding wrote:> Aaron Brady > writes: > > > I am writing an extension using shared memory.  I need a data type > > > that is able to reassign its 'ob_type' field depen

Re: self-aware list of objects able to sense constituent member alterations?

2009-01-28 Thread Aaron Brady
On Jan 27, 3:16 pm, Reckoner wrote: > I'm not sure this is possible, but I would like to have > a list of  objects > > A=[a,b,c,d,...,z] > > where,  in the midst of a lot of processing I might do something like, > > A[0].do_something_which_changes_the_properties() > > which alter the properties of

Re: writing large dictionaries to file using cPickle

2009-01-28 Thread Aaron Brady
On Jan 28, 10:13 am, perfr...@gmail.com wrote: > hello all, > > i have a large dictionary which contains about 10 keys, each key has a > value which is a list containing about 1 to 5 million (small) > dictionaries. for example, snip > but this takes just as long... any ideas ? is there a different

Re: dicts,instances,containers, slotted instances, et cetera.

2009-01-28 Thread Aaron Brady
On Jan 28, 2:38 pm, ocsch...@gmail.com wrote: > Hi, all. > > I have an application that that creates, manipulates, and finally > archives on disk 10^6 instances of an object that in CS/DB terms is > best described as a relation. > > It has 8 members, all of them common Python datatypes. 6 of these

Re: writing large dictionaries to file using cPickle

2009-01-28 Thread Aaron Brady
On Jan 28, 4:43 pm, perfr...@gmail.com wrote: > On Jan 28, 5:14 pm, John Machin wrote: > > > > > On Jan 29, 3:13 am, perfr...@gmail.com wrote: > > > > hello all, > > > > i have a large dictionary which contains about 10 keys, each key has a > > > value which is a list containing about 1 to 5 milli

Re: writing large dictionaries to file using cPickle

2009-01-30 Thread Aaron Brady
On Jan 30, 2:44 pm, perfr...@gmail.com wrote: > On Jan 28, 6:08 pm, Aaron Brady wrote: > > > > > On Jan 28, 4:43 pm, perfr...@gmail.com wrote: > > > > On Jan 28, 5:14 pm, John Machin wrote: > > > > > On Jan 29, 3:13 am, perfr...@gmail.com wrote: >

Re: Why doesn't eval of generator expression work with locals?

2009-01-31 Thread Aaron Brady
On Jan 31, 1:08 am, "Hendrik van Rooyen" wrote: > "Gabriel Genellina" wrote: snip > >or even like this: > > >def foo(L, M, A): > >   for x in L: > >     for y in M: > >       yield x+A > >g = foo(iter(L), iter(M), A) > > >In particular, I like the 2nd (all late binding). Seems this topic was   >

Re: search speed

2009-02-01 Thread Aaron Watters
erms anywhere (full text) searches for terms within fields, searches for prefixes in fields, searches based on field inequality, or searches for field exact value. I would argue this subsumes the standard "fielded approach". -- Aaron Watters === Oh, I'm a lumberjack and I'

Re: English-like Python

2009-02-03 Thread Aaron Brady
On Feb 3, 2:01 pm, "J. Cliff Dyer" wrote: > On Tue, 2009-02-03 at 08:33 -0700, Joe Strout wrote: > > J. Cliff Dyer wrote: > > > > But what if your language allows functions to be used as first class > > > objects?  (Mine does :))   > > > > x = Beep > > > > Does that assign the name x to the Beep o

ANN: Nucular full text indexing 0.4

2009-02-05 Thread Aaron Watters
rmats (the change was needed to fix a bug). On Windows XP I had to delete the old package manually from the Python library before the install for the new package would work properly. I hope you like it. -- Aaron Watters === Fear has several advantages over gratitude. Gratitude is intrinsical

generator object or 'send' method?

2009-02-09 Thread Aaron Brady
Hello, I am writing a generator to return a sequence of numbers with some variation. The parameters of the variation can be changed by the caller, even after the generator is started. My question is, is it better to wrap the generator in an object, so that the parameters can be changed just by a

Re: generator object or 'send' method?

2009-02-10 Thread Aaron Brady
On Feb 10, 6:30 am, "andrew cooke" wrote: > steven probably knows this, but to flag the issue for people who are > looking at generators/coroutines for the first time: there's a little > "gotcha" about exactly how the two sides of the conversation are > synchronized.  in simple terms: send also re

Re: Avoiding argument checking in recursive calls

2009-02-11 Thread Aaron Brady
On Feb 10, 7:58 pm, Steven D'Aprano wrote: > I sometimes write recursive functions like this simple factorial: > > def fact(n): >     if n < 0: raise ValueError >     if n = 0: return 1 >     return fact(n-1)*n > > At the risk of premature optimization, I wonder if there is an idiom for > avoiding

Re: generator object or 'send' method?

2009-02-11 Thread Aaron Brady
On Feb 11, 4:41 am, greg wrote: > Aaron Brady wrote: > > It would receive the 'send' from a different point in control > > flow than its usual 'next'.  Should it repeat a value if it receives a > > 'send'? > > No. This requirement clea

pdb in 3.0 very buggy (Win XP Home)

2009-02-13 Thread Aaron Brady
Hi, got a freeze when running 'pdb' in 3.0. The program executes correctly with the command 'c', but freezes part way through when running successive 'n' commands. Platform Windows XP Home. Python 3.0 (r30:67507, Dec 3 2008, 20:14:27) [MSC v.1500 32 bit (Intel)] on win32. The 'list' command wa

Re: Pickling classes (not class instances)

2009-02-14 Thread Aaron Brady
On Feb 14, 2:19 am, Nicolas M. Thiéry wrote: >          Dear python developers, > > I got no answer to my previous post on this thread "Pickling classes > (not class instances)". > This issue is a show stopper for our project. Any suggestion for where > to ask? snip to http://groups.google.com/gro

Re: How to peek inside a decorated function

2009-02-15 Thread Aaron Brady
On Feb 15, 4:27 am, Hrvoje Niksic wrote: > Steven D'Aprano writes: > > Suppose I have a function f() which I know has been decorated, but I don't > > have access to the original undecorated function any longer: > > > def reverse(func): > >     def f(*args): > >         args = list(args) > >      

Re: memory recycling/garbage collecting problem

2009-02-17 Thread Aaron Brady
On Feb 16, 11:21 pm, Yuanxin Xi wrote: > I'm having some problems with the memory recycling/garbage collecting > of the following testing code: > > >>> a=[str(i) for i in xrange(1000)] > > This takes 635m/552m/2044 memory (VIRT/RES/SHR) > > >>> b={} > >>> for i in xrange(1000): > > ...    

PyTypeObject subclass

2009-02-18 Thread Aaron Brady
Hi, Is it ok to subclass PyTypeObject, so that my custom 'tp_' fields can appear at the bottom of it? Is there anything like size requirements going on in its code? Or is it better to use 'tp_dict' or slots? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Find the location of a loaded module

2009-02-20 Thread Aaron Scott
I'm running into a problem that's rapidly reaching keyboard-smashing levels. I'm trying to import a module into Python, but it seems like Python is almost randomly loading the module from an entirely different directory, one that shouldn't be in the module search path. When I tell Python to load a

Re: Find the location of a loaded module

2009-02-20 Thread Aaron Scott
es, eventually it loads the module from the proper directory ('act2'). Then, I'll go back to the first directory, and find that it too will be loading the module from 'act2'. I'll refresh, and it'll load from 'act1' again. I'll refresh a couple times, and suddenly it's loading from 'act2' again. I'm seriously going insane. If anyone has any insight, please, please share it with me. Aaron -- http://mail.python.org/mailman/listinfo/python-list

Re: Find the location of a loaded module

2009-02-20 Thread Aaron Scott
Here's another clue: if I'm trying to run the script from the directory 'act1', but it's loading the module from 'act2', if I rename the module directory in 'act2' and refresh, the module still reports that it's running from '/home/www/---/docs/act2/story/game.pyc'... even though that files no long

Re: Find the location of a loaded module

2009-02-20 Thread Aaron Scott
And more madness... Executed from inside 'act1', which contains the directory / module 'story': directory = os.path.dirname(__file__) req.write(str(directory)) story = apache.import_module('story', path=[directory]) Results: File "/home/www/---/docs/act1/play.py", l

Re: Find the location of a loaded module

2009-02-20 Thread Aaron Scott
Son of a bitch. It gets worse. > Executed from inside 'act1', which contains the directory / module > 'story': > >         directory = os.path.dirname(__file__) >         req.write(str(directory)) >         story = apache.import_module('story', path=[directory]) > > Results: > > /home/www/---/do

Re: Find the location of a loaded module

2009-02-20 Thread Aaron Scott
> > 'req.write(story.game.Save())' returns '/home/www/--/docs/act2/ > storylab/game.pyc' as the file being accessed. > Sorry, that should have read: > 'req.write(story.game.Save())' returns > '/home/www/--/docs/act2/story/game.pyc' as the file being accessed. -- http://mail.python.org/mailman/lis

Re: Find the location of a loaded module

2009-02-20 Thread Aaron Scott
And finally, an epilogue. So, the problem lies with how Python cached the modules in memory. Yes, the modules were in two different locations and yes, the one that I specified using its direct path should be the one loaded. The problem is, the module isn't always loaded -- if it's already in memor

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-22 Thread Aaron Brady
On Nov 22, 8:40 am, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 22, 2008, at 4:08 AM, Aaron Brady wrote: > > > Furthermore, to apply c-b-v to Python, you have to > > introduce the concept of pointers, which is ostensibly non-native for > > human programmers. >

Re: initialization in argument definitions

2008-11-22 Thread Aaron Brady
On Nov 21, 3:25 pm, Brentt <[EMAIL PROTECTED]> wrote: > Hi, I know this is a terribly simple question, but the docs seem to be > designed for people who probably find a the answer to this question > terribly obvious. But its not at all obvious to me. > > I can't figure out why when I define a funct

Re: Getting in to metaprogramming

2008-11-25 Thread Aaron Brady
On Nov 25, 4:08 am, Rafe <[EMAIL PROTECTED]> wrote: > Hi, > > In the name of self-education can anyone share some pointers, links, > modules, etc that I might use to begin learning how to do some > "metaprogramming". That is, using code to write code (right?) > > Cheers, > > - Rafe Python programs

Re: Getting in to metaprogramming

2008-11-25 Thread Aaron Brady
On Nov 25, 5:20 am, Michele Simionato <[EMAIL PROTECTED]> wrote: > On Nov 25, 12:12 pm, Rafe <[EMAIL PROTECTED]> wrote: > > > is it really as simple as gathering strings of code? > > Yes. Yes. > > Sort of like generating HTML or XML directly? Is there any other framework > > or > > pattern set t

Re: Python C/API simple debugging

2008-11-26 Thread Aaron Brady
On Nov 26, 5:27 am, k3xji <[EMAIL PROTECTED]> wrote: > Hi all, > > I am new to Python C API and finding it difficult to debug C > extensions. So, basically I want to see the value of an integer value > during the C API. Here is the code: > > #define LAST_MIX_VAL 0xDEADBEEF > > static PyObject * > c

Re: Getting in to metaprogramming

2008-11-26 Thread Aaron Brady
On Nov 26, 10:41 pm, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: >  "Steven D'Aprano" wrote: > > > > > Well, I don't know about "any problem". And it's not so much about > > whether metaprograms can solve problems that can't be solved by anything > > else, as whether metaprograms can solve pro

Re: Getting in to metaprogramming

2008-11-26 Thread Aaron Brady
On Nov 26, 6:29 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 27 Nov 2008 06:41:47 +0200, Hendrik van Rooyen wrote: > > I am using the term in the restricted sense of Python writing Python > > source. > > > Given that, can anybody think of an example that you could not do with a > > clas

Re: what's so difficult about namespace?

2008-11-26 Thread Aaron Brady
On Nov 26, 6:57 pm, Kaz Kylheku <[EMAIL PROTECTED]> wrote: > The theory is that the adoption of some technology is driven by > a function of the ratio: > >    perceived crisis >     >    perceived pain of adoption > > These perceptions may not be accurate. The crisis may be larger

Re: HELP!...Google SketchUp needs a Python API

2008-11-28 Thread Aaron Brady
On Nov 27, 9:45 pm, r <[EMAIL PROTECTED]> wrote: > On Nov 27, 9:31 pm, alex23 <[EMAIL PROTECTED]> wrote: > > On Nov 28, 12:49 pm, r <[EMAIL PROTECTED]> wrote: > > > Well... 3 for Ruby 1 for python. Not looking good so far. Any more > > > votes? > > > I don't see -any- of the responses in this threa

Re: Using thread in an asyncronous application

2008-11-28 Thread Aaron Brady
On Nov 27, 9:03 am, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > Hi, > I'm the maintainer of an asynchronous FTP server implementation based > on asyncore. > Some days ago I thought it would be interesting to add a class > offering the possibility to run the asyncore loop into a thread so > tha

Re: Getting in to metaprogramming

2008-11-28 Thread Aaron Brady
On Nov 27, 9:28 pm, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: >  "Aaron Brady" <[EMAIL PROTECTED]> wrote: ... > >As you can see, the 'visit' method is mechanical for classes A and B. > >One might want to autogenerate those in some lang

Re: Getting in to metaprogramming

2008-11-28 Thread Aaron Brady
On Nov 27, 8:21 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: snip > body = 'L.append(None)\n' > make_file('dumb.py', 'Create a big list the dumb way.', >     'L = []\n', body*numitems) > make_file('smart.py', 'Create a big list the smart way.', >     '', 'L = [None]*%d\n' % num

Re: HELP!...Google SketchUp needs a Python API

2008-11-29 Thread Aaron Brady
On Nov 28, 10:42 pm, r <[EMAIL PROTECTED]> wrote: > Arron, i give you an A++ just for writing a longer post than me =D Hey wow, lucky me. Maybe someone will read it too. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using thread in an asyncronous application

2008-11-29 Thread Aaron Brady
On Nov 29, 5:27 am, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > On 29 Nov, 02:24, Aaron Brady <[EMAIL PROTECTED]> wrote: > > > > > On Nov 27, 9:03 am, "Giampaolo Rodola'" <[EMAIL PROTECTED]> wrote: > > > > H

Re: Project structure - Best practices

2008-11-30 Thread Aaron Watters
7;m completely confused about any implications related to integrated system testing or "easyinstall"... Wise, pragmatic advice would be appreciated. (But if we could avoid the "buzzillion directories" approach prevalent in the java alternative universe, that would be nice.)

Re: HELP!...Google SketchUp needs a Python API

2008-11-30 Thread Aaron Brady
> > r, i am with you! i will back Python!!! we MUST spread > > Python throughout the world! sketchup is the first step, > > only the first step. > > First step? Really? AFAIK, Python is already used in: OpenOffice.Org, > Blender, GIMP, Inkscape, Scribus, etc. I've never used these tools, > but I

Checking a string against multiple matches

2008-12-01 Thread Aaron Scott
I've been trying to read up on this, but I'm not sure what the simplest way to do it is. I have a list of string. I'd like to check to see if any of the strings in that list matches another string. Pseudocode: if "two" in ["one", "two", "three", "four"]: return True Is there any built-in i

Re: Checking a string against multiple matches

2008-12-01 Thread Aaron Scott
Damn you, Python, and your loose documentation! It never occurred to me to actually TRY my pseudocode, since I couldn't find anything on that type of statement. Anyway, feel free to ignore me from now on. -- http://mail.python.org/mailman/listinfo/python-list

Re: HELP!...Google SketchUp needs a Python API

2008-12-01 Thread Aaron Brady
On Dec 1, 2:29 pm, r <[EMAIL PROTECTED]> wrote: > Rome is Burning! > Pay particular attention to the second paragraph. > > Narcissistic culture > > Main article: The Culture of Narcissism > Historian and social critic Christopher Lasch described this topic in > his book, "The Culture of Narcissism"

Re: HELP!...Google SketchUp needs a Python API

2008-12-02 Thread Aaron Brady
On Dec 2, 6:24 pm, r <[EMAIL PROTECTED]> wrote: > I added you name to my "for" list. thanks +1 entertaining thread. -- http://mail.python.org/mailman/listinfo/python-list

Re: Overriding a method at the instance level on a subclass of a builtin type

2008-12-02 Thread Aaron Brady
On Dec 2, 6:58 pm, "Zac Burns" <[EMAIL PROTECTED]> wrote: > Sorry for the long subject. > > I'm trying to create a subclass dictionary that runs extra init code > on the first __getitem__ call. However, the performance of __getitem__ > is quite important - so I'm trying in the subclassed __getitem_

Re: Overriding a method at the instance level on a subclass of a builtin type

2008-12-04 Thread Aaron Brady
On Dec 3, 1:25 pm, Jason Scheirer <[EMAIL PROTECTED]> wrote: > On Dec 2, 6:13 pm, Aaron Brady <[EMAIL PROTECTED]> wrote: > > >>> class A: > > > ...     def methA( self ): > > ...             print 'methA' > > ...             self.meth= s

Re: "as" keyword woes

2008-12-04 Thread Aaron Brady
On Dec 4, 4:43 am, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Thu, 4 Dec 2008 01:28:56 -0800, "Warren DeLano" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > In addition, note that my choice of a concise method identifier affects > > only my users.  Python's introduc

Re: "as" keyword woes

2008-12-04 Thread Aaron Brady
On Dec 4, 3:28 am, "Warren DeLano" <[EMAIL PROTECTED]> wrote: > > Have you > > even looked at multiprocessing? > Multiprocessing solves some problems, but it is unsuitable for > high-frequency handoffs of large (in memory) objects between many > independent threads/processes -- the HPC object/data

Re: funny generator behaviour

2008-12-04 Thread Aaron Brady
On Dec 4, 7:00 am, Edvin Fuglebakk <[EMAIL PROTECTED]> wrote: ... > def orderedCombinations(pool, k): >     """ >     Generator yielding ordered selections of size k with repetition from > pool. >     """ > >     if k == 1: >         for m in pool: >             yield [m] > >     if k > 1: > >    

Re: Overriding a method at the instance level on a subclass of a builtin type

2008-12-04 Thread Aaron Brady
On Dec 4, 11:16 am, "Zac Burns" <[EMAIL PROTECTED]> wrote: > The class method seems to be the most promising, however I have more > 'state' methods to worry about so I might end up building new classes > on the fly rather than have a class per permutation of states! Now the > code isn't quite as cl

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Aaron Brady
On Dec 5, 4:32 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > The code people write is probably a direct reflection of their thinking > processes: For example, slow, plodding, one step at a time, incapable of > imaginative leaps, versus those who operate directly on la

Re: Don't you just love writing this sort of thing :)

2008-12-06 Thread Aaron Brady
On Dec 5, 7:20 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > In message <[EMAIL PROTECTED]>, Aaron Brady wrote: > > > On Dec 5, 4:32 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] > > central.gen.new_zealand> wrote: >

Re: Guido's new method definition idea

2008-12-06 Thread Aaron Brady
On Dec 5, 8:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > Hi folks, > > The story of the explicit self in method definitions has been > discussed to death and we all know it will stay. However, Guido > himself acknowledged that an alternative syntax makes perfect sense > and having both (

Re: "as" keyword woes

2008-12-07 Thread Aaron Brady
On Dec 6, 9:35 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Dec 6, 8:17 pm, Steven D'Aprano <[EMAIL PROTECTED] > > I don't like "cast", because a cast is an instruction to the compiler to > > treat data as some type other than what it was defined as. > It doesn't > > create a new piece of data. (

Re: "as" keyword woes

2008-12-07 Thread Aaron Brady
On Dec 6, 2:29 pm, "Guido van Rossum" <[EMAIL PROTECTED]> wrote: snip > > So, assuming I now wish to propose a corrective PEP to remedy this > > situation for Python 3.1 and beyond, what is the best way to get started > > on such a proposal? > > Don't bother writing a PEP to make 'as' available as

Re: var or inout parm?

2008-12-08 Thread Aaron Brady
On Dec 7, 2:54 am, [EMAIL PROTECTED] wrote: > How can I make a "var" parm, where the called function can modify > the value of the parameter in the caller? > > def f(x): >     x = x + 1 > > n = 1 > f(n) > # n should now be 2 You can't. 'n' would need a 'set_to' method, which it doesn't have. Othe

Re: appending values into array instead of a list

2008-12-08 Thread Aaron Brady
On Dec 8, 9:03 am, trias <[EMAIL PROTECTED]> wrote: > Hi, >  I have this little script: snip > So on the above I am appending values from signaldict indexed by i for every > object in the ref list. This way I calculate the sum of all values with > similar indexing i value. Would I be able to store

Re: A question about reference in Python.

2008-12-08 Thread Aaron Brady
On Dec 8, 9:18 am, Joe Strout <[EMAIL PROTECTED]> wrote: > On Dec 7, 2008, at 10:26 PM, Group wrote: > > > Now, I want to write a Red-Black Tree, and a List structure. In C/C+ > > +, I can > > use pointers to refer to  children  notes (or next notes). But, in   > > Python, how > > can I do it? Exce

Re: Guido's new method definition idea

2008-12-08 Thread Aaron Brady
On Dec 7, 4:23 pm, Philip Slate <[EMAIL PROTECTED]> wrote: > On Dec 7, 1:13 pm, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > > > and friendlier to newbies. > > > I'd rather say "more acceptable to java-brainwashed developpers". > > And I'd rather say you're trolling, but that's ok since you

Re: Guido's new method definition idea

2008-12-08 Thread Aaron Brady
On Dec 8, 2:55 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > class C: > >     def createfunc(self): > >         def self.func(arg): > >             return arg + 1 > > > Or, after the class definition is done, to extend it dynamically: > > > def C.method(self, arg):

Re: Guido's new method definition idea

2008-12-09 Thread Aaron Brady
On Dec 8, 6:43 pm, william tanksley <[EMAIL PROTECTED]> wrote: > On Dec 5, 6:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> > wrote: > > > I'd like this new way of defining methods, what do you guys think? > > Anyone ready for writing a PEP? snip > > I see a lot of people are against it; I admit th

Re: "as" keyword woes

2008-12-09 Thread Aaron Brady
On Dec 9, 8:28 am, MRAB <[EMAIL PROTECTED]> wrote: snip > In some languages (I think Delphi is one of them - it's been a while!) > some words which would normally be identifiers have a special meaning in > certain contexts, but the syntax precludes any ambiguity, and not in a > difficult way. "as"

Re: "as" keyword woes

2008-12-09 Thread Aaron Brady
On Dec 9, 12:40 pm, MRAB <[EMAIL PROTECTED]> wrote: > Aaron Brady wrote: > > On Dec 9, 8:28 am, MRAB <[EMAIL PROTECTED]> wrote: > > snip > >> In some languages (I think Delphi is one of them - it's been a while!) > >> some words which would

Re: "as" keyword woes

2008-12-09 Thread Aaron Brady
On Dec 9, 4:53 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Tue, 09 Dec 2008 08:30:26 -0800, Aaron Brady wrote: > > The following are semantically equivalent: > > > I certainly wouldn't want something like PL/I, where "IF"

Re: Problems running on HP Intel duo core machine

2008-12-11 Thread Aaron Brady
On Dec 11, 1:58 pm, jim-on-linux wrote: > py help, > > I produced a program that runs on windows. > One client is using an HP machine with an Intel cpu > E2200 @ 2.2ghz., and with .99 G ram. > The machine is using Win XP Pro 32 bit OS with service > pack 2 > > I ran Dependency Walker and everythin

Re: Problems running on HP Intel duo core machine

2008-12-13 Thread Aaron Brady
On Dec 11, 3:16 pm, jim-on-linux wrote: > Aaron, > > The TraceBack is : > > TraceBack: > File win32ui.pyc, line 12, in > File win32ui.pyc Line 10, in _load > ImportError: DLL Load Failed: The specified module > could not be found. snip > > Both modules '

Re: var or inout parm?

2008-12-13 Thread Aaron Brady
On Dec 12, 7:31 am, Steve Holden wrote: > sturlamolden wrote: > > On Dec 12, 1:56 pm, sturlamolden wrote: > > >> That is because integers are immutable. When x += 1 is done on an int, > >> there will be a rebinding. But try the same on say, a numpy array, and > >> the result will be different: sn

Re: stable algorithm with complexity O(n)

2008-12-13 Thread Aaron Brady
On Dec 13, 1:17 pm, Duncan Booth wrote: > "Diez B. Roggisch" wrote: > > > > > David Hláčik schrieb: > >> Hi guys, > > >> i am really sorry for making offtopic, hope you will not kill me, but > >> this is for me life important problem which needs to be solved within > >> next 12 hours.. > > >> I h

subprocess to C program

2008-12-13 Thread Aaron Brady
Hi, I am writing a C process and I want to read data from a file that I write to in Python. I'm creating a pipe in Python, passing it to the C process, and calling '_read'. It gives me error 9, bad file number. Python code: import subprocess as s, os r, w= os.pipe( ) os.write( w, 'abcdefghij\n

Re: subprocess to C program

2008-12-13 Thread Aaron Brady
On Dec 13, 7:51 pm, Grant Edwards wrote: > On 2008-12-14, MRAB wrote: > > > > >> I am writing a C process and I want to read data from a file that I > >> write to in Python.  I'm creating a pipe in Python, passing it to the > >> C process, and calling '_read'.  It gives me error 9, bad file numbe

Re: subprocess to C program

2008-12-14 Thread Aaron Brady
On Dec 14, 6:32 am, bobicanprogram wrote: > On Dec 13, 10:09 pm, MRAB wrote: > > > > > Aaron Brady wrote: > > > On Dec 13, 7:51 pm, Grant Edwards wrote: > > >> On 2008-12-14, MRAB wrote: > > > >>>> I am writing a C process and I want

Re: subprocess to C program

2008-12-14 Thread Aaron Brady
On Dec 13, 9:09 pm, MRAB wrote: > Aaron Brady wrote: > > On Dec 13, 7:51 pm, Grant Edwards wrote: > >> On 2008-12-14, MRAB wrote: > > >>>> I am writing a C process and I want to read data from a file that I > >>>> write to in Python.  I'

Re: stable algorithm with complexity O(n)

2008-12-14 Thread Aaron Brady
On Dec 14, 6:04 pm, greg wrote: > Lie Ryan wrote: > > "You know what you just did? You've > > just found a problem that was supposed to be an example of unsolvable > > problem." > > > It has happened before, why not again? > > There's a big difference between an unsolvable problem and an > unsolve

Re: stable algorithm with complexity O(n)

2008-12-14 Thread Aaron Brady
On Dec 14, 8:18 pm, Roy Smith wrote: > Steven D'Aprano wrote: > > All the positive thinking in the world won't help you: > > > * make a four-sided triangle; > > > * split a magnet into two individual poles; > > These two are fundamentally different problems. > > The first is impossible by definit

Re: alt.possessive.its.has.no.apostrophe

2008-12-16 Thread Aaron Brady
On Dec 15, 11:04 am, Steve Holden wrote: > Tim Chase wrote: > > Steve Holden wrote: > >> This led to a schism between the British and the > >> newly-independent Americans, who responded by taking the "u" > >> out of colour, valour, and aluminium. > > > Darn Americans and their alminim ;-) > >

subprocess.Popen inheriting

2008-12-16 Thread Aaron Brady
Hi, I have a file handle I want to inherit in a child process. I am looking at '_make_inheritable' in 'Popen', but it needs an instance, and by the time I have one, the subprocess is already running. Can't I call 'Popen._make_inheritable( None, handle )'? The method does not use 'self'. -- http

Re: subprocess.Popen inheriting

2008-12-16 Thread Aaron Brady
On Dec 16, 4:15 am, "Gabriel Genellina" wrote: > En Tue, 16 Dec 2008 07:29:19 -0200, Aaron Brady   > escribió: > > > I have a file handle I want to inherit in a child process.  I am > > looking at '_make_inheritable' in 'Popen', but it nee

Re: How to modify a program while it's running?

2008-12-16 Thread Aaron Brady
On Dec 16, 7:26 pm, Steven D'Aprano wrote: > On Tue, 16 Dec 2008 13:25:17 -0700, Joe Strout wrote: > > So I'd like to restructure my app so that it can stay running and stay > > logged in, yet I can still update and reload at least most of the code. > > But I'm not sure what's the best way to do t

Re: How to modify a program while it's running?

2008-12-16 Thread Aaron Brady
On Dec 16, 7:54 pm, "James Mills" wrote: > @Aaron > > Your code and suggestion is way too complicated. > Just register your objects. When you need to > reload your module, destroy the existing > objects and re-creat them. > > This works well assuming you

Re: How to modify a program while it's running?

2008-12-16 Thread Aaron Brady
On Dec 16, 11:47 pm, Paul Rubin wrote: > Joe Strout writes: > > So I'd like to restructure my app so that it can stay running and stay > > logged in, yet I can still update and reload at least most of the > > code.  But I'm not sure what's the best way to do this.  S

Re: subprocess.Popen inheriting

2008-12-17 Thread Aaron Brady
On Dec 17, 5:05 pm, "Gabriel Genellina" wrote: > En Wed, 17 Dec 2008 12:21:38 -0200, Jeremy Sanders   > escribió: > > > Aaron Brady wrote: > > >> I thought so too.  The web seems to say that on Linux they are, and on > >> Windows, you n

Re: C API and memory allocation

2008-12-17 Thread Aaron Brady
On Dec 17, 6:42 pm, "Gabriel Genellina" wrote: > En Wed, 17 Dec 2008 21:35:04 -0200, Floris Bruynooghe   > escribió: > Yes; but you don't have to dig into the implementation; from   > http://docs.python.org/c-api/arg.html: > > s (string or Unicode object) [const char *] > Convert a Python string

Re: subprocess.Popen inheriting

2008-12-18 Thread Aaron Brady
On Dec 17, 7:16 pm, "Gabriel Genellina" wrote: > En Wed, 17 Dec 2008 22:46:32 -0200, Aaron Brady   > escribió: > > > > > On Dec 17, 5:05 pm, "Gabriel Genellina" > > wrote: > >> En Wed, 17 Dec 2008 12:21:38 -0200, Jeremy Sanders   > >

Re: OT: Binary tree logarithms properties

2008-12-18 Thread Aaron Brady
On Dec 18, 4:34 am, Mr.SpOOn wrote: > 2008/12/17 Terry Reedy : > > > Nodes only have single number indexes if you arrange them linearly. Then the > > index depends on how you arrange them, whether you start the array indexes > > with 0 or 1, and whether you start the level numbers with 0 or 1.  Ca

Re: C API and memory allocation

2008-12-18 Thread Aaron Brady
On Dec 18, 5:09 am, Ivan Illarionov wrote: > On 18 ÄÅË, 03:51, Aaron Brady wrote: > (snip) > > > How did you get a reference to the original > > string object, with which to increment its reference count? > > Use the "O!" format  instead of "s": >

Re: C API and memory allocation

2008-12-18 Thread Aaron Brady
On Dec 18, 7:54 am, Stefan Behnel wrote: > Aaron Brady wrote: > > I see.  Do I read correctly that 's' is only useful when the > > argument's position is known? > > I assume you meant "length". No, position in the argument list. Otherwise you can&

Re: subprocess.Popen inheriting

2008-12-18 Thread Aaron Brady
On Dec 17, 7:16 pm, "Gabriel Genellina" wrote: > En Wed, 17 Dec 2008 22:46:32 -0200, Aaron Brady   > escribió: > > > > > On Dec 17, 5:05 pm, "Gabriel Genellina" > > wrote: > >> En Wed, 17 Dec 2008 12:21:38 -0200, Jeremy Sanders   > >

Re: subprocess.Popen inheriting

2008-12-18 Thread Aaron Brady
On Dec 18, 6:11 pm, "Gabriel Genellina" wrote: > En Thu, 18 Dec 2008 08:35:58 -0200, Aaron Brady > escribió: > > > > > On Dec 17, 7:16 pm, "Gabriel Genellina" > > wrote: > >> En Wed, 17 Dec 2008 22:46:32 -0200, Aaron Brady   > &

Re: New Python 3.0 string formatting - really necessary?

2008-12-19 Thread Aaron Brady
On Dec 19, 1:43 pm, excord80 wrote: snip cons of Python > But, Python is Python. It's always surprising to me to hear this, but especially so in writing. It speech, it has connotations. A millionaire can say (dismissively), "Two bucks is two bucks." A poor person can say (wondrously), "Two bu

Re: subprocess.Popen inheriting

2008-12-20 Thread Aaron Brady
On Dec 18, 7:21 pm, "Gabriel Genellina" wrote: > En Thu, 18 Dec 2008 19:46:45 -0200, Aaron Brady   > escribió: snip > On Windows, file handles are the real OS stuff, the "true" reference to an   > open file. File descriptors are not, they exist only to please the

Re: New Python 3.0 string formatting - really necessary?

2008-12-20 Thread Aaron Brady
On Dec 20, 7:38 pm, Steven D'Aprano 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 how a BINARY OPERATOR > like % (that means it can only take TWO arguments) can deal with an > arbitrary number of arguments, *wit

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