Re: beginner, idomatic python 2

2007-08-31 Thread Bruno Desthuilliers
bambam a écrit : 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

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: beginner, idomatic python 2

2007-08-30 Thread Neil Cerutti
On 2007-08-31, bambam [EMAIL PROTECTED] wrote: 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

Re: beginner, idomatic python 2

2007-08-27 Thread Steve Holden
bambam wrote: [but he top-posted] 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 a replacement for this? This is a function that returns different kinds of similar objects, depending on

Re: beginner, idomatic python 2

2007-08-27 Thread Bruno Desthuilliers
bambam a écrit : OTSteve, could you please stop top-posting ?-) TIA /OT 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 a replacement for this? This is a function that returns different

Re: beginner, idomatic python 2

2007-08-26 Thread bambam
Thank you. I didn't reply earlier because I was trying to get my head around what you wrote, which was strange and foreign to me. It seems to me that the dictionary object you suggested is a direct replacement for the function code, only more efficient because the case table is internalised with

Re: beginner, idomatic python 2

2007-08-24 Thread Bruno Desthuilliers
bambam a écrit : 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

Re: beginner, idomatic python 2

2007-08-24 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : (snip) and ALL_LOWER That's 'ALL_UPPER', of course :( for symbolic (pseudo) constants. -- http://mail.python.org/mailman/listinfo/python-list

Re: beginner, idomatic python 2

2007-08-24 Thread bambam
trying to be idiomatic ...I hope that if a python programmer looks at my code it won't be an excuse to discard it. Less of an issue with Python than with C/C++, but since I'm just starting... def device(DeviceType): if DeviceType=='PSP': return Psp() elif DeviceType==Power

Re: beginner, idomatic python 2

2007-08-24 Thread Bruno Desthuilliers
bambam a écrit : trying to be idiomatic ...I hope that if a python programmer looks at my code it won't be an excuse to discard it. Hopefully not - and nothing forces you into adopting the common convention !-) But it's a fact that Python relies heavily on naming conventions, and that it

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, idomatic python 2

2007-08-23 Thread Dan Bishop
On Aug 23, 10:21 pm, bambam [EMAIL PROTECTED] wrote: 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: