Re: Finding the instance reference of an object

2008-11-03 Thread Aaron Brady
On Nov 3, 2:44 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 3, 2008, at 12:00 PM, Aaron Brady wrote: > > > I think we can conclude that Python passes by reference, since a > > function can modify objects that were passed in to it. > > Then please write the

Re: Structures

2008-11-03 Thread Aaron Brady
On Nov 3, 3:45 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > "Paulo J. Matos" <[EMAIL PROTECTED]> writes: > > > On Mon, Nov 3, 2008 at 12:32 PM, Ben Finney > > <[EMAIL PROTECTED]> wrote: > > > I'm wondering a more fundamental question: What are structures? > > > That is, what do *you* mean by that te

Re: Unyeilding a permutation generator

2008-11-03 Thread Aaron Brady
On Nov 3, 4:13 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Mon, 03 Nov 2008 21:09:58 +, Jorgen Grahn wrote: > > Why multi-threading?  I see no concurrency in the original algorithm. > > There is, in my mind, nothing concurrent about 'yield'. > > No "real" concurrency but a gene

Re: Structures

2008-11-03 Thread Aaron Brady
On Nov 3, 6:33 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > On Nov 3, 6:32 pm, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote: > > > Even though I can use dicts where the keys are strings (as if it were > > the name of the field), it seems to heavy, since a structure doesn't > > need to be resizable

Re: Structures

2008-11-03 Thread Aaron Brady
On Nov 3, 5:38 pm, "Paulo J. Matos" <[EMAIL PROTECTED]> wrote: > On Mon, Nov 3, 2008 at 10:19 PM, Aaron Brady <[EMAIL PROTECTED]> wrote: > > On Nov 3, 3:45 pm, Ben Finney <[EMAIL PROTECTED]> > > wrote: > >> "Paulo J. Matos" <[EMAIL

Re: Finding the instance reference of an object

2008-11-03 Thread Aaron Brady
On Nov 3, 8:33 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 3, 2008, at 5:27 PM, Marc 'BlackJack' Rintsch wrote: > > > Maybe this is a surprise for you, because we haven't discussed this in > > much detail in this group lately, but it applies to Python which does > > call-by-object or call-by

Re: Building loop with some exceptions?

2008-11-04 Thread Aaron Brady
On Nov 4, 1:20 pm, Gilles Ganault <[EMAIL PROTECTED]> wrote: > Hello > > I need to call a URL through a loop that starts at 01 and ends at 99, > but some of the steps must be ignored: > > = > url = "http://www.acme.com/list?code="; > p = re.compile("^(\d+)\t(.+)$") > > for i=01 to 99 except 04,

Re: Building loop with some exceptions?

2008-11-04 Thread Aaron Brady
On Nov 4, 1:26 pm, Gilles Ganault <[EMAIL PROTECTED]> wrote: > On Tue, 4 Nov 2008 11:22:27 -0800 (PST), Aaron Brady > > <[EMAIL PROTECTED]> wrote: > >> for i=01 to 99 except 04, 34, 40, 44, 48, 54, 57, 67, 76, 83, 89: > > >sorted( list( set( domain ) - set

Re: Finding the instance reference of an object

2008-11-04 Thread Aaron Brady
On Nov 4, 5:02 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 4, 2008, at 3:42 PM, Steven D'Aprano wrote: > > When we're talking about the value of a variable in Python, why on   > > earth > > would you drag entities that do not exist in Python into the   > > discussion? > > I don't, but others

Re: locating the chorus in a MIDI song?

2008-11-06 Thread Aaron Brady
On Nov 3, 10:20 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > We've got a need to generate short "samples" of songs that are in MIDI   > format, to provide a preview function in a web app.  We'd like to do   > something more clever than just taking the middle 20 seconds (or   > whatever) of the song

Re: How to re-import a function from a module?

2008-11-06 Thread Aaron Brady
On Nov 5, 7:36 pm, Kurda Yon <[EMAIL PROTECTED]> wrote: > Hi, > > I have the following small problem. I run Python interactively. In the > beginning of the run I import many functions from many modules. Than I > execute some commands and notice that one of the imported functions > contains a mistak

Re: Step-by-step exec

2008-11-06 Thread Aaron Brady
On Nov 6, 7:11 am, [EMAIL PROTECTED] wrote: > On Nov 6, 1:02 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > On Nov 6, 4:27 pm, [EMAIL PROTECTED] wrote: > > > > Hi, > > > > I am using a small python file as an input file (defining constants, > > > parameters, input data, ...) for a pytho

Re: I need a simple windows form handle.

2008-11-06 Thread Aaron Brady
On Nov 6, 7:50 am, 一首诗 <[EMAIL PROTECTED]> wrote: > Hi all, > > Today I was writing a simple test app for a video decoder library. > > I use python to parse video files and input data to the library. > > I got a problem here, I need a windows form, and send the form handle > to the library as a pa

Re: List to Text back to List

2008-11-06 Thread Aaron Brady
On Nov 6, 2:18 pm, SimonPalmer <[EMAIL PROTECTED]> wrote: > On Nov 6, 8:11 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote: > > > > > On Thu, Nov 6, 2008 at 12:04 PM, SimonPalmer <[EMAIL PROTECTED]> wrote: > > > Hi, I am looking for a way to convert a List of floating point numbers > > > to and from t

Re: Finding the instance reference of an object

2008-11-06 Thread Aaron Brady
On Nov 6, 1:44 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > I know this thread has grown quite personal for some of its > participants.  I am posting in a spirit of peace and understanding :) Hear, hear. > You refer to docs about the *implementation* of Python in C.  This is > irrelevant. >

Re: Finding the instance reference of an object

2008-11-06 Thread Aaron Brady
On Nov 6, 6:00 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Aaron Brady wrote: > > and you can't have languages without implementations. > > This is either a claim that languages are their own implementations, or > an admission that human brains are the implementation

Re: I need a simple windows form handle.

2008-11-06 Thread Aaron Brady
On Nov 6, 7:58 pm, 一首诗 <[EMAIL PROTECTED]> wrote: > On Nov 7, 4:55 am, Aaron Brady <[EMAIL PROTECTED]> wrote: > > > > > On Nov 6, 7:50 am, 一首诗 <[EMAIL PROTECTED]> wrote: > > > > Hi all, > > > > Today I was writing a simple test app for

Does Python have Multiple Inheritance ?

2008-11-07 Thread Aaron Gray
Wikipedia says Python has Multiple Inheritance, is this true ? http://en.wikipedia.org/wiki/Multiple_inheritance Thanks, Aaron -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python have Multiple Inheritance ?

2008-11-07 Thread Aaron Gray
"Roy Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > In article <[EMAIL PROTECTED]>, > Tim Golden <[EMAIL PROTECTED]> wrote: > >> Aaron Gray wrote: >> > Wikipedia says Python has Multiple Inheritance, is th

Re: overloading for ladder logic

2008-11-07 Thread Aaron Brady
On Nov 7, 7:48 am, [EMAIL PROTECTED] wrote: > I am trying to simulate the execution of some PLC ladder logic in > python. > > I manually modified the rungs and executed this within python as a > proof of concept, but I'd like to be able to skip the  modification > step.  My thought was that this mi

Re: (Windows) "Dropping" stuff onto a Python script

2008-11-07 Thread Aaron Brady
On Nov 6, 2:56 am, [EMAIL PROTECTED] wrote: > Hello people, > > I'd like to have the functionality known from "real" executables that > if I drag-drop a file icon on top of the app, the app starts and has > the file's path as command-line argument. > > However, this doesn't seem to work with Python

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Aaron Brady
On Nov 7, 3:03 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > Joe Strout <[EMAIL PROTECTED]> writes: > > So.  How about this for a summary? > > > "Python uses call-by-sharing.  That's a special case of call-by-value > > where the variables are references to objects; it is these references > > th

Re: Finding the instance reference of an object [long and probably boring]

2008-11-07 Thread Aaron Brady
On Nov 7, 3:39 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > Aaron Brady <[EMAIL PROTECTED]> writes: > >  Furthermore, some class models variables like this: > > > a.b= 'abc' > > a.c= 'def' > > a.d= 'ghi' > > >

Re: using exec() to instantiate a new object.

2008-11-07 Thread Aaron Brady
On Nov 7, 4:23 pm, RyanN <[EMAIL PROTECTED]> wrote: > Hello, > > I'm trying to teach myself OOP to do a data project involving > hierarchical data structures. > > I've come up with an analogy for testing involving objects for > continents, countries, and states where each object contains some > att

Re: Is there a way to step debug the multiprocessing python program?

2008-11-07 Thread Aaron Brady
On Nov 7, 9:15 pm, "davy zhang" <[EMAIL PROTECTED]> wrote: > I mean every process attach like thread in wingide > > like thread or tasklet in wingide > > :) > > maybe I asked t much:D Here is where 'multiprocessing' assembles the command line to spawn the subprocess (Windows version):

Re: Finding the instance reference of an object [long and probably boring]

2008-11-08 Thread Aaron Brady
On Nov 8, 8:42 am, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 7, 2008, at 6:21 PM, Aaron Brady wrote: > > > Therefore objects don't need names to exist.  Having a name is > > sufficient but not necessary to exist.  Being in a container is > > neither necessar

Re: Finding the instance reference of an object

2008-11-08 Thread Aaron Brady
On Nov 8, 1:08 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 08 Nov 2008 18:31:47 +1300, greg wrote: > There's no "obviously" about it. To anyone who has learned that "call-by- > value" means that a copy is made, "obviously" it does mean copying the > value. If yo

Re: Finding the instance reference of an object

2008-11-08 Thread Aaron Brady
On Nov 8, 3:38 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > "In order for code A to call code B, some information must be > communicated from A to B."  Something we all know ... > > "That information is a value of some sort." True... > > "Therefore all calling is calling by value." > > Well, yes, i

Re: ctypes shared object FILE*

2008-11-08 Thread Aaron Brady
On Nov 8, 6:34 pm, "Dog Walker" <[EMAIL PROTECTED]> wrote: > I need to call a function in a shared object with this signature: > init_dialog(FILE *input, FILE *output) > The FILE*'s are to stdin and stdout. > > The call from python is libdialog.init_dialog( x, y) > I need to define x and y so that

Re: Finding the instance reference of an object

2008-11-08 Thread Aaron Brady
On Nov 8, 10:59 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > Of course, I've softened my position somewhat, since being shown that   > "call by sharing" is simply a term for call-by-value in the case where   > the values are object references.  That clearly does apply to Python   > (as well as other

Re: Finding the instance reference of an object [long and probably boring]

2008-11-10 Thread Aaron Brady
On Nov 7, 3:03 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > 1. Is Napoleon a copy of Dobby or are they the same cat? > > 2. Is Polion a copy of Napoleon or are they the same cat? > > 3. When we got rid of Napoleon's fleas, was Nelson deflea-ed as well? > > 4. When Napoleon died, did Nelson die

Re: Finding the instance reference of an object [long and probably boring]

2008-11-10 Thread Aaron Brady
On Nov 10, 2:45 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > Aaron Brady <[EMAIL PROTECTED]> writes: > > Do you ever say to someone, "'Napoleon' will no longer refer to > > Nelson.  It is this lobster now instead", while you are holding a > &g

Re: loading modules, metaclasses, chicken & eggs

2008-11-12 Thread Aaron Brady
On Nov 12, 9:38 am, sandro <[EMAIL PROTECTED]> wrote: > Hi, > Is there a way to solve this? I'd like ro force a reload of the > metaclass after 'debug'  has been loaded and debug.DBG set to True, > but that doesn't seem to happen... > > Any hints? > > sandro > *:-) > > sqlkit:  http://sqlkit.argoli

Re: loading modules, metaclasses, chicken & eggs

2008-11-12 Thread Aaron Brady
On Nov 12, 3:01 pm, sandro <[EMAIL PROTECTED]> wrote: > Aaron Brady wrote: > > On Nov 12, 9:38 am, sandro <[EMAIL PROTECTED] wrote: > >> Hi, > >> Is there a way to solve this? I'd like ro force a reload of the > >> metaclass after 'debug

Re: memory mapped tar file contents

2008-11-12 Thread Aaron Brady
On Nov 12, 8:51 pm, Chris Brooks <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to read directly from a tar file into memory so I can > manipulate a file (quickly) and write its changes out to another file.  I > thought I could do something like: > > #!/usr/bin/env python > > import tarfile > im

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

2008-11-13 Thread Aaron Brady
On Nov 13, 3:44 am, greg <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: > > I stopped paying much attention to this thread a while ago, but > > you've got to admire the persistence of somebody who soldiers > > on even though Aahz, Fredrik Lund, and Steve Holden are all on > > the other side of t

Re: using "private" parameters as static storage?

2008-11-13 Thread Aaron Brady
On Nov 13, 11:16 am, Joe Strout <[EMAIL PROTECTED]> wrote: > One thing I miss as I move from REALbasic to Python is the ability to   > have static storage within a method -- i.e. storage that is persistent   > between calls, but not visible outside the method.  I frequently use   > this for such th

Re: The return code

2008-11-13 Thread Aaron Brady
On Nov 13, 6:15 am, "devi thapa" <[EMAIL PROTECTED]> wrote: > Hi, > >           I am running one service in the python script eg like > "service httpd status". > If I execute this command in normal shell kernel, the return code is > 3. But in the python script its return code is different, ie not 3

Re: using "private" parameters as static storage?

2008-11-13 Thread Aaron Brady
On Nov 13, 4:13 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Nov 13, 3:08 pm, Aaron Brady <[EMAIL PROTECTED]> wrote: > > > > > On Nov 13, 11:16 am, Joe Strout <[EMAIL PROTECTED]> wrote: > > > > One thing I miss as I move from REALbasic to Pyth

Re: How to use a contiguous memory location of n bytes in python

2008-11-14 Thread Aaron Brady
On Nov 13, 6:40 pm, [EMAIL PROTECTED] wrote: > chachi: > > > I want to know how to instantiate a data structure which has n bytes > > (given by me) and is internally stored in a contiguous fashion. > > array.array("B", ...) may be fit for you. You can also use a numpy > array of bytes. > > Bye, > b

Re: Code generation architecture question

2008-11-14 Thread Aaron Brady
On Nov 13, 7:16 pm, Alex_Gaynor <[EMAIL PROTECTED]> wrote: > I'm trying to figure out what the best architecture for doing code > generation would be.  I have a set of ASTs that define a program, so > what should I do to for code generation.  As I see it the 2 choices > are to have the ASTs have a

Re: To throw or to throw not?

2008-11-14 Thread Aaron Brady
On Nov 13, 10:09 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 13 Nov 2008 17:11:26 -0800, Emanuele D'Arrigo wrote: > > I'm pondering on what is a bit of a philosophical dilemma. When should I > > throw an exception and when should I not? > > > Suppose I have myFunc1()

Re: using "private" parameters as static storage?

2008-11-14 Thread Aaron Brady
On Nov 13, 10:25 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 14 Nov 2008 13:35:02 +1100, Ben Finney wrote: > > Instead, it looks like you're falling foul of one of the classic > > mistakes in the “How to ask questions the smart way” document: you've > > got a goal, b

Re: using "private" parameters as static storage?

2008-11-14 Thread Aaron Brady
On Nov 13, 4:23 pm, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > def static(**vars): >     ns = NS(vars) >     def deco(f): >         return lambda *args, **kwargs: f(ns, *args, **kwargs) >     return deco > > @static(ncalls=0, history=[]) > def foo(ns, x): >    ns.ncalls += 1 >    ns.history.appe

Re: special editor support for indentation needed.

2008-11-14 Thread Aaron Brady
On Nov 14, 8:01 pm, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >  I don't understand. If you don't want to terminate the "if", why do > > you hit backspace? What is it that you would like to have happen? > > the goal is to make some aspects of indentation behave the

Re: special editor support for indentation needed.

2008-11-14 Thread Aaron Brady
On Nov 14, 11:28 pm, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > Aaron Brady wrote: > > On Nov 14, 8:01 pm, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >>>  I don't understand. If you don&#x

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

2008-11-15 Thread Aaron Brady
On Nov 15, 12:51 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 14 Nov 2008 22:56:52 -0500, Terry Reedy wrote: snip > I would say that the answer to this is, "Would you like to include > behaviour in value?". Let me give you an example: > > class String(string): >     d

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-15 Thread Aaron Brady
On Nov 15, 3:40 am, Rick Giuly <[EMAIL PROTECTED]> wrote: > Hello All, > > Why is python designed so that b and c (according to code below) > actually share the same list object? It seems more natural to me that > each object would be created with a new list object in the points > variable. > > cla

Re: Need help in understanding a python code

2008-11-15 Thread Aaron Brady
See below. On Nov 15, 11:15 pm, "Meryl Silverburgh" <[EMAIL PROTECTED]> wrote: > This is the full source code: > def A(w, v, i,j): >     if i == 0 or j == 0: return 0 >     if w[i-1] > j:  return A(w, v, i-1, j) >     if w[i-1] <= j: return max(A(w,v, i-1, j), v[i-1] + A(w,v, i-1, j - > w[i-1]))

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-16 Thread Aaron Brady
On Nov 16, 4:05 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sun, 16 Nov 2008 07:05:51 +, Arnaud Delobelle wrote: > > Steven D'Aprano <[EMAIL PROTECTED]> writes: > > >> On Sat, 15 Nov 2008 01:40:04 -0800, Rick Giuly wrote: > > >>> Hello All, > > >>> Why is python desig

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-16 Thread Aaron Brady
On Nov 16, 7:28 am, Steve Holden <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > On Nov 16, 2:05 am, Arnaud Delobelle <[EMAIL PROTECTED]> wrote: > > >> Steven D'Aprano <[EMAIL PROTECTED]> writes: > >>> On Sat, 15 Nov 2008 01:40:04 -0800, Rick Giuly wrote: > Hello All, > Why is pytho

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-16 Thread Aaron Brady
On Nov 16, 12:52 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Sat, 15 Nov 2008 21:29:22 -0800, Aaron Brady wrote: ... > If you want to be pedantic, then my "answer" (which you seem to approve > of) doesn't correspond to either of

Re: Generators and their next() and send() methods

2008-11-16 Thread Aaron Brady
On Nov 16, 3:36 pm, Thomas Mlynarczyk <[EMAIL PROTECTED]> wrote: > Arnaud Delobelle schrieb: > > > If you want to simply 'set' the generator (by which I take you mean > > 'change its state') without without iterating it one step, then what you > > need is a class with an __iter__() method.  Then yo

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-16 Thread Aaron Brady
On Nov 16, 8:16 pm, Aaron Brady <[EMAIL PROTECTED]> wrote: > On Nov 16, 12:52 am, Steven D'Aprano <[EMAIL PROTECTED] > > I've given practical reasons why the > > Python choice is better. If you want default argument to be created from > > scratch when the

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-16 Thread Aaron Brady
On Nov 17, 12:52 am, Aaron Brady <[EMAIL PROTECTED]> wrote: > On Nov 16, 8:16 pm, Aaron Brady <[EMAIL PROTECTED]> wrote: > > On Nov 16, 12:52 am, Steven D'Aprano <[EMAIL PROTECTED] > > > I've given practical reasons why the > > > Python choice i

Re: C Function Pointer Wrapping Example not working

2008-11-17 Thread Aaron Brady
On Nov 16, 8:56 pm, Charlie <[EMAIL PROTECTED]> wrote: > > >  But when I try to import test in python, it complains: > > >  import _test > > >  ImportError: ./_test.so undefined symbol: _Z9binary_opiiPFiiiE > > > The above is a mangled name so you've got some C vs C++ problems I'd > > say. > > > Yo

Re: Design By Contract in Python

2008-11-17 Thread Aaron Brady
On Nov 18, 12:22 am, Ryan Freckleton <[EMAIL PROTECTED]> wrote: > Any and all constructive critiques are be welcome > > Implementation:    http://pastebin.com/f368d5396 > Example class:      http://pastebin.com/f51be54be > > Thanks, > Ryan Freckleton The links produced the following error message:

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

2008-11-17 Thread Aaron Brady
On Nov 17, 8:35 pm, Craig Allen <[EMAIL PROTECTED]> wrote: > > >> * Do all objects have values? (Ignore the Python > > >>  docs if necessary.) > > > > If one allows null values, I am current thinking yes. > > > I don't see a difference between a "null value" > > and not having a value. > > I think

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

2008-11-18 Thread Aaron Brady
On Nov 18, 2:21 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: > On 2008-11-12, greg <[EMAIL PROTECTED]> wrote: > > > Here is the definition of call-by-value from the > > "Revised Report on the Algorithmic Language Algol 60" > >: > > > 4.7.3.1. Value assignm

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

2008-11-18 Thread Aaron Brady
On Nov 18, 2:55 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Steven D'Aprano wrote: > > On Sun, 16 Nov 2008 15:46:54 -0800, rurpy wrote: > > For example, consider the two electrons around a helium nucleus. They > > have the same mass, the same speed, the same spin, the same electric > > charge, the

Re: Generators and their next() and send() methods

2008-11-18 Thread Aaron Brady
On Nov 18, 5:20 pm, Thomas Mlynarczyk <[EMAIL PROTECTED]> wrote: > Aaron Brady schrieb: > > > And, if you don't intend to use 'myway' on 'listiterator's and such, > > 'send( None )' is equivalent to 'next( )'. > > I did

Re: how to acces the block inside of a context manager as sourcecode

2008-11-18 Thread Aaron Brady
On Nov 18, 3:59 pm, Daniel <[EMAIL PROTECTED]> wrote: > Hello, > > I need to access the code inside of a context manager, i.e. the call to > > with myManager(v=5) as x: >         a=b >         c=sin(x) > > should cause the following output (minus the first line, if that's easier): > > with myManage

Re: how to acces the block inside of a context manager as sourcecode

2008-11-19 Thread Aaron Brady
See below. On Nov 19, 8:02 am, Daniel <[EMAIL PROTECTED]> wrote: > Hi Aaron, > > let me give you the reason for the context manager: > I am driving handware with a python script, basically a data acquisition > program which looks like this: > > with dataSto

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-19 Thread Aaron Brady
On Nov 19, 12:05 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > >         I wouldn't expect a language like Ada to somehow re-evaluate a > default argument on each call; why would I expect Python to do such? Lots of people do. If you had a menu in a browser interface that had the items, say,

Re: Finding the instance reference of an object

2008-11-19 Thread Aaron Brady
On Nov 19, 12:28 pm, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 19, 2008, at 11:05 AM, Douglas Alan wrote: > > (2) It is also unarguably true that saying that Python or Java use > >    "call-by-value", and saying nothing more is going to be profoundly > >    confusing to anyone who is learning

Re: Hooking windowsmessages with python

2008-11-20 Thread Aaron Brady
On Nov 20, 3:52 am, Kevin Osthoff <[EMAIL PROTECTED]> wrote: > Hi! > > I'm trying to set a message hook with python to catch WM_DROPFILES. > The guiframework is Tkinter. > Here a code snippet: > > > hwnd = eval(self.wm_frame()) > > win32gui.DragAcceptFiles(hwnd,1) > > wnd = win32ui.CreateWindowFrom

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-20 Thread Aaron Brady
On Nov 19, 7:58 pm, alex23 <[EMAIL PROTECTED]> wrote: > On Nov 20, 10:14 am, Aaron Brady <[EMAIL PROTECTED]> wrote: > > > If you had a menu in a browser interface that had the items, say, > > 'Stop' and 'Reload', what would you expect to happen if

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

2008-11-20 Thread Aaron Brady
On Nov 19, 7:22 pm, greg <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > > You are changing your argument. In a follow up you > > made the point that call by value should be as it > > was intended by the writers of the algol 60 report. > > No, I was countering the argument that "call by value"

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-20 Thread Aaron Brady
On Nov 20, 5:54 pm, alex23 <[EMAIL PROTECTED]> wrote: > On Nov 20, 10:42 pm, Aaron Brady <[EMAIL PROTECTED]> wrote: > > > At first, I would expect it to define them at compile-time.  Then, > > when I learned there was no such thing, I would expect it to define > &

Re: How to run a python app in the background?

2008-11-20 Thread Aaron Brady
On Nov 20, 6:13 pm, [EMAIL PROTECTED] wrote: > I'm a beginning programmer writing a tiny app with a TkInter GUI. > Desired functionality: > When the user enters a time interval, I want the windows to disappear, > and the program to lie dormant until the scheduled time (currently > using sched modul

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-21 Thread Aaron Brady
On Nov 20, 11:26 pm, alex23 <[EMAIL PROTECTED]> wrote: > On Nov 21, 10:07 am, Aaron Brady <[EMAIL PROTECTED]> wrote: > > > Why, I would expect the interpreter to define the functions when it > > first hits the def, that is, at the point of definition. > &g

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

2008-11-21 Thread Aaron Brady
On Nov 21, 3:11 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > On Fri, 21 Nov 2008 03:32:25 +, Steven D'Aprano wrote: > > >>> Rather it seems to me that the essence of the idea they had in mind > >>> is that call-by-value is equivalent to assignment

Re: A little comments of ctypes and construct.

2008-11-21 Thread Aaron Brady
On Nov 21, 2:28 am, 一首诗 <[EMAIL PROTECTED]> wrote: > Hi all, > > Recently I asked a question on this group: > > >> What's your choice when handle complicated C structures. snip > > typedef struct _Point > { >int x; >int y; > > } Point; > > typedef struct _Shape > { > int z; > Point ap[2

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

2008-11-21 Thread Aaron Brady
On Nov 21, 4:33 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Aaron Brady <[EMAIL PROTECTED]> wrote: > >> a[:] = [1, 2, 3] > > > No, that's not assignment, it's syntactic sugar for a __setslice__ > > call.  No copies here. > > Oh dear, perhaps

Re: Optional parameter object re-used when instantiating multiple objects

2008-11-21 Thread Aaron Brady
On Nov 21, 4:24 am, alex23 <[EMAIL PROTECTED]> wrote: > On Nov 21, 7:49 pm, Aaron Brady <[EMAIL PROTECTED]> wrote: > > > On Nov 20, 11:26 pm, alex23 <[EMAIL PROTECTED]> wrote: > > > > On Nov 21, 10:07 am, Aaron Brady <[EMAIL PROTECTED]> wrote:

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

2008-11-21 Thread Aaron Brady
On Nov 21, 7:06 pm, greg <[EMAIL PROTECTED]> wrote: > Aaron Brady wrote: > > Tell me, what happens during a call to the following C++ function? > > > void f( std::vector< int > x ); > > The same thing as would happen if you wrote > >    std::vector x

Re: Dynamic features used

2008-11-22 Thread Aaron Brady
On Nov 21, 3:17 am, [EMAIL PROTECTED] wrote: snip > Compared to other languages Python generally allows me to write a > correctly working program in the shorter time (probably because of the > Python shell, the built-in safeties, the doctests, the clean and short > and handy syntax, the quick write

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

2008-11-22 Thread Aaron Brady
On Nov 21, 8:53 pm, greg <[EMAIL PROTECTED]> wrote: > Aaron Brady wrote: > > Call-by-value has other characteristics that Python does not > > meet. > > The designers of most other dynamic languages don't > seem to share that opinion, since they use the term >

RichCompare and RichCompareBool

2009-03-02 Thread Aaron Brady
Hi, In the source for 3.0.1, PyObject_RichCompareBool seems to perform an extra check on identity that PyObjecct_RichCompare does not perform. Here's the excerpt from RichCompareBool (line 612): /* Quick result when objects are the same. Guarantees that identity implies equali

Re: RichCompare and RichCompareBool

2009-03-02 Thread Aaron Brady
On Mar 2, 5:00 am, Duncan Booth wrote: > Aaron Brady wrote: > > Hi, > > > In the source for 3.0.1, PyObject_RichCompareBool seems to perform an > > extra check on identity that PyObjecct_RichCompare does not perform. snip > > The code for PyObject_RichCompare doe

Re: yaml for persistence

2009-03-02 Thread Aaron Brady
On Mar 2, 8:19 pm, Paul wrote: > class User(object): >     def __init__(self, uid): >        self.uid = uid >        self.__dict__.update(yaml.load(str('uid')+'.yaml')) > >     def save(self): >         f=open(str(self.uid)+'.yaml') >         yaml.dump(self.__dict__, f) > > is there a better way t

Re: RichCompare and RichCompareBool

2009-03-02 Thread Aaron Brady
On Mar 2, 9:24 pm, Terry Reedy wrote: > Gabriel Genellina wrote: > > En Mon, 02 Mar 2009 17:54:09 -0200, Terry Reedy > > escribió: > > >> Aaron Brady wrote: > >>> Hi, > >>>  In the source for 3.0.1, PyObject_RichCompareBool see

Re: RichCompare and RichCompareBool

2009-03-03 Thread Aaron Brady
On Mar 3, 6:01 am, "Gabriel Genellina" wrote: > En Tue, 03 Mar 2009 04:42:02 -0200, Aaron Brady   > escribió: > > > Also, did not receive Gabriel's post. > > That's because I replied a month ago - and probably you had no idea what I   > was talking ab

Re: Peculiar swap behavior

2009-03-05 Thread Aaron Brady
On Feb 23, 12:43 pm, Tim Chase wrote: > I stumbled across this oddity and was hoping folks on the list > might be able to provide a little understanding: > > # swap scalars >  >>> x,y = 1,2 >  >>> x,y = y,x >  >>> x,y > (2, 1) > > # swap lists >  >>> a,b = [1,2,3],[4,5,6] >  >>> a,b = b,a >  >>> a

Re: Can't override class |__new__

2009-03-05 Thread Aaron Brady
On Mar 5, 2:27 am, jelle feringa wrote: > Hi, > > I'm working with a C++ module ( CGAL, comp.geom. with exact arithmic ) > and am having troubles finding a way to override how the modules returns > objects. What I'm trying to do is to extend the Facet class, but when I try > to use my version of t

Re: How to access a containing objects properties from an object inside.

2009-03-05 Thread Aaron Brady
On Mar 5, 8:44 am, nuwandame wrote: > I have two objects obj1 and obj2. Inside obj1 there is an attribute for > success (obj1.success) and for containing other objects (obj1.data) > > I am using setattr() to add obj2 as an attribute to obj1.data > (obj1.data.obj2) this is working fine. > > My prob

Re: How to access a containing objects properties from an object inside.

2009-03-05 Thread Aaron Brady
On Mar 5, 9:51 am, nuwandame wrote: > Aaron Brady wrote: > > On Mar 5, 8:44 am, nuwandame wrote: > >> I have two objects obj1 and obj2. Inside obj1 there is an attribute for > >> success (obj1.success) and for containing other objects (obj1.data) > > >>

Re: RichCompare and RichCompareBool

2009-03-07 Thread Aaron Brady
On Mar 3, 12:42 am, Aaron Brady wrote: > On Mar 2, 9:24 pm, Terry Reedy wrote: > > > > > Gabriel Genellina wrote: > > > En Mon, 02 Mar 2009 17:54:09 -0200, Terry Reedy > > > escribió: > > > >> Aaron Brady wrote: > > >>> Hi, &

Re: RichCompare and RichCompareBool

2009-03-07 Thread Aaron Brady
On Mar 7, 10:39 pm, Steven D'Aprano wrote: > Aaron Brady wrote: > > Hi.  Just bringing it up again.  I feel the docs should mention it at > > least, and there should possibly be a separate function. > > Post a bug report or feature request on the tracker, or nothi

Re: Sharing objects between processes

2009-03-08 Thread Aaron Brady
On Mar 8, 1:36 pm, ET wrote: > I have been using the 'threading' library and decided to try swapping it > out for 'processing'... while it's awesome that processing so closely > mirrors the threading interface, I've been having trouble getting my > processes to share an object in a similar way. >

factory functions & methods

2009-03-08 Thread Aaron Brady
Hello, I am creating a container. I have some types which are built to be members of the container. The members need to know which container they are in, as they call methods on it, such as finding other members. I want help with the syntax to create the members. Currently, the container has to

Re: RichCompare and RichCompareBool

2009-03-09 Thread Aaron Brady
On Mar 7, 11:39 pm, Steven D'Aprano wrote: > Aaron Brady wrote: > > Hi.  Just bringing it up again.  I feel the docs should mention it at > > least, and there should possibly be a separate function. > > Post a bug report or feature request on the tracker, or nothi

Re: factory functions & methods

2009-03-09 Thread Aaron Brady
On Mar 8, 5:45 pm, "andrew cooke" wrote: > Aaron Brady wrote: > > Hello, > > > I am creating a container.  I have some types which are built to be > > members of the container.  The members need to know which container > > they are in, as they call methods

Re: RichCompare and RichCompareBool

2009-03-09 Thread Aaron Brady
On Mar 9, 10:11 am, Mark Dickinson wrote: > On Mar 2, 10:33 am, Aaron Brady wrote: > > > The code for PyObject_RichCompare does not contain this, it doesn't > > seem.  Is it a bug? > > It's not a bug.  See revision 67204: > > http://svn.python.org/v

Re: RichCompare and RichCompareBool

2009-03-09 Thread Aaron Brady
On Mar 9, 10:42 am, Mark Dickinson wrote: > On Mar 9, 3:22 pm, Aaron Brady wrote: > > > My complaint was that the docs for the function, as well as its name, > > are misleading.  RichCompareBool should not take the short cut, and "x > > in [x]" should call so

Re: Sharing objects between processes

2009-03-09 Thread Aaron Brady
On Mar 9, 12:47 pm, ET wrote: > > Message: 2 > > Date: Sun, 8 Mar 2009 12:00:40 -0700 (PDT) > > From: Aaron Brady > > Subject: Re: Sharing objects between processes > > To: python-l...@python.org > > Message-ID: > >    <5514c3df-d74e-47d8-9

Re: Sharing objects between processes

2009-03-09 Thread Aaron Brady
On Mar 9, 2:17 pm, ET wrote: > On Mon, 2009-03-09 at 11:04 -0700, Aaron Brady wrote: > > On Mar 9, 12:47 pm, ET wrote: > > > > Message: 2 > > > > Date: Sun, 8 Mar 2009 12:00:40 -0700 (PDT) > > > > From: Aaron Brady > > > > Subject: R

Re: Sharing objects between processes

2009-03-09 Thread Aaron Brady
On Mar 9, 4:21 pm, ET wrote: > On Mon, 2009-03-09 at 13:58 -0700, Aaron Brady wrote: > > On Mar 9, 2:17 pm, ET wrote: > > > On Mon, 2009-03-09 at 11:04 -0700, Aaron Brady wrote: snip > > Here's what we have to work with from you: > > > > &g

Re: Sharing objects between processes

2009-03-09 Thread Aaron Brady
On Mar 9, 4:21 pm, ET wrote: > On Mon, 2009-03-09 at 13:58 -0700, Aaron Brady wrote: > > On Mar 9, 2:17 pm, ET wrote: > > > On Mon, 2009-03-09 at 11:04 -0700, Aaron Brady wrote: snip > > Here's what we have to work with from you: > > > > &g

Re: Eject a Removable USB drive

2009-03-09 Thread Aaron Brady
On Mar 9, 6:08 pm, Mark Hammond wrote: > On 10/03/2009 8:20 AM, Rickey, Kyle W wrote: > > > Thanks for the link! That code has got me on the right track. I've > > almost got it working with one small kink. > > > After the code runs my drive still shows up on Windows Explorer but as a > > removable

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