Re: __getattribute__ meta class?

2008-02-27 Thread bambam
Carl Banks [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Feb 27, 12:44 am, bambam [EMAIL PROTECTED] wrote: In retrospect, the project has three parts: remove side effects, push side effects to a common location, modify code so that changes only affect areas that encapsulate

Re: __getattribute__ meta class?

2008-02-26 Thread bambam
that encapsulate side effects. This code allows top level code to pretend that the intermediate code has not changed. regards (david) bambam [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a class containing a series of classes like this: class Th(Externaldevice): class

exchange service side rules

2008-02-25 Thread bambam
Junk E-Mail Options, Protection is set to High. All of my messages are coming through with a SCL of 9 (I checked), but none of them are going to the Junk E-Mail folder. I thought this was a server-side rule? Can anyone explain, and also tell me what I need to do? --

__getattribute__ meta class?

2008-02-25 Thread bambam
I have a class containing a series of classes like this: class Th(Externaldevice): class _Communicate(commandset2.CommandSet_Communicate): def __getattribute__(self,attrname): attr = commandset2.CommandSet_Communicate.__getattribute__(self,attrname) if __call__ in dir(attr):

Re: exchange service side rules

2008-02-25 Thread bambam
Wrong message, wrong group. Sorry. bambam [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Junk E-Mail Options, Protection is set to High. All of my messages are coming through with a SCL of 9 (I checked), but none of them are going to the Junk E-Mail folder. I thought

Re: beginner question, function returning object.

2008-02-07 Thread bambam
Second try (correction) I started with ths: -- def open_pipe(): pipe=PIPE() print pipe return pipe pipe=open_pipe() pipe.parent = self.parent print pipe -- It didn't do what I wanted: when I printed the pipe the second time

Re: beginner question, function returning object.

2008-02-07 Thread bambam
Thank you. So example 2 was clearly wrong, and example 1 was not clear :~). pipe is a serial port object: when I print pipe it shows first that it is connected to port 5, then that it is connected to port 6. I'll discard the clearly wrong code, and concentrate on the unclear code: probably by

beginner question, function returning object.

2008-02-06 Thread bambam
I started with ths: -- def open_pipe(): pipe=PIPE() print pipe return pipe pipe=open_pipe() pipe.parent = self.parent print pipe -- It didn't do what I wanted: when I printed the pipe the second time it was not the same object

Re: Another newbie design question

2007-12-17 Thread bambam
Original languages were line oriented, newer languages were block oriented. Original languages has line comments. Newer languages had block comments, and had line comments added back in. So I would read that as line comments being more fundamental, but people who used line comments got so sick

programming container object

2007-12-16 Thread bambam
I wish to create a generic container object, devlist, such that devlist.method(arguments) runs as for each dev in devlist.pool: dev.method(arguments) and s = devlist.method(arguments) runs as for each dev in devlist.pool: s.append(dev.method(arguments))

basic threading question

2007-10-30 Thread bambam
Are function variables thread safe? def f(a): # whatever return float(a) Is that OK? def f(a): #whatever b=a: #whatever: return float(b) Is that OK? Steve. -- http://mail.python.org/mailman/listinfo/python-list

Re: Static variable vs Class variable

2007-10-18 Thread bambam
Steven D'Aprano [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Wed, 17 Oct 2007 13:41:06 +0200, Hrvoje Niksic wrote: The current implementation of += uses __add__ for addition and __iadd__ for addition that may or may not be in-place. I'd like to know the rationale for that

function to do dynamic import?

2007-09-11 Thread bambam
import works in the main section of the module, but does not work as I hoped when run inside a function. That is, the modules import correctly, but are not visible to the enclosing (global) scope. Questions: (1) Where can I read an explanation of this? (2) Is there a work around? BTW,

Re: function to do dynamic import?

2007-09-11 Thread bambam
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sep 10, 10:52 pm, bambam [EMAIL PROTECTED] wrote: import works in the main section of the module, but does not work as I hoped when run inside a function. That is, the modules import correctly, but are not visible

Re: function to do dynamic import?

2007-09-11 Thread bambam
J. Cliff Dyer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] bambam wrote: import works in the main section of the module, but does not work as I hoped when run inside a function. That is, the modules import correctly, but are not visible to the enclosing (global) scope

Re: function to do dynamic import?

2007-09-11 Thread bambam
Steve Holden [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] bambam wrote: import works in the main section of the module, but does not work as I hoped when run inside a function. That is, the modules import correctly, but are not visible to the enclosing (global) scope

Re: concise code (beginner)

2007-09-10 Thread bambam
I have a number of news readers here, but all of them work better with top-posting, and in none of them is top posting a problem. What software are you using? Steve. Lawrence D'Oliveiro [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In message [EMAIL PROTECTED], bambam wrote

Re: concise code (beginner)

2007-09-09 Thread bambam
Removing from a list while you iterate will had quadratic performance Anecdote: I was doing a route-finding program for a railway ticketing system. My replacement explained to my boss that it couldn't be done: the problem was one of that class of problems that has no good optimum solution.

Re: concise code (beginner)

2007-09-09 Thread bambam
PROTECTED] wrote in message news:[EMAIL PROTECTED] On Fri, 07 Sep 2007 12:03:26 +1000, bambam wrote: Hi Steven. Looking at your code, why are you naming the value __all__? It looks like a built-in variable? When you say: from module import * Python looks in the module for a list of names

Re: concise code (beginner)

2007-09-09 Thread bambam
at the risk making the call environment more complex. Still, the main thing is that I hadn't even thought of doing it that way. Thank you, Steve. Lawrence D'Oliveiro [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In message [EMAIL PROTECTED], bambam wrote: The devices are in a list

Re: concise code (beginner)

2007-09-06 Thread bambam
. Steven D'Aprano [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thu, 06 Sep 2007 15:44:57 +1000, bambam [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Try something like this: define a module holding the device functions. # module script __all__ = [a0010, a002, a0030

concise code (beginner)

2007-09-05 Thread bambam
I have about 30 pages (10 * 3 pages each) of code like this (following). Can anyone suggest a more compact way to code the exception handling? If there is an exception, I need to continue the loop, and continue the list. Steve. --- for dev in devs try:

Re: concise code (beginner)

2007-09-05 Thread bambam
that this achieves synchronous parallel processing -- another area I know nothing about -- but I'm just starting with the code as I got it, and coding so far was focused on hardware integration. Steve. bambam [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have about 30 pages (10 * 3 pages

Re: beginner, idomatic python 2

2007-08-30 Thread bambam
Thank you. I'm glad to see that I don't need to choose between two opposing viewpoints :~) Steve. -- http://mail.python.org/mailman/listinfo/python-list

Re: beginner, idomatic python 2

2007-08-30 Thread bambam
Bruno Desthuilliers [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] As a side note, in Python, inheritance ... ... should usually not be used for typing. :~( I'm sorry, I don't even know what that means... The code I have inherited from someone only a little more knowledgeable than

Re: Co-developers wanted: document markup language

2007-08-26 Thread bambam
virtually the only ones that feel the need to rub our nationality into I'd always assumed (I never spent much time) that Germans were another culture that had the habit of greeting groups on entrance. Australians, English, and most of North America just don't have that habit. Steve. Wildemar

Re: beginner, idiomatic python

2007-08-26 Thread bambam
That looks good, and perhaps a difference operator would be too simple to be useful anyway. Steve. Mikael Olofsson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] bambam wrote: In this case it doesn't matter - my lists don't contain duplicate elements this time - but I have

Re: beginner, idiomatic python

2007-08-26 Thread bambam
Python. Steve. Scott David Daniels [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] bambam wrote: The reason that lists don't have set-like methods is because lists aren't sets -- lists can contain duplicate elements and they are ordered. I'd have used sets if I was sure you meant

Re: beginner, idiomatic python

2007-08-26 Thread bambam
] wrote in message news:[EMAIL PROTECTED] On Aug 23, 11:50 pm, bambam [EMAIL PROTECTED] wrote: Thank you, so generallizing: (1) Python re-evaluates the loop range on every loop, and (2) Python does short-circuit evaluation of conditions, in predictable order. Sorry about the bad question

Re: beginner, idiomatic python

2007-08-26 Thread bambam
it in every loop Is self.parent.GetPageCount() 'retrieved every loop'? Steve. Gabriel Genellina [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] En Sun, 26 Aug 2007 22:58:35 -0300, bambam [EMAIL PROTECTED] escribi?: Ok, many environments are capable of cached evaluation of functions

Re: beginner, idiomatic python

2007-08-26 Thread bambam
to retrieve it in every loop Is self.parent.GetPageCount() 'retrieved every loop'? Steve. Scott David Daniels [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] bambam wrote: That is, is it defined what Python does for for i in f() I'm sure it must be, but I haven't seen it yet

Re: beginner, idiomatic python

2007-08-26 Thread bambam
Is it safe to write A = [x for x in A if x in U] or is that undefined? I understand that the slice operation can be used to make a temporary copy, so I could write A=[x for x in A[:] if x in U] but I've just copied that without any understanding. Steve. bambam [EMAIL PROTECTED] wrote

Re: beginner, idomatic python 2

2007-08-26 Thread bambam
Device class, and at init I could make sure the methods were connected for a Psp or a Pwr device. When (if ever) is that a good idea? Steve. Dan Bishop [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Aug 23, 10:21 pm, bambam [EMAIL PROTECTED] wrote: Would someone like to suggest

Re: beginner, idiomatic python

2007-08-26 Thread bambam
Thank you. Steve. Alex Martelli [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] bambam [EMAIL PROTECTED] wrote: Is it safe to write A = [x for x in A if x in U] or is that undefined? I understand that the slice operation It's perfectly safe and well-defined, as the assignment

Re: beginner, idiomatic python

2007-08-26 Thread bambam
not sure if the place I am looking at right now is supposed to support duplicates or not: duplicates are permitted, but they cause report anomalies. Steve. Paul Rubin http://[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] bambam [EMAIL PROTECTED] writes: Is it safe to write A = [x

Re: beginner, idomatic python 2

2007-08-24 Thread bambam
Supply return Pwr() What about the parameter DeviceType? Also, I see what you mean now, DEVICE_DICT is upper case because it is a 'constant' -- I'd missed that point. Steve. Bruno Desthuilliers [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] bambam a écrit : Would someone like

Re: beginner, idiomatic python

2007-08-24 Thread bambam
in feature would probably be too simple to use in any but the simplest cases. Steve. Erik Max Francis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] bambam wrote: Excellent. By symmetry, I see that list casts the set back into a list. I wonder why list has not been extended

beginner, idiomatic python

2007-08-23 Thread bambam
Would someone like to suggest a replacement for this? It works ok, but it doesn't look like any of the other code: tempList = ['1','2','3','4','5','6','7','8'] sampleList=[] for port in tempList: pagefound = False for i in range(self.parent.GetPageCount()):

Re: beginner, idiomatic python

2007-08-23 Thread bambam
Wos! Several different thoughts: An object using yield to return only the relevant pages, one at a time. Pop to remove the items from the list. A dictionary to map between the strings and the integers. The dictionary was particularly unexpected. Eventually, I plan to change the string ports to

beginner, idomatic python 2

2007-08-23 Thread bambam
Would someone like to suggest a replacement for this? This is a function that returns different kinds of similar objects, depending on what is asked for. PSP and PWR are classes. I don't really want to re-write the calling code very much: I'm just wondering if the function can be replaced with

Re: beginner, idiomatic python

2007-08-23 Thread bambam
Thank you, so generallizing: (1) Python re-evaluates the loop range on every loop, and (2) Python does short-circuit evaluation of conditions, in predictable order. Sorry about the bad question. Zentrader [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Does page count change? i.e.

Re: beginner, idiomatic python

2007-08-23 Thread bambam
. Scott David Daniels [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] bambam wrote: Would someone like to suggest a replacement for this? It works ok, but it doesn't look like any of the other code: tempList = ['1','2','3','4','5','6','7','8'] sampleList=[] for port in tempList

Re: beginner, idiomatic python

2007-08-23 Thread bambam
Genellina [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] En Thu, 23 Aug 2007 23:54:14 -0300, bambam [EMAIL PROTECTED] escribi?: After examining your suggestion, I realised that another thing I am interested in could be generalised: I want the complement of the set of ports in pages