Re: default value in __init__

2008-10-16 Thread Aaron "Castironpi" Brady
On Oct 16, 1:05 am, "Chris Rebert" <[EMAIL PROTECTED]> wrote: > On Wed, Oct 15, 2008 at 9:43 PM, Aaron Castironpi Brady > > > > <[EMAIL PROTECTED]> wrote: > > On Oct 15, 11:33 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > >> Aaron &q

Re: default value in __init__

2008-10-16 Thread Aaron &quot;Castironpi" Brady
On Oct 16, 12:23 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 16 Oct 2008 17:05:40 +1300, Lawrence D'Oliveiro wrote: > > In message <[EMAIL PROTECTED]>, Steven D'Aprano > > wrote: > > >> On Thu, 09 Oct 2008 01:39:30 -0700, kenneth (a.k.a. Paolo) wrote: > > >>> On Oct

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

2008-10-16 Thread Aaron &quot;Castironpi" Brady
On Oct 16, 9:10 am, Hongtian <[EMAIL PROTECTED]> wrote: > Not exactly. > > In my C/C++ application, I have following function or flow: > > void func1() > { >     call PyFunc(struct Tdemo, struct &Tdemo1); > > } > > I mean I want to invoke Python function 'PyFunc' and transfer a data > structure

Re: default value in __init__

2008-10-16 Thread Aaron &quot;Castironpi" Brady
On Oct 16, 7:54 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 16 Oct 2008 12:18:49 -0700, Aaron \"Castironpi\" Brady wrote: > > [snip] > > >> If Python re-evaluated the default value i=i at runtime, the above > >&

Re: Finding the instance reference of an object

2008-10-16 Thread Aaron &quot;Castironpi" Brady
On Oct 16, 8:30 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 16 Oct 2008 11:51:43 -0700, Aaron \"Castironpi\" Brady wrote: > > If you're sure it's unique, why not just scan through the pairs in > > local

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

2008-10-17 Thread Aaron &quot;Castironpi" Brady
ython function 'PyFunc' and transfer a data > structure 'Tdemo' to this function. After some process in Python, I > want it return 'Tdemo1' back to the C/C++ application. > > I research boost.python and think it is not a reasonable solution > because it make the

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

2008-10-17 Thread Aaron &quot;Castironpi" Brady
ython function 'PyFunc' and transfer a data > structure 'Tdemo' to this function. After some process in Python, I > want it return 'Tdemo1' back to the C/C++ application. > > I research boost.python and think it is not a reasonable solution > because it make the

Re: default value in __init__

2008-10-17 Thread Aaron &quot;Castironpi" Brady
On Oct 17, 6:56 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 17 Oct 2008 23:04:52 +1300, Lawrence D'Oliveiro wrote: > > In message <[EMAIL PROTECTED]>, Duncan Booth wrote: > > >> We already get people asking why code like this doesn't return 3: > > > fns = [ lambd

Re: Normalizing arguments

2008-10-17 Thread Aaron &quot;Castironpi" Brady
On Oct 17, 12:37 pm, Dan Ellis <[EMAIL PROTECTED]> wrote: > On Oct 17, 6:17 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote: > > > Why do you want/need this magical g() function considering that, as > > you yourself point out, Python already performs this normalization for > > you? > > A caching idea

Re: Finding the instance reference of an object

2008-10-17 Thread Aaron &quot;Castironpi" Brady
On Oct 17, 10:56 am, Joe Strout <[EMAIL PROTECTED]> wrote: > On Oct 16, 2008, at 11:23 PM, Dennis Lee Bieber wrote: snip > >    But, it seems, you are the only one arguing that "the semantics are > > all the same"... Doesn't that suggest that they aren't the same? > > No, it suggests to me that the

Re: Finding the instance reference of an object

2008-10-17 Thread Aaron &quot;Castironpi" Brady
On Oct 17, 4:03 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > On Oct 17, 2008, at 2:36 PM, Steve Holden wrote: snip > And here, you're doing an assignment -- this is the only test of the   > three that tests whether the parameter is passed by reference or by   > value.  The result: it's by value. > >

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

2008-10-17 Thread Aaron &quot;Castironpi" Brady
On Oct 16, 9:10 am, Hongtian <[EMAIL PROTECTED]> wrote: > Not exactly. > > In my C/C++ application, I have following function or flow: > > void func1() > { >     call PyFunc(struct Tdemo, struct &Tdemo1); > > } > > I mean I want to invoke Python function 'PyFunc' and transfer a data > structure

Re: 'Hidden Features of Python'

2008-10-17 Thread Aaron &quot;Castironpi" Brady
On Oct 17, 11:00 am, coldpizza <[EMAIL PROTECTED]> wrote: > Having read through the link below I finally managed to grasp some > concepts that I only read about in the docs but never got to really > understand. Maybe it will be helpful for people like myself who are > not yet fully comfortable with

Re: Help with Iteration

2008-10-17 Thread Aaron &quot;Castironpi" Brady
On Oct 17, 10:44 pm, Chris McComas <[EMAIL PROTECTED]> wrote: > i have a python script that is computing ratings of sports teams. > > what i'm trying to do is setup an iteration for the rating so that the > python program recomputes the rating if any of the value difference is > > > 0.5. it's c

Re: dynamic allocation file buffer

2008-09-10 Thread Aaron &quot;Castironpi" Brady
ed to be processed as streams.  And given > > the right tools, doing that is no harder than doing the same to a 4GB > > text file. > > Fair enough, that's a good point. > > But would you expect random access to a 4GB XML file? If I've understood > what Castironpi

Re: dynamic allocation file buffer

2008-09-10 Thread Aaron &quot;Castironpi" Brady
On Sep 9, 10:03 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Sep 9, 5:59 pm, castironpi <[EMAIL PROTECTED]> wrote: > > > I will try my idea again.  I want to talk to people about a > > module I want to write and I will take the time to explain it. > > I th

Re: Generator functions and user interfaces

2008-09-10 Thread Aaron &quot;Castironpi" Brady
On Sep 10, 10:35 am, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : > > > I'm trying to implement an interactive graph visualisation tool using > > matplotlib. > > > I want to use a spring layout, where nodes repulse each other and > > edges act as springs to pull conn

Re: Reading binary data

2008-09-10 Thread Aaron &quot;Castironpi" Brady
On Sep 10, 1:12 pm, Aaron Scott <[EMAIL PROTECTED]> wrote: > Sorry, I had posted the wrong error. The error I am getting is: > >      struct.error: unpack requires a string argument of length 12 > > which doesn't make sense to me, since I'm specifically asking for 11. > Just for kicks, if I change

Re: dynamic allocation file buffer

2008-09-11 Thread Aaron &quot;Castironpi" Brady
On Sep 11, 2:40 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 10 Sep 2008 11:59:35 -0700, Aaron \"Castironpi\" Brady wrote: > > On Sep 10, 5:24 am, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: > >> On Wed, 10 Sep 2008 09:26:20

Re: dynamic allocation file buffer

2008-09-11 Thread Aaron &quot;Castironpi" Brady
On Sep 11, 5:35 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 11 Sep, 10:34, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > > > > And as I said before, the only use case for *huge* XML files I've ever > > seen used in practice is to store large streams of record-style data; > > I can imagine that t

Re: dict slice in python (translating perl to python)

2008-09-11 Thread Aaron &quot;Castironpi" Brady
On Sep 11, 10:52 am, hofer <[EMAIL PROTECTED]> wrote: > On Sep 11, 10:36 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > >I'd type the explicit > > >  v1,v2,v3 = mydict['one'], mydict['two'], mydict['two'] # 54 chars > Either > > is only a couple more > > characters to  type.  It is completely

Re: dynamic allocation file buffer

2008-09-11 Thread Aaron &quot;Castironpi" Brady
On Sep 11, 10:37 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 11 Sep 2008 10:20:41 -0700, Aaron \"Castironpi\" Brady wrote: > > XML is the wrong word for the example I was thinking of (as was already > > pointed out in another thread).  XML is by d

Re: dynamic allocation file buffer

2008-09-11 Thread Aaron &quot;Castironpi" Brady
On Sep 12, 1:30 am, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 11 Sep 2008 22:40:01 -0700, Dennis Lee Bieber wrote: > > On 12 Sep 2008 03:37:51 GMT, Steven D'Aprano > > <[EMAIL PROTECTED]> declaimed the following in > > comp.lang.python: > > >> I'm pretty sure you're wrong. XML can be use

Re: dynamic allocation file buffer

2008-09-12 Thread Aaron &quot;Castironpi" Brady
On Sep 12, 4:34 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 12 Sep, 08:30, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: > > > Which is why I previously said that XML was not well suited for random > > access. > > Maybe not. No, it's not. Element trees are, which if I just would have said or

Re: lacking follow-through

2008-09-12 Thread Aaron &quot;Castironpi" Brady
On Sep 12, 7:23 am, Steve Holden <[EMAIL PROTECTED]> wrote: > castironpi wrote: > > If you are flattered to be compared to an AI you must come from the same > race as Mr. Spock in Star Trek. No, I said 'for my logic to compared'. Speaking of which, I think you

Re: n00b question: Better Syntax for Coroutines?

2008-09-12 Thread Aaron &quot;Castironpi" Brady
On Sep 12, 8:08 pm, [EMAIL PROTECTED] wrote: > First off, I'm a python n00b, so feel free to comment on anything if > I'm doing it "the wrong way." I'm building a discrete event simulation > tool. I wanted to use coroutines. However, I want to know if there's > any way to hide a yield statement. >

Re: ctypes: Get full contents of character array

2008-09-12 Thread Aaron &quot;Castironpi" Brady
On Sep 12, 6:38 pm, [EMAIL PROTECTED] wrote: > Hello! > > I wanted to get the full contents of a character array stored in a > struct, i.e. > _fields_ = [...("array", c_char * 12)...] > however, ctypes seems to try to return struct.array as a Python string > rather than a character array, and stops

Re: testing if another instance of a script is already running

2008-09-13 Thread Aaron &quot;Castironpi" Brady
On Sep 12, 7:08 am, Strato <[EMAIL PROTECTED]> wrote: > Hi folks, > > I want to write some kind of test to check at startup if another > instance of my script is already running. > > I don't want to handle writing of a PID file because it is too > Unix/Linux specific way to do this, and I need to k

Re: testing if another instance of a script is already running

2008-09-13 Thread Aaron &quot;Castironpi" Brady
On Sep 13, 5:34 pm, [EMAIL PROTECTED] wrote: >     >> I don't want to handle writing of a PID file because it is too >     >> Unix/Linux specific way to do this, and I need to keep the code to be >     >> cross-platform. >     >> >     >> I think the better way to achieve this is to use some proces

Re: Function getting a reference to its own module

2008-09-14 Thread Aaron &quot;Castironpi" Brady
On Sep 14, 4:43 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > On Sep 14, 10:29 am, Steven D'Aprano <[EMAIL PROTECTED] > > > > cybersource.com.au> wrote: > > I have a function that needs a reference to the module object it is > > defined in. (For the reason why, if you care, see the thread "doct

Re: How to marshal objects to readable files?

2008-09-14 Thread Aaron &quot;Castironpi" Brady
On Sep 14, 10:28 am, nielinjie <[EMAIL PROTECTED]> wrote: > Hi list: > I just want to marshal objects (instance of custom classes)to a human > *READABEL *file/string, and also, I want unmarshal it back. in xml > format or any other format. > Any advice? Which lib should I use? > Thanks a lot. Niel

Re: how to exclude specific things when pickling?

2008-09-16 Thread Aaron &quot;Castironpi" Brady
On Sep 14, 9:53 am, "inhahe" <[EMAIL PROTECTED]> wrote: > If I gather correctly pickling an object will pickle its entire hierarchy, > but what if there are certain types of objects anywhere within the hierarchy > that I don't want included in the serialization?  What do I do to exclude > them?   T

Re: How do I add permanently to Pythons sys.path?

2008-09-16 Thread Aaron &quot;Castironpi" Brady
On Sep 16, 10:13 am, cnb <[EMAIL PROTECTED]> wrote: > >>> sys.path > > ['C:\\Python25\\Progs\\NatLangProc', 'C:\\Python25\\Lib\\idlelib', 'C:\ > \Windows\\system32\\python25.zip', 'C:\\Python25\\lib\\site-packages\ > \orange', 'C:\\Python25\\lib\\site-packages\\orange\\OrangeWidgets', > 'C:\\Python

Re: How do I add permanently to Pythons sys.path?

2008-09-16 Thread Aaron &quot;Castironpi" Brady
s.path ['', '/opt/pkgs/python-2.0/lib/python2.0', '/opt/pkgs/python-2.0/lib/ python2.0/plat-sunos5', '/opt/pkgs/python-2.0/lib/python2.0/lib-tk', '/ opt/pkgs/python-2.0/lib/python2.0/lib-dynload', '/opt/pkgs/python-2.0/ lib/python2.0/site-pac

Re: How do I add permanently to Pythons sys.path?

2008-09-16 Thread Aaron &quot;Castironpi" Brady
On Sep 16, 3:16 pm, cnb <[EMAIL PROTECTED]> wrote: > On Sep 16, 7:49 pm, "Aaron \"Castironpi\" Brady" > > > Now I have my personal programs in C:/Python25/Progs/ > > > > How do I add so that I can just do "import somefile" from anywher

Re: How do I add permanently to Pythons sys.path?

2008-09-16 Thread Aaron &quot;Castironpi" Brady
ame thing. > > Sincerely, > Michael H. > > -Original Message- > From: Aaron "Castironpi" Brady [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 16, 2008 12:49 PM > To: [EMAIL PROTECTED] > Subject: Re: How do I add permanently to Pythons sys.path? > > On Sep

Re: How do I add permanently to Pythons sys.path?

2008-09-16 Thread Aaron &quot;Castironpi" Brady
On Sep 16, 4:24 pm, cnb <[EMAIL PROTECTED]> wrote: > On Sep 16, 10:53 pm, "Aaron \"Castironpi\" Brady" > > > > <[EMAIL PROTECTED]> wrote: > > On Sep 16, 3:16 pm, cnb <[EMAIL PROTECTED]> wrote: > > > > On Sep 16, 7:49 pm, &quo

Re: ka-ping yee tokenizer.py

2008-09-16 Thread Aaron &quot;Castironpi" Brady
On Sep 16, 2:48 pm, "Karl Kobata" <[EMAIL PROTECTED]> wrote: > Hi Fredrik, > > This is exactly what I need.  Thank you. > I would like to do one additional function.  I am not using the tokenizer to > parse python code.  It happens to work very well for my application. > However, I would like eithe

Re: Python Linear Programming on Ubuntu

2008-09-16 Thread Aaron &quot;Castironpi" Brady
On Sep 16, 8:50 pm, Fett <[EMAIL PROTECTED]> wrote: > I am trying to find a wrapper to do linear programming within python. > I am using an ubuntu machine and I have apt-get'd lp_solve, which > works just fine. If someone knows of a wrapper that will work with > that that'd be great. > > I also hea

Re: Python Linear Programming on Ubuntu

2008-09-16 Thread Aaron &quot;Castironpi" Brady
On Sep 16, 9:25 pm, Fett <[EMAIL PROTECTED]> wrote: > On Sep 16, 9:00 pm, "Aaron \"Castironpi\" Brady" > > > > <[EMAIL PROTECTED]> wrote: > > On Sep 16, 8:50 pm, Fett <[EMAIL PROTECTED]> wrote: > > > > I am trying to find a wra

minimum install & pickling

2008-09-16 Thread Aaron &quot;Castironpi" Brady
Sometimes questions come up on here about unpickling safely and executing foreign code. I was thinking a minimum install that didn't even have access to modules like 'os' could be safe. (Potentially.) I have time to entertain this a little, though all the devs are busy. I can bring it up again i

Re: minimum install & pickling

2008-09-17 Thread Aaron &quot;Castironpi" Brady
On Sep 17, 4:43 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 17 Sep, 07:26, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> > wrote: > > > Sometimes questions come up on here about unpickling safely and > > executing foreign code.  I was

Re: decorator and API

2008-09-17 Thread Aaron &quot;Castironpi" Brady
On Sep 17, 4:56 pm, Lee Harr <[EMAIL PROTECTED]> wrote: > I have a class with certain methods from which I want to select > one at random, with weighting. > > The way I have done it is this > > import random > > def weight(value): >     def set_weight(method): >         method.weight = value >

Re: decorator and API

2008-09-17 Thread Aaron &quot;Castironpi" Brady
On Sep 17, 6:09 pm, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Sep 17, 4:56 pm, Lee Harr <[EMAIL PROTECTED]> wrote: > > > > > I have a class with certain methods from which I want to select > > one at random, with wei

Re: minimum install & pickling

2008-09-17 Thread Aaron &quot;Castironpi" Brady
On Sep 17, 6:06 pm, greg <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady wrote: > > Even a function created from raw bytecode string can't do anything > > without __import__ or 'open'. > > Not true: > >    for cls in (1).__cla

Re: minimum install & pickling

2008-09-18 Thread Aaron &quot;Castironpi" Brady
On Sep 18, 5:20 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > On 17 Sep, 22:18, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> > wrote: > > > On Sep 17, 4:43 am, Paul Boddie <[EMAIL PROTECTED]> wrote: > > > >http://wiki.python.o

Re: Extracting hte font name from a TrueType font file

2008-09-18 Thread Aaron &quot;Castironpi" Brady
On Sep 18, 7:48 pm, Steve Holden <[EMAIL PROTECTED]> wrote: > Fredrik Lundh wrote: > > Steve Holden wrote: > > >> Does anyone have a Python recipe for this? > > from PIL import ImageFont > f = ImageFont.truetype("/windows/fonts/verdanai.ttf", 1) > f.font.family > > 'Verdana' > f

Re: migrating processess to avoid the GIL

2008-09-19 Thread Aaron &quot;Castironpi" Brady
On Sep 19, 6:40 pm, "Patrick Stinson" <[EMAIL PROTECTED]> wrote: > I need to migrate calls to CPython to another process in my C++ app to > get around the GIL. Does anyone know of a good way to do this on > windows and Mac? All calls and callbacks can be blocking, I just need > to share some data s

Re: Not fully OO ?

2008-09-20 Thread Aaron &quot;Castironpi" Brady
On Sep 20, 5:14 am, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Kay Schluehr wrote: > > Answer: if you want to define an entity it has to be defined inside a > > class. If you want to access an entity you have to use the dot > > operator. Therefore Java is OO but Python is not. > > you're satirising

Re: Not fully OO ?

2008-09-20 Thread Aaron &quot;Castironpi" Brady
On Sep 20, 3:22 pm, Kay Schluehr <[EMAIL PROTECTED]> wrote: > On 20 Sep., 18:33, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > > The following definitions are AFAIK the only commonly accepted > > definitions about OO: > > > 1/ an object is defined by identity, state and behaviour > > 2/ obj

Re: Not fully OO ?

2008-09-20 Thread Aaron &quot;Castironpi" Brady
On Sep 20, 8:06 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > Kay Schluehr wrote: > > Actually it is simply wrong in the mentioned case and here is the > > proof: > > > def foo(): > >     return 2+2 > > > import dis > > dis.dis(foo) > > >   2           0 LOAD_CONST              

Re: writeable buffer and struct.pack_into and struct.unpck_from

2008-09-20 Thread Aaron &quot;Castironpi" Brady
On Sep 20, 6:42 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Sat, 20 Sep 2008 15:45:48 -0300, Tzury Bar Yochay   > <[EMAIL PROTECTED]> escribió: > > > I can't find in the documentation the way to use these two functions. > > > can someone share a simple code that utilize these two functi

Re: improving a huge double-for cycle

2008-09-20 Thread Aaron &quot;Castironpi" Brady
On Sep 20, 9:20 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 20 Sep 2008 19:01:42 +0200, Bruno Desthuilliers wrote: > > Once again, sorry > > if me missing your correct answer drives you paranoid :-) > > What do you mean by that? How many other people have been talkin

Re: What do you call a class not intended to be instantiated

2008-09-21 Thread Aaron &quot;Castironpi" Brady
On Sep 21, 6:05 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > Fixing top-posting. > > On Mon, 22 Sep 2008 08:54:43 +1000, James Mills wrote: > > On Mon, Sep 22, 2008 at 8:39 AM, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: > >> I have a class which is not intended to be inst

Re: What do you call a class not intended to be instantiated

2008-09-22 Thread Aaron &quot;Castironpi" Brady
On Sep 22, 8:45 am, "Tim Rowe" <[EMAIL PROTECTED]> wrote: > 2008/9/22 Bruno Desthuilliers <[EMAIL PROTECTED]>: > > >> Sounds to me like a functor, aka a function object: > >>http://en.wikipedia.org/wiki/Function_object > > > Ok, then the simple solution is to implement a callable type (__call__ > >

Re: What do you call a class not intended to be instantiated

2008-09-22 Thread Aaron &quot;Castironpi" Brady
On Sep 22, 2:38 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady a écrit : > > > > > On Sep 22, 8:45 am, "Tim Rowe" <[EMAIL PROTECTED]> wrote: > >> 2008/9/22 Bruno Desthuilliers <[EMAIL PROTECTED]

Re: What do you call a class not intended to be instantiated

2008-09-22 Thread Aaron &quot;Castironpi" Brady
On Sep 22, 3:28 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady a écrit : > > > On Sep 22, 2:38 pm, Bruno Desthuilliers > > <[EMAIL PROTECTED]> wrote: > (snip) > >> Going back to robot-mode, Aaron ? > > > No

Re: What do you call a class not intended to be instantiated

2008-09-22 Thread Aaron &quot;Castironpi" Brady
On Sep 22, 5:32 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Mon, 22 Sep 2008 19:41:46 +1000, James Mills wrote: > > On 22 Sep 2008 09:07:43 GMT, Steven D'Aprano > >> But that's precisely what I want to avoid: I don't want the objects to > >>  share *any* state, not even t

Re: a short-cut command for globals().clear() ??

2008-09-22 Thread Aaron &quot;Castironpi" Brady
On Sep 22, 5:44 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > forgive me , but the RTFM and Google search approaches are not > > yielding an answer on this question.  I need to know if there's a top > > level python interpreter command that clears all user variables (not

Re: What do you call a class not intended to be instantiated

2008-09-22 Thread Aaron &quot;Castironpi" Brady
On Sep 22, 6:55 pm, MRAB <[EMAIL PROTECTED]> wrote: > On Sep 22, 11:46 pm, "Aaron \"Castironpi\" Brady" > > > > <[EMAIL PROTECTED]> wrote: > > On Sep 22, 5:32 pm, Steven D'Aprano <[EMAIL PROTECTED] > > > cybersource.com.

Re: Why no tailcall-optimization?

2008-09-22 Thread Aaron &quot;Castironpi" Brady
On Sep 22, 8:13 pm, process <[EMAIL PROTECTED]> wrote: > Why doesn't Python optimize tailcalls? Are there plans for it? > > I know GvR dislikes some of the functional additions like reduce and > Python is supposedly about "one preferrable way of doing things" but > not being able to use recursion p

Re: How do I convert a PyObject to string in C++?

2008-09-22 Thread Aaron &quot;Castironpi" Brady
On Sep 22, 9:32 pm, [EMAIL PROTECTED] wrote: > I have a PyObject, say 'Hello World' , a string, > How do I convert it to a string in C++? > Thanks in advance! Look at PyString_AsStringAndSize . It gives you a pointer to a buffer and a size. Allocate a new one and copy it if you need to modify it

Re: Visualize class inheritance hierarchy

2008-09-23 Thread Aaron &quot;Castironpi" Brady
On Sep 23, 5:53 pm, Rob Kirkpatrick <[EMAIL PROTECTED]> wrote: > Hi All, > > I just finished debugging some code where I needed to determine why > one subclass had a bound method and another did not.  They had > different pedigree's but I didn't know immediately what the > differences were. > > I e

Re: Visualize class inheritance hierarchy

2008-09-23 Thread Aaron &quot;Castironpi" Brady
On Sep 23, 5:53 pm, Rob Kirkpatrick <[EMAIL PROTECTED]> wrote: > Hi All, > > I just finished debugging some code where I needed to determine why > one subclass had a bound method and another did not.  They had > different pedigree's but I didn't know immediately what the > differences were. > > I e

Re: python syntax for conditional is unfortunate

2008-09-23 Thread Aaron &quot;Castironpi" Brady
On Sep 23, 6:52 pm, Neal Becker <[EMAIL PROTECTED]> wrote: > In hindsight, I am disappointed with the choice of conditional syntax.  I > know it's too late to change.  The problem is > > y = some thing or other if x else something_else > > When scanning this my eye tends to see the first phrase an

Re: How do I use python object in C++

2008-09-23 Thread Aaron &quot;Castironpi" Brady
On Sep 23, 7:50 pm, [EMAIL PROTECTED] wrote: > for example I have the following code: > > #include > > void exec_pythoncode( int arg, char**argv ) > { >     Py_Initialize(); >     Py_Main(argc,argv); >     Py_Finalize(); > > } > > What I would like to know is how can I get the variables I want > a

Re: how to keep a window above all other OS windows?

2008-09-23 Thread Aaron &quot;Castironpi" Brady
On Sep 23, 3:34 pm, dmitrey <[EMAIL PROTECTED]> wrote: > On Sep 23, 11:21 pm, dmitrey <[EMAIL PROTECTED]> wrote: > > > Hi all, > > how to keep a Tkinter window above all other OS windows (i.e. > > including those ones from other programs)? > > > Thank you in advance, > > Dmitrey > > I have put [Tki

Re: python syntax for conditional is unfortunate

2008-09-23 Thread Aaron &quot;Castironpi" Brady
On Sep 23, 8:50 pm, Neal Becker <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady wrote: > > On Sep 23, 6:52 pm, Neal Becker <[EMAIL PROTECTED]> wrote: > >> In hindsight, I am disappointed with the choice of conditional syntax.  I > >> know

Re: How do I use python object in C++

2008-09-23 Thread Aaron &quot;Castironpi" Brady
On Sep 23, 9:30 pm, [EMAIL PROTECTED] wrote: > If the PyObject is a PyList, and all list items are strings, > say a=['aaa','bbb','ccc'] > > How can I have a > myArray[0] = "aaa" > myArray[1] = "bbb" > myArray[2] = "ccc" > in C++? > > Do I have to > use PyModule_GetDict() to get the dict first? > wh

Re: How do I use python object in C++

2008-09-23 Thread Aaron &quot;Castironpi" Brady
On Sep 23, 11:06 pm, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Sep 23, 9:30 pm, [EMAIL PROTECTED] wrote: > > > > > If the PyObject is a PyList, and all list items are strings, > > say a=['aaa','bbb',

Re: PyRun_SimpleFile() crashes

2008-09-24 Thread Aaron &quot;Castironpi" Brady
On Sep 24, 6:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >  my code: > >  main.cpp > >  #include > > >  int main(int argc, char **argv) > >  { > >  Py_Initialize(); > > >  FILE *file_1 = fopen("a2l_reader.py","r+"); > >  PyRun_SimpleFile(file_

Re: PyRun_SimpleFile() crashes

2008-09-24 Thread Aaron &quot;Castironpi" Brady
On Sep 24, 11:05 am, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Sep 24, 6:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > >  my code: > &g

Er, one -lime- or two.

2008-09-24 Thread Aaron &quot;Castironpi" Brady
A Python walks into a bar and orders a complex data structure. Bartender says, "One line or two?" -- http://mail.python.org/mailman/listinfo/python-list

Re: python syntax for conditional is unfortunate

2008-09-24 Thread Aaron &quot;Castironpi" Brady
On Sep 24, 8:40 pm, Asun Friere <[EMAIL PROTECTED]> wrote: > On Sep 25, 3:16 am, Pete Forman <[EMAIL PROTECTED]> wrote: > > > Asun Friere <[EMAIL PROTECTED]> writes: > > >  > A canonical use of the conditional operator is in > >  > pluralising words, (eg. '%s dollar' % n + 's' if n!=1 else ''). > >

Re: python syntax for conditional is unfortunate

2008-09-24 Thread Aaron &quot;Castironpi" Brady
On Sep 24, 9:49 pm, Asun Friere <[EMAIL PROTECTED]> wrote: > On Sep 25, 11:57 am, "Aaron \"Castironpi\" Brady" > > <[EMAIL PROTECTED]> wrote: > > On Sep 24, 8:40 pm, Asun Friere <[EMAIL PROTECTED]> wrote: > > > ... I think

Re: is decorator the right thing to use?

2008-09-24 Thread Aaron &quot;Castironpi" Brady
On Sep 24, 5:21 pm, "Dmitry S. Makovey" <[EMAIL PROTECTED]> wrote: > Hi, > > after hearing a lot about decorators and never actually using one I have > decided to give it a try. My particular usecase is that I have class that > acts as a proxy to other classes (i.e. passes messages along to those >

Re: Er, one -lime- or two.

2008-09-25 Thread Aaron &quot;Castironpi" Brady
On Sep 25, 3:09 am, Bruno Desthuilliers wrote: > Aaron "Castironpi" Brady a écrit : > > > A Python walks into a bar and orders a complex data structure. > > Bartender says, "One line or two?" > > I don't think that one will have much success

Re: is decorator the right thing to use?

2008-09-25 Thread Aaron &quot;Castironpi" Brady
On Sep 25, 12:19 pm, Bruno Desthuilliers wrote: > Dmitry S. Makovey a écrit : > > > > > Thanks Bruno, > > > your comments were really helpful (so was the "improved" version of code). > > > My replies below: > > > Bruno Desthuilliers wrote: > >>> So decorators inside of B just identify that those m

Re: is decorator the right thing to use?

2008-09-25 Thread Aaron &quot;Castironpi" Brady
On Sep 25, 1:22 pm, "Dmitry S. Makovey" <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady wrote: > > You should write it like this: > > > class B(object): > >     [EMAIL PROTECTED] > >      def bmethod(self,a): > > > Mak

Re: PEP Proposal

2008-09-25 Thread Aaron &quot;Castironpi" Brady
On Sep 25, 2:24 pm, [EMAIL PROTECTED] wrote: > Hi, > > sorry, I have these ideas for longer than 10 years, please have a look on it > and comment on it. Thx. > > > > This is another proposal for introducing types into Python. > > There are many reasons for incorporating types into Python, but

Re: is decorator the right thing to use?

2008-09-26 Thread Aaron &quot;Castironpi" Brady
On Sep 26, 10:41 am, "Dmitry S. Makovey" <[EMAIL PROTECTED]> wrote: > Paul McGuire wrote: > > If you need to get fancier and support this single-proxy-to-multiple- > > delegates form, then yes, you will need some kind of map that says > > which method should delegate to which object.  Or, if it is

Re: Building truth tables

2008-09-26 Thread Aaron &quot;Castironpi" Brady
On Sep 26, 11:40 am, "Tim Rowe" <[EMAIL PROTECTED]> wrote: > 2008/9/26 andrea <[EMAIL PROTECTED]>: > > > Well I would like to make a little program that given a certain > > logical expression gives the complete truth table. > > > It's not too difficult in fact, I just have some doubts on how to > >

Re: Are spams on comp.lang.python a major nuisance?

2008-09-26 Thread Aaron &quot;Castironpi" Brady
On Sep 26, 11:43 am, "Tim Rowe" <[EMAIL PROTECTED]> wrote: > 2008/9/26 Steven D'Aprano <[EMAIL PROTECTED]>: > > > I don't have any objective numbers, but subjectively it seems to me that > > the number of spams is significantly higher, but not so high as to be a > > major nuisance. > > I consider *

Re: Not fully OO ?

2008-09-26 Thread Aaron &quot;Castironpi" Brady
On Sep 26, 11:48 am, "Tim Rowe" <[EMAIL PROTECTED]> wrote: > 2008/9/26 Tino Wildenhain <[EMAIL PROTECTED]>: > > >> The question I usually ask is "Does this language help me get the job > >> done?" Python often does. That's all that really matters, isn't it? > > > Well then it still depends on the

Re: is decorator the right thing to use?

2008-09-26 Thread Aaron &quot;Castironpi" Brady
On Sep 26, 3:03 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Dmitry S. Makovey a écrit : > > > > > Paul McGuire wrote: > >>> see, in your code you're assuming that there's only 1 property ( 'b' ) > >>> inside of A that needs proxying. In reality I have several. > > > >> No, really, Diez ha

Re: Not fully OO ?

2008-09-26 Thread Aaron &quot;Castironpi" Brady
On Sep 26, 11:48 am, "Tim Rowe" <[EMAIL PROTECTED]> wrote: > 2008/9/26 Tino Wildenhain <[EMAIL PROTECTED]>: > > >> The question I usually ask is "Does this language help me get the job > >> done?" Python often does. That's all that really matters, isn't it? > > > Well then it still depends on the p

Re: Are spams on comp.lang.python a major nuisance?

2008-09-26 Thread Aaron &quot;Castironpi" Brady
On Sep 26, 6:31 am, [EMAIL PROTECTED] wrote: > I took over spam filter management for the python.org mailing lists a couple > months ago and made a few changes to the way the spam filter is trained. > Things seem to be at a reasonable level as far as I can tell (I see a few > spams leak through eac

Re: Not fully OO ?

2008-09-26 Thread Aaron &quot;Castironpi" Brady
On Sep 26, 6:40 pm, "Tim Rowe" <[EMAIL PROTECTED]> wrote: > 2008/9/26 Aaron Castironpi Brady <[EMAIL PROTECTED]>: > > > If you have wxFormBuilder and the win32 library, it's pretty fast. > > Speed has never been an issue for me with Python. For my mas

Re: Not fully OO ?

2008-09-26 Thread Aaron &quot;Castironpi" Brady
On Sep 26, 8:10 pm, "Tim Rowe" <[EMAIL PROTECTED]> wrote: > 2008/9/27 Aaron Castironpi Brady <[EMAIL PROTECTED]>: > > > But I, and I imagine I'm not the only one, would love to know the > > example that C# developed faster than Python.  I suppose the fa

Re: getting global variables from dictionary

2008-09-26 Thread Aaron &quot;Castironpi" Brady
On Sep 26, 9:01 pm, icarus <[EMAIL PROTECTED]> wrote: > global_vars.py has the global variables > set_var.py changes one of the values on the global variables (don't > close it or terminate) > get_var.py retrieves the recently value changed (triggered right after > set_var.py above) > > Problem: ge

Re: Are spams on comp.lang.python a major nuisance?

2008-09-26 Thread Aaron &quot;Castironpi" Brady
On Sep 26, 9:09 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Sep 26, 9:30 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > > > On 2008-09-26, nntpman68 <[EMAIL PROTECTED]> wrote: > > > > Hm, > > > > I guess you just filter mailing lists and can do nothing about the > > > newsgroup if I'm fetchin

Re: Are spams on comp.lang.python a major nuisance?

2008-09-26 Thread Aaron &quot;Castironpi" Brady
On Sep 26, 9:33 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > George Sakkis <[EMAIL PROTECTED]> writes: > > On Sep 26, 9:30 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > > > I read the group via NNTP, and I find that blocking all articles > > > posted from google.groups gets rid of all of the spam.

Re: Are spams on comp.lang.python a major nuisance?

2008-09-27 Thread Aaron &quot;Castironpi" Brady
On Sep 26, 1:04 pm, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Sep 26, 11:43 am, "Tim Rowe" <[EMAIL PROTECTED]> wrote: > > > 2008/9/26 Steven D'Aprano <[EMAIL PROTECTED]>: > > > > I don't have any

Re: What do you call a class not intended to be instantiated

2008-09-27 Thread Aaron &quot;Castironpi" Brady
On Sep 27, 5:33 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 27 Sep 2008 18:20:17 +1000, Ben Finney wrote: > > Steven D'Aprano <[EMAIL PROTECTED]> writes: > > >> On Fri, 26 Sep 2008 22:15:43 -0700, Aahz wrote: > >> > An ordinary singleton is instantiating the class mu

Re: Are spams on comp.lang.python a major nuisance?

2008-09-27 Thread Aaron &quot;Castironpi" Brady
On Sep 27, 7:28 am, "Dotan Cohen" <[EMAIL PROTECTED]> wrote: > 2008/9/27 Aaron Castironpi Brady <[EMAIL PROTECTED]>: > > >> I think in June and July they were selling watches a lot which I > >> haven't noticed recently. > > > Gucci

Re: What do you call a class not intended to be instantiated

2008-09-27 Thread Aaron &quot;Castironpi" Brady
On Sep 27, 6:16 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Aaron "Castironpi" Brady wrote: > >>>> class A(type): > > ...     def __call__( self, *ar ): > > ...             print 'call', self, ar > > ... > >>>> c

Re: Not fully OO ?

2008-09-27 Thread Aaron &quot;Castironpi" Brady
On Sep 27, 6:55 pm, "Tim Rowe" <[EMAIL PROTECTED]> wrote: > 2008/9/27 Aaron Castironpi Brady <[EMAIL PROTECTED]>: > > > No way.  It's *zero* instead of one, if so, because the only thing C# > > has is a bunch of handcuffs and implicit 'self'.

closures and dynamic binding

2008-09-27 Thread Aaron &quot;Castironpi" Brady
Hello all, To me, this is a somewhat unintuitive behavior. I want to discuss the parts of it I don't understand. >>> f= [ None ]* 10 >>> for n in range( 10 ): ... f[ n ]= lambda: n ... >>> f[0]() 9 >>> f[1]() 9 I guess I can accept this part so far, though it took a little getting used to.

Re: closures and dynamic binding

2008-09-28 Thread Aaron &quot;Castironpi" Brady
On Sep 28, 1:14 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sat, 27 Sep 2008 21:43:15 -0700, Aaron \"Castironpi\" Brady wrote: > > To me, this is a somewhat unintuitive behavior.  I want to discuss the > > parts of it I don't unders

Re: closures and dynamic binding

2008-09-28 Thread Aaron &quot;Castironpi" Brady
On Sep 28, 2:52 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 27 Sep 2008 21:43:15 -0700, Aaron \"Castironpi\" Brady wrote: > > Hello all, > > > To me, this is a somewhat unintuitive behavior.  I want to discuss the > &g

<    5   6   7   8   9   10   11   >