execute a function after each source code line ?

2007-06-01 Thread stef
hello,

doing a simulation of another language (JAL),
I translate the other language into Python code,
then I execute this converted Python code.

Now I need todo some checks and give visual feedback to the user,
each time a line of code is executed.

One way of realizing this, is to add a function call at each source code 
line under investigation.

Are there any other (simple) ways of achieving this ?
(btw the whole program is running as an graphical (wxPython) application)

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: execute a function after each source code line ?

2007-06-01 Thread stef
Steve Howell wrote:
> --- stef <[EMAIL PROTECTED]> wrote:
>   
>> doing a simulation of another language (JAL),
>> I translate the other language into Python code,
>> then I execute this converted Python code.
>> [...]
>> (btw the whole program is running as an graphical
>> (wxPython) application)
>> 
>
> I worked on an open source project that uses Python to
> intrepret another language (an educational language
> called Guido van Robot), and it also uses wxPython to
> allow the user to step through the program one line at
> a time, and the user gets quite visual feedback. 
> Check out these screen shots, which hopefully
> illustrate something along the lines of what you're
> trying to achieve. 
>
> http://gvr.sourceforge.net/screen_shots/
>
>   
Steve,
that's exactly what I've in mind.
The screen shots, looks really good,
and I'll definitely will take a deeper look into your code.
I've one advantage over you,
the language I want to simulate (JAL),
is very Pascal like,
and therefor can be easily converted into equivalent Python code.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: execute a function after each source code line ?

2007-06-01 Thread stef
Diez B. Roggisch wrote:
> stef wrote:
>
>   
>> hello,
>>
>> doing a simulation of another language (JAL),
>> I translate the other language into Python code,
>> then I execute this converted Python code.
>>
>> Now I need todo some checks and give visual feedback to the user,
>> each time a line of code is executed.
>>
>> One way of realizing this, is to add a function call at each source code
>> line under investigation.
>>
>> Are there any other (simple) ways of achieving this ?
>> (btw the whole program is running as an graphical (wxPython) application)
>> 
>
> use the python trace facilities.
>
> http://docs.python.org/lib/module-trace.html
>   
thanks Diez,
that looks exactly what I need.
cheers,
Stef
> Diez
>   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: subexpressions (OT: math)

2007-06-04 Thread stef
Gary Herron wrote:
> Wildemar Wildenburger wrote:
>   
>> Gary Herron wrote:
>>   
>> 
>>> Of course not!  Angles have units, commonly either degrees or radians.
>>>
>>> However, sines and cosines, being ratios of two lengths, are unit-less.
>>>   
>>> 
>>>   
>>>> To understand it: sin() can't have dimensioned argument. It is can't
>>>> to be - sin(meters)
>>>>   
>>>> 
>>>>   
>>>> 
>>> No it's sin(radians) or sin(degrees). 
>>>   
>>> 
>>>   
>> NO!
>> The radian is defined as the ratio of an arc of circumfence of a circle 
>> to the radius of the circle and is therefore *dimensionless*. End of story.
>> http://en.wikipedia.org/wiki/Radian  and esp.
>> http://en.wikipedia.org/wiki/Radian#Dimensional_analysis
>>
>> *grunt*
>>   
>> 
> No, not end-of-story.  Neither of us are being precise enough here.  To
> quote from your second link:
> "Although the radian is a unit of measure, it is a dimensionless
> quantity."
>
> But NOTE: Radians and degrees *are* units of measure., however those
> units are dimensionless quantities , i.e., not a length or a time etc.
>
> The arguments to sine and cosine must have an associated unit so you
> know whether to interpret sin(1.2) as sine of an angle measured in
> degrees or radians (or whatever else).
>
> Gary Herron
>
>
>   
Sorry about entering the discussion so late,
and not sure I repeat one of the messages.

But can't we see it this way:
 radians / degrees (which one 360 or 400) are just mathematical 
scaling factors,
 like kilo, mega etc.

If a wheel is turning around at
2*pi*100  [rad /sec]
does something physical change is we leave the radian out
the wheeel is turning at
100  [1/sec]

No it's now called frequency, and has just some different scaling.

SQRT of "rad/sec" ?
Yes, in electronics the noise density is often expressed in   [nV/SQRT(Hz)]

cheers,
Stef Mientki





-- 
http://mail.python.org/mailman/listinfo/python-list


how to convert a bitmap file to an array ?

2007-06-05 Thread stef
hello

I can find all kind of procedures to convert an array to a bitmap
(wxPython, PIL),
but I can't find the reverse,
either
   - convert a bitmap to an array
or
  - read a bitmap file to an array

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to convert a bitmap file to an array ?

2007-06-05 Thread stef
Stefan Sonnenberg-Carstens wrote:
> stef schrieb:
>> hello
>>
>> I can find all kind of procedures to convert an array to a bitmap
>> (wxPython, PIL),
>> but I can't find the reverse,
>> either
>>- convert a bitmap to an array
>> or
>>   - read a bitmap file to an array
>>
>> thanks,
>> Stef Mientki
>>   
> Take a look at the "struct" module.
> There you fill find pack/unpack, which can do what you need.
thanks Stefan,

but using struct, I need to know how a bitmap file is build,
I don't know that (and I rather don't want to know that ;-)

Any better solutions (I'm a spoiled Delphi user ;-)

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to convert a bitmap file to an array ?

2007-06-05 Thread stef
Diez B. Roggisch wrote:
> stef wrote:
>
>   
>> hello
>>
>> I can find all kind of procedures to convert an array to a bitmap
>> (wxPython, PIL),
>> but I can't find the reverse,
>> either
>>- convert a bitmap to an array
>> or
>>   - read a bitmap file to an array
>> 
>
> Not true for PIL, Image.getdata and Image.putdata are your friends.
>
>   
thanks Diez,
I really overlooked that.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PATH or PYTHONPATH under Windows ???

2007-06-06 Thread stef
Giuseppe Di Martino wrote:
> Il Tue, 05 Jun 2007 23:57:15 +0200, Stef Mientki ha scritto:
>
>   
>> hello,
>>
>> after cleaning up a PC, Python can't find any libraries anymore.
>> But happily I've still one PC, where Python is running perfect.
>> Now I always read about the environment variable "PYTHONPATH".
>> But on neither PC there exists a "PYTHONPATH".
>>
>> On the PC that works ok,
>> there is the standard "PATH" environment variable,
>> and indeed there are all the Python Library references.
>>
>> Please enlighten me.
>>
>> thanks,
>> Stef Mientki
>> 
>
> Download pyrun.exe (http://developer.berlios.de/projects/pyrun) and copy
> it in your Python's folder; to exec python.exe use pyrun python or to exec
> script.py use pyrun python script.py
>   
I ran your program but it didn't solve the problem (running Python, 
embedded in Delphi).
I'm beginning to get the feeling that Python installation is a very 
complex case.
Anyway thanks.

cheers,
Stef Mientki
> Giuseppe
>
>   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PATH or PYTHONPATH under Windows ???

2007-06-06 Thread stef
Thorsten Kampe wrote:
> * Stef Mientki (Tue, 05 Jun 2007 23:57:15 +0200)
>   
>> after cleaning up a PC,
>> 
>
> Uou purposely deleted things you had no clue about?!
>   
Yes,
but you should have seen what a "professional" package like LabView / 
LabWindows,
all had installed on my PC ;-)
>   
>> Python can't find any libraries anymore.
>> But happily I've still one PC, where Python is running perfect.
>> Now I always read about the environment variable "PYTHONPATH".
>> But on neither PC there exists a "PYTHONPATH".
>> 
>
> That's totally normal.
>   
but why is everybody alwasy talking about the "environment variable 
PYTHONPATH" ??
>  
>   
>> On the PC that works ok,
>> there is the standard "PATH" environment variable,
>> and indeed there are all the Python Library references.
>> 
>
> That's not okay. At the best it's completely useless.
>   
???
>  
>   
>> Please enlighten me.
>> 
>
> Use common sense: reinstalling Python is likely the fastest way.
>   
Yes I know,
But the point is, I want to promote Python to colleagues,
show them that it's equally well suited as MatLab,
installation of Scipy + wxPython + a few other packages is terrible 
difficult.
So I can not even past the front door ;-)

Therefor I'm trying to understand the search path problem,
to make a "1-button" install (through Inno Setup),
and yesterday I was forced to try that 1-button install myself :-(

cheers,
Stef Mientki





> Thorsten
>   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PATH or PYTHONPATH under Windows ???

2007-06-06 Thread stef
Giuseppe Di Martino wrote:
> Il Wed, 06 Jun 2007 12:01:13 +0200, stef ha scritto:
>
>   
>>>   
>>>   
>> I ran your program but it didn't solve the problem (running Python, 
>> embedded in Delphi).
>> I'm beginning to get the feeling that Python installation is a very 
>> complex case.
>> Anyway thanks.
>>
>> 
>
> In the original post you don't mention "embedded in Delphi" !
> This is a different thing, the problem is that your Delphi's app relies on
> a Python installation in the system and, insteed, it shoud have
> on its own copy of Python, avoiding any problems.
>   
I run the same scripts and use the same libs in both plain Python and 
embedded Python,
so I really don't want different installs of Python (besides it's quit 
big > 100 MB)
> Giuseppe
>   
I did some more tests, and don't know if this the minimum set,
but at least this seems to be sufficient,
both for embedded Python (without a separate Python) and plain Python,

HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PATH = 
%PATH%
p:\python\lib\site-packages\graphviz-2.8-win32.egg\bin;
p:\python\lib\site-packages\swig-1.3.24-win32.egg;
p:\python\lib\site-packages\vtk-5.0.1-win32.egg\vtk;
P:\Python;
P:\Python\Scripts;
P:\Python\Tools\Scripts;
P:\Python;p:\python\lib\site-packages\mingw-3.4.5-win32.egg\bin;
p:\python\lib\site-packages\scite-1.73-win32.egg;

HKLM\SYSTEM\CurrentControlSet\Control\Session 
Manager\Environment\PYTHONPATH =


HKLM\SYSTEM\CurrentControlSet\Control\Session 
Manager\Environment\PYTHONHOME =
P:\Python

HKLM\SYSTEM\CurrentControlSet\Control\Session 
Manager\Environment\PATHEXT = %PATHEXT%
py;pyc

Reboot the system (seems to be essential)

Everything works as expected

thank you all for your suggestions.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


wxPython / Dabo demo shell ?

2007-06-08 Thread stef
hello,

I was impressed by the demo shell of wxPython,
and a few days ago (finally getting Dabo to work),
I saw Dabo uses the same demo shell.

Is there any more information available about this shell,
because it seems a very nice / good way to show
(many) demos, in an organized way to newbies.

thanks,
Stef mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython / Dabo demo shell ?

2007-06-08 Thread stef
Ed Leafe wrote:
> On Jun 8, 2007, at 8:59 AM, Chris Mellon wrote:
>
>> The shell in the wxPython demo (but apparently not in the dabo demo,
>> as per Ed's email) is from the wx.py package. It's quite trivial to
>> add to your own applications, documentation is at
>> http://www.wxpython.org/PyManual.html
>
> I may be wrong, but I believe that the OP was interested in the 
> overall frame, contents, and inner workings of the wxPython demo 
> application (and DaboDemo), not the PyShell interpreter.
Yes you're right Ed,
I'm interested in the overall demo setup,
really beautiful and powerful, just one thing missing (user configurable 
tree).

And if you can copy it,
I'm allowed to do so also ;-)

thanks,
Stef
>
> -- Ed Leafe
> -- http://leafe.com
> -- http://dabodev.com
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: caseless dictionary howto ?

2007-06-20 Thread stef
Gabriel Genellina wrote:
> En Tue, 19 Jun 2007 19:40:10 -0300, Steven Bethard 
> <[EMAIL PROTECTED]> escribió:
>
>> Stef Mientki wrote:
>>> Evan Klitzke wrote:
>>>> On 6/19/07, Stef Mientki <[EMAIL PROTECTED]> wrote:
>>>>>
>>>>> I need to search a piece of text and make all words that are equal
>>>>> (except their case) also equal in their case, based on the first
>>>>> occurrence.
>
>> ... def __setitem__(self, key, value):
>> ... self._dict[key.lower()] = value
>> ... if key not in self._original_keys:
>> ... self._original_keys[key.lower()] = key
>> ...
>>
>> Note that because I store the first form encountered for every key, I
>> can always use the lower-case version to retrieve the "original string".
>
> As written, it stores the last used spelling; a small change is 
> required to get the intended behavior:
>
>> ... def __setitem__(self, key, value):
>> ... self._dict[key.lower()] = value
>> ...     if key.lower() not in self._original_keys:
>> ... self._original_keys[key.lower()] = key
>
> --Gabriel Genellina
>
thanks guys,
I'll think a while which solution I'll choose.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: caseless dictionary howto ?

2007-06-20 Thread stef
Stefan Behnel wrote:
> Stef Mientki wrote:
>   
>> I need to search a piece of text and make all words that are equal
>> (except their case) also equal in their case, based on the first
>> occurrence.
>> So I'm using a dictionary to store names and attributes of objects.
>> As as I need to search on the caseless name (so I've choosen lowercase),
>> My dictionairy looks like this:
>>
>> self.procs [ "serial_hw_read"  ] = ( "Serial_HW_Read", "F", "++", T)
>> 
>
> I have no idea what the "F", "++", "T" means at the end (if it's some kind of
> flags or attributes,
This makes part of a simulation of a JAL (a Pascal like language for 
micros),
and this dictionary builds up the namespace,
used in translation JAL to pure Python.

Serial_HW_Read = the name of a function
"F" = the type of that function (procedure / function / pseudo variable 
/ interrupt /..)
"++" = the direction of each parameters, (input / output / input+output )
T = a tupple, containing the type of each of the parameters (bit / byte/ 
sbyte / word / ...)
>  maybe a class to hold them would look better),
maybe, but no human is looking at it ;-)
>  but that's
> a good solution to the problem IMHO.
>   
Seeing the other solution,
I indeed tend to stick to this solution,
because it's the most simple one
(certainly if you realize that the dictionary is generated by the 
program itself)

cheers,
Stef Mientki
> Stefan
>   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: caseless dictionary howto ?

2007-06-20 Thread stef
Carsten Haese wrote:
> On Wed, 2007-06-20 at 11:14 +0200, stef wrote:
>   
>> Stefan Behnel wrote:
>> Serial_HW_Read = the name of a function
>> "F" = the type of that function (procedure / function / pseudo variable 
>> / interrupt /..)
>> "++" = the direction of each parameters, (input / output / input+output )
>> T = a tupple, containing the type of each of the parameters (bit / byte/ 
>> sbyte / word / ...)
>> 
>>>  maybe a class to hold them would look better),
>>>   
>> maybe, but no human is looking at it ;-)
>> 
>
> But humans might look at the code that looks at the thing.
> thing.func_type is self-documenting, thing[0] is not.
>   
I think you might be right,
but for a one-time/one-programmer program,
I think the documentation will be good enough.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


configparser shuffles all sections ?

2007-06-22 Thread stef
hello,

I just used configparser for the first time and discovered that it 
shuffled all my sections,
and the contents of the sections too.

This makes human manipulation of the file impossible.

Is there a way to prevent this shuffling,
or are there other libraries that can handle windows ini-files without 
reshuffling ?

thanks,
Stef Mientki

Kamer van Koophandel - handelsregister 41055629  / Netherlands Chamber of 
Commerce - trade register 41055629


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: configparser shuffles all sections ?

2007-06-22 Thread stef
Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, stef wrote:
>
>   
>> I just used configparser for the first time and discovered that it 
>> shuffled all my sections, and the contents of the sections too.
>> 
>
> The data is stored in dictionaries.
>   
So there should be some way to sort it ?
>   
>> This makes human manipulation of the file impossible.
>> 
>
> Why so?
>   
I've about 1000 sections ;-)

> Ciao,
>   Marc 'BlackJack' Rintsch
>   

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: listing the type of an object

2007-06-28 Thread stef
Bruno Desthuilliers wrote:
> Stef Mientki a écrit :
>> How can I list a type of an object instance ?
>>
>> I tried:
>>
>> class tLED (tDevice):
>
> 
> Do yourself (and the world) a favour and give up hungarian notation... 
> This should be:
>
> class Led(Device):
>#...
>
> 
Didn't know that this was called "Hungarian notation",
and although it's not my personal favorite, it is thé standard in Delphi,
but I admit that it's not a very good choice in a object oriented 
language like Python.

The program I'm writing now is might be an exception,
I'm writing a program that should be extended by non-Python-programmers,
even maybe non-programmers !
So I'm trying to use a simplest approach from the viewpoint of the end 
users.
>
>>   def some_proc(self):
>> print 'type(self)', type(self)
>>
>> But i gives me:
>>   type(self) 
>
> looks like Device is an old style class.
>
>> Moreover, I want even the type to be listed by it's ancestor, like this
>>
>> class tDevice:
>>   def some_other_proc:
>> print 'type(self)', type(self)
>
> Try this:
>
> class Device(object):
>   def some_other_proc(self):
> print self, type(self)
>
> class Led(Device):
>   pass
>
> led = Led()
> led.some_other_proc()
thanks Bruno,
that does the job.

cheer,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: conditional print statement ?

2007-04-26 Thread stef
Antoon Pardon wrote:
> On 2007-04-25, Stef Mientki <[EMAIL PROTECTED]> wrote:
>   
>> hello,
>>
>>
>> As part of a procedure I've a number sequences like this:
>>
>> 
>>  if Print_Info: print Datafile.readline()
>>  else:Datafile.readline()
>> 
>>
>> Is there a more compressed way to write such a statement,
>> especially I dislike the redundancy "Datafile.readline()".
>>
>> thanks,
>> Stef Mientki
>> 
>
> You could consider the following
>
> def Print(arg):
> print arg
>
> def Noop(arg):
> pass
>
> (Print if Print_Info else Noop) (Datafile.readline())
>
>   
thank you all for your answers,
I'll play a little with the suggested solutions.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


simplest install procedure for Python + packages under winXP ?

2007-04-26 Thread stef
hello,

I'm still in the transition of going from MatLab to Scipy,
and installed previous week a SciPy on a PC twice,
through the new "Enstaller".
It's a pitty that there will be no old installer versions anymore
(although I can understand why).

Although I succeeded, the behavior of the Enstaller was different both 
times, and you can  clearly see  it's an alpha version.
(I already wrote my experiences with the first install,
the second install had the weird phenomena that none of the succesful 
installed packages was detected).

As a spoiled windows user, which by the way are most people in my 
surrounding, I'm used to a "one-button-install",
so I wonder if it's possible to make a much simpler install procedure.

I don't know anything about what's required for a good install,
what kind of things things should be stored in the windows registry,
but as Python is an interpretor,
I would expect there should be a very easy procedure:
- Install it on one machine,
- copy the complete subdirectory to another computer
Does this work for Python + Scipy ?
(If so, I can use Inno, which I'm familiar with)

Though the above question might seem a lot of fuzz about nearly nothing,
it's very essential for my plan,
in which I want to convince the other people at our university to move 
from MatLab to Python.
For windows users, the "one-button-install" is essential,
otherwise most windows users, will not even try a new package.

Sorry for the long post, about "nothing" for non-windows users  ;-) 

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


getting rid of EOL character ?

2007-04-27 Thread stef
hello,

In the previous language I used,
when reading a line by readline, the EOL character was removed.

Now I'm reading a text-file with CR+LF at the end of each line,
Datafile = open(filename,'r') 
line = Datafile.readline()

now this gives an extra empty line
print line

and what I expect that should be correct, remove CR+LF,
gives me one character too much removed
print line[,-2]

while this gives what I need ???
print line[,-1]

Is it correct that the 2 characters CR+LF are converted to 1 character ?
Is there a more automatic way to remove the EOL from the string ?

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: conditional print statement ?

2007-04-27 Thread stef

> or (untested):
>
> if Print_Info:
> def printOrNot(arg):
> print arg
> else:
> def printOrNot(arg):
> pass
>
> printOrNot(Datafile.readline())
>
>   
thanks for the creative solution, and indeed it does work ;-)

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: getting rid of EOL character ?

2007-04-27 Thread stef

>
> line = line.rstrip("\r\n") should take care of it. If you leave out 
> the parameter, it will strip out all whitespace at the end of the 
> line, which is what I do in most cases.
thanks for the solution Michael,

cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


iteration doesn't seem to work ??

2007-05-16 Thread stef
hello,

can someone tell me why the following iteration doesn't work,
and
how I should replace empty strings in a list with a default value.

 >>> v
['123', '345', '', '0.3']
 >>> for items in v:
...   if items=='':
...   items='3'
...
 >>>
 >>> v
['123', '345', '', '0.3']
 >>>

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: iteration doesn't seem to work ??

2007-05-16 Thread stef
hello Sean,

thanks very much for the explanation and solution.

cheers,
Stef Mientki

[EMAIL PROTECTED] wrote:
> On May 16, 1:41 am, stef <[EMAIL PROTECTED]> wrote:
>   
>> hello,
>>
>> can someone tell me why the following iteration doesn't work,
>> and
>> how I should replace empty strings in a list with a default value.
>>
>>  >>> v
>> ['123', '345', '', '0.3']
>>  >>> for items in v:
>> ...   if items=='':
>> ...   items='3'
>> ...
>>  >>>
>>  >>> v
>> ['123', '345', '', '0.3']
>>  >>>
>>
>> thanks,
>> Stef Mientki
>> 
>
> Inside the loop, 'items' is no longer referencing the list...its a
> string.
>
>   
>>>> v = ['123', '4', '567', '']
>>>> for i in v:
>>>> 
> ... print type(i)
> ...
> ...
>
> This works
>
>   
>>>> for j,i in enumerate(v):
>>>> 
> ... if i=='':
> ... v[j] = '3'
> ...
>   
>>>> v
>>>> 
> ['123', '4', '567', '3']
>   
>
> ~Sean
>
>   
-- 
http://mail.python.org/mailman/listinfo/python-list


drag and drop with wxPython ?

2007-05-22 Thread stef
hello,

I'm trying to move from Delphi to Python
(move from MatLab to Python already succeeded, also thanks to this 
discussion group).
 From the discussions in this list about "the best" GUI for Python,
it now seems to me that wxPython is thé choice for my kind of applications.

I've no experience with wxPython yet,
I just run a few examples and indeed it looks good (as expected from the 
discussions in this list).

What I really need at this moment for a new project,
(and I coulnd't find any example, lot of broken links ;-)
is how to implement some drag & drop facilities,
both to drag and drop normal button,
but also to drag and drop some dynamically created objects.
Just like a CAD program, but far more simpler.

Does anyone has an example how to drag & drop components with wxPython ?

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can I reference 1 instance of an object by more names ? rephrase

2007-05-23 Thread stef
thanks Guys for your information,

indeed you're all quit right,
but I think I've not correctly described my problem :-(

I need to have 2 (or more) names, that references the same instance of 
an object,
and in assigning a value to the object (or to some property in the object),
I need to do extra activities (like changing some global variables).

Now if I use  a "container type object", without actual using the index 
of the container object,
I get things working OK.
But now I have to use a dummy index, if I use the object in assignments, 
see program below.
Is there another way, without using the dummy index, to achieve the same 
results ?

thanks,
Stef Mientki


class cpu_ports(object):
def __init__(self, value=0):
self._d = value
def __setitem__(self, index, value):
  print 'vv'
  self._d = value
def __getitem__(self, index):
  return self._d
def __repr__(self):
  return str(self._d)

name1 = cpu_ports() # create an instance
name2 = name1# refer with a second name to the same instance
print name1, name2  # test ok

name1[0] = 25   # assign a value to the instance
print name1, name2  # both references are OK

name2[0] = 26   # assign another value through the other name
print name1, name2  # both reference are OK

name2[0] = name1[0] + 13  # use both names at either side of an assignment
print name1, name2# both references still OK

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can I reference 1 instance of an object by more names ? rephrase

2007-05-23 Thread stef
Bruno Desthuilliers wrote:
> stef a écrit :
>> thanks Guys for your information,
>>
>> indeed you're all quit right,
>> but I think I've not correctly described my problem :-(
>>
>> I need to have 2 (or more) names, that references the same instance 
>> of an object,
>> and in assigning a value to the object (or to some property in the 
>> object),
>> I need to do extra activities (like changing some global variables).
>
> Then you want a property (aka computed attribute).
>
>> Now if I use  a "container type object", without actual using the 
>> index of the container object,
>> I get things working OK.
>> But now I have to use a dummy index, if I use the object in 
>> assignments, see program below.
>> Is there another way, without using the dummy index, to achieve the 
>> same results ?
>
>> thanks,
>> Stef Mientki
>>
>> 
>> class cpu_ports(object):
>>def __init__(self, value=0):
>>self._d = value
>>def __setitem__(self, index, value):
>>  print 'vv'
>>  self._d = value
>>def __getitem__(self, index):
>>  return self._d
>>def __repr__(self):
>>  return str(self._d)
>>
>> name1 = cpu_ports() # create an instance
>> name2 = name1# refer with a second name to the same instance
>> print name1, name2  # test ok
>>
>> name1[0] = 25   # assign a value to the instance
>> print name1, name2  # both references are OK
>>
>> name2[0] = 26   # assign another value through the other 
>> name
>> print name1, name2  # both reference are OK
>>
>> name2[0] = name1[0] + 13  # use both names at either side of an 
>> assignment
>> print name1, name2# both references still OK
>
> You can have something working the same way using a property, but 
> that's how far you'll get - if you hoped to be able to automagically 
> rebind name2 when rebinding name1, then too bad, because python wont 
> let you do so. You have to understand that
>   name = obj
> is totally different from
>   name.attr = obj
> or
>   name[index] = obj
>
> In the first case, this is *really* a binding, and that's one of the 
> few things that Python won't let you mess with. In the two last cases, 
> it's in fact a method call - as the use of __[get|set]item__ should 
> make obvious.
>
> here's an example using a property:
>
> class cpu_ports(object):
>def __init__(self, value=0):
>self._d = value
>@apply
>def value():
>def fset(self, value):
>print 'vv'
>self._d = value
>def fget(self):
>return self._d
>return property(**locals())
>
>def __repr__(self):
>return str(self._d)
>
> name1 = cpu_ports() # create an instance
> name2 = name1# refer with a second name to the same instance
> print name1, name2  # test ok
>
> name1.value = 25   # assign a value to the instance
> print name1, name2  # both references are OK
>
> name2.value = 26# assign another value through the other name
> print name1, name2  # both reference are OK
>
> name2.value = name1.value + 13
> print name1, name2  # both reference are OK
>
> And that's about as far as you can go (without rewriting Python I mean).
thanks Bruno for your clear explanation,
I was "afraid" that this would be the only solution,
and now I'm sure,
I can implement it in this way (which is not really a problem).

I just found a Python compiler for PICs (Pyastra),
I still have to study it, but it might be a good idea,
to translate JAL to Python, using the exact syntax of Pyastra.

thanks again,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ten small Python programs

2007-05-29 Thread stef

>   
>> Secondly, Python is nowadays not only used by
>> programmers,
>> but also by e.g. Scientific users (former MatLab
>> users),
>> who are not interested in the code itself,
>> but just in the results of that particular code.
>> For these people a lot of example programs,
>> for which they can easily see the results,
>> make some small changes and see the result again,
>> would be a wonderful addition.
>>
>> 
>
> In your own personal use, what are some
> libraries/techniques/etc. that you think could benefit
> from some kind of more organized presentation of
> example programs (or better way of showing how the
> examples work, etc.)?
for example SciPy,
but I think it yield for all libs/techniques.
And I guess Windows users have a much greater need for such an 
organization than *nix users.
>   Are you part of the Scientific
> community?
>
>   
sort of, I indeed work at a university,
but not doing scientific work myself,
I work on a supporting department.

> How new are you to Python?
very new ;-)
(I've lot of experience in a other programming languages,
last years mostly Delphi, JAL, MatLab)

>   I do think
> newbies/intermediates/advanceds all have different
> needs.
>   
agreed.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.5 and WXPython demo's

2007-05-30 Thread stef
Wildemar Wildenburger wrote:
> Andrew P wrote:
>> Hello,
>>
>> I am new (very) to Python and have just down loaded the latest version
>> of Python (2.5) and WXPython (2.8).
>>
>> For some reason I cannot get the WXPython demo to run at all. I run
>> windows XP and it can't find a program to run the demo. Any advice?
>> (apologies if this has been posted before).
>>
>>   
> There *should* be a link in your startmenu in the wxPython group. I'm 
> quite positive, but not 100% sure. I think it has the snake-icon. But 
> if it's really not there (as you suggested), simply go the the folder 
> you installed the demo to and run demo.py.
>
> Maybe there's a blunder in the installer for the 2.8 demo? Anyone?
Can't answer that, but on one from two (almost identical) PC's,
I had trouble too, the other went fluently.
On both PC's,
there was an older wxPython (2.6 I believe),
(which from what I've read should be no problem at all),
which wasn't overruled, by some specific file (wx.pth) to point to the 
newest.
The effect is that the demo tries to run, can't find aiw?? or something 
like that and crashes
(on fast PC's you actually just see a dos box flashing).
Editing the wx.pth file solved the problem.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: is there a standard way to "install" egg-files under windows ?

2007-05-31 Thread stef
John Nagle wrote:
> Diez B. Roggisch wrote:
>> Stef Mientki schrieb:
>>
>>> hello,
>>>
>>> after 4 months playing around with Python,
>>> and I still have troubles with egg files.
>>> Sometimes it works, sometimes it doesn't.
>>>
>>> If I google on "python egg", I get lost of links,
>>> which contains huge pages of information,
>>> and I'm totally scared off.
>
>".egg" files are actually ".zip" files.  So you can
> rename them to ".zip" and unpack them where they need to go.
> This is usually easier than debugging "easy_install".
>
> John Nagle
thanks guys,

I'm slowly getting the picture.
Now knowing it's a zip file,
and trying several egg-files through easy_install,
I noticed different things,
- sometimes the egg is unzipped and placed in the "site-package" directory
- sometimes it's just copied (unzipped) to the site-package directory.

My first conclusion that egg-installation didn't work sometimes,
has probably to do with version conflicts between the already installed 
libs and the new to install libs,
but I guess that's the benefit of open source ;-)

So if that's all, the renaming to .zip might be a less obscure way of 
working.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: An ordered dictionary for the Python library?

2007-09-12 Thread stef
Mark Summerfield wrote:
> I feel that Python lacks one useful data structure: an ordered
> dictionary.
>
> I find such data structures v. useful in C++. I know that in Python
> the sort function is v. fast, but often I prefer never to sort but
> simply to use an ordered data structure in the first place.
> (I'm aware that for ordered lists I can use the bisect module, but I
> want an ordered key-value data structure.)
>
> I think other people must find such things useful. There are three
> implementations on the Python Cookbook site, and one on PyPI, all in
> pure Python (plus I have my own implementation, also pure Python).
>
> I would suppose that it would be better if it was implemented in C---
> for example, my own pure Python ordered dict loads data about eight
> times slower than the built-in dict. Nonetheless, I still find it
> worth using for the convenience it offers.
>
> Do other Python programmers feel this lack? Is this worth a PEP?
>
>   
Yes I think it's really useful,
(or at least I'm used to it in other languages ;-)
If you're going to extend the dictionary,
there's one other flag I'm continuously missing:
"case-insensitive" key.

cheers,
Stef Mientki

> [I originally asked about this on the P3K mailing list, but then
> realised that it isn't version-specific really.]
>
>   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is the wxPython list down?

2007-09-12 Thread stef
[EMAIL PROTECTED] wrote:
> Hi,
>
> Does anyone know if the wxPython mailing list is having issues? I
>   
Yes the server has hardware problems,
Robin Dunn (moderator), is informed about it.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxstyledtextctrl and xml markup

2007-09-13 Thread stef

> I highly recommend the wxPython mailing list. Right now it is down
> (see their website), 
its'up again.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: from maple to python + numpy/scipy

2007-03-19 Thread stef
Daniel Nogradi wrote:
> I'm just getting started with numpy/scipy and first would like to get
> a view of what it can do and what it can't. The main idea is to move
> from maple to python and the first thing that poped up is the fact
> that maple is very convenient for both formal manipulations and exact
> integer calculations. For instance if a matrix has integer entries and
> the eigenvalues are integers maple can find these exactly.
>
> Can numpy/scipy do this? Or the eigenvalues will always be floating
> point numbers?
it might be better to ask this question on the scipy newsgroup
  SciPy Users List <[EMAIL PROTECTED]>

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Fortran vs Python - Newbie Question

2007-03-26 Thread stef

>
>   
>> You can get the speed of fortran in Python by using libraries like
>> Numeric without losing the readability of Python.
>>
>> 
>
> Can you back this up with some source??
> Chris
>
>   
Is this really the most important issue in your choice ?

As said by others, "Portability, scalability & RAD" as an advantage of 
Python are probably far more important.

And on the other hand Python is perfect as glue between Fortran and 
whatsoever.
To emphasize that, I expect the number of lines in Python is at least 3 
times less than in Fortran.

I did some comparison between MatLab and Python  (Scipy) for real-time 
analysis,
and for all my cases Pyhton van 3 .. 7 times faster than MatLab.

So I'ld suggest to start with downloading the Enthought edition of Python,
and you can judge for yourself within 10 minutes,
if it's fast enough.

cheers,
Stef Mientki

-- 
http://mail.python.org/mailman/listinfo/python-list


Library for windows ini-files ?

2007-03-30 Thread stef
hello,

is there a Python library for easy reading and writing windows ini-files ?

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Library for windows ini-files ?

2007-03-30 Thread stef
Laurent Pointal wrote:
> stef a écrit :
>   
>> hello,
>>
>> is there a Python library for easy reading and writing windows ini-files ?
>> 
>
> http://docs.python.org/lib/module-ConfigParser.html
>
> A+
>
> Laurent.
>   
thanks Laurent,
that seems to be what I was looking for.

cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: newbie: self.member syntax seems /really/ annoying

2007-09-17 Thread stef
Wildemar Wildenburger wrote:
> stef mientki wrote:
>> Wildemar Wildenburger wrote:
>>> Bruno Desthuilliers wrote:
>>>  
>>>> OTHO, simple math-illeterate programmers like me will have hard 
>>>> time maintaining such a code.
>>>> 
>>> Certainly, but again: Such main people are not the intended 
>>> audience. The code is for people that know how to read these 
>>> equations. I think a general rule of (any form of) writing is to 
>>> write with your audience in mind. I always do that and happily, that 
>>> audience is usually naked.
>>>
>>>
>>>   
>> Wouldn't Mathematica, Maple or MathCad be a far better choice ?
>>
> Well, those cost money ...
Maxima doesn't

cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: PyPE 2.8.7

2007-09-25 Thread stef
Josiah Carlson wrote:
> === What is PyPE? ===
> PyPE (Python Programmers' Editor) was written in order to offer a
> lightweight but powerful editor for those who think emacs is too much
> and idle is too little. Syntax highlighting is included out of the box,
> as is multiple open documents via tabs.
>
>   
sounds very good,
so now I want to try it ...
... the windows ansi zip file is corrupted :-(
... the unicode version crashes :-(

This is what the log file tells:
Traceback (most recent call last):
  File "pype.py", line 110, in ?
  File "zipextimporter.pyc", line 78, in load_module
  File "configuration.pyc", line 149, in ?
Exception: Unable to create config directory: 'G:\\.pype'

I don't have a G-drive ;-)

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: PyPE 2.8.7

2007-09-25 Thread stef
Another problem,
I tried to run PyPE in my "old IDE",
and get the following error:

Traceback (most recent call last):
  File "D:\temp\PyPE-2.8.7-src\PyPE-2.8.7\pype.py", line 20, in ?
wxversion.ensureMinimal(v)
  File "P:\Python\lib\site-packages\wxversion.py", line 178, in 
ensureMinimal
raise VersionError("wxversion.ensureMinimal() must be called before 
wxPython is imported")
VersionError: wxversion.ensureMinimal() must be called before wxPython 
is imported
> cheers,
> Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: PyPE 2.8.7

2007-09-26 Thread stef
thebjorn wrote:
> On Sep 25, 12:46 pm, stef <[EMAIL PROTECTED]> wrote:
>   
>> Another problem,
>> I tried to run PyPE in my "old IDE",
>> 
>
> instead of double-clicking on the PyPE.exe file? Why?
>   
to get the traceback.

cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: PyPE 2.8.7

2007-09-26 Thread stef
thebjorn wrote:
> On Sep 25, 12:37 pm, stef <[EMAIL PROTECTED]> wrote:
>   
>> Josiah Carlson wrote:
>> 
>>> === What is PyPE? ===
>>> PyPE (Python Programmers' Editor) was written in order to offer a
>>> lightweight but powerful editor for those who think emacs is too much
>>> and idle is too little. Syntax highlighting is included out of the box,
>>> as is multiple open documents via tabs.
>>>   
>> sounds very good,
>> so now I want to try it ...
>> ... the windows ansi zip file is corrupted :-(
>> ... the unicode version crashes :-(
>>
>> This is what the log file tells:
>> Traceback (most recent call last):
>>   File "pype.py", line 110, in ?
>>   File "zipextimporter.pyc", line 78, in load_module
>>   File "configuration.pyc", line 149, in ?
>> Exception: Unable to create config directory: 'G:\\.pype'
>>
>> I don't have a G-drive ;-)
>>
>> cheers,
>> Stef Mientki
>> 
>
> You must be doing it wrong. 
Of course ;-)
but what am I doing wrong ?
cheers,
Stef
> Works flawlessly for me (no g: drive here
> either) -- well, except that it doesn't have Emacs keybindings .
>
> -- bjorn
>
>   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: how to iterate over sequence and non-sequence ?

2007-10-19 Thread stef
Paul Hankin wrote:
> On Oct 19, 12:24 am, stef mientki <[EMAIL PROTECTED]> wrote:
>   
>> I generate dynamically a sequence of values,
>> but this "sequence" could also have length 1 or even length 0.
>>
>> So I get some line in the form of:
>>   line = '(2,3,4)'
>>   line = ''
>>   line = '(2)'
>> (in fact these are not constant numbers, but all kind of integer
>> variables, coming from all over the program, selected from a tree, that
>> shows all "reachable" variables)
>>
>> So in fact I get the value from an exec statement, like this
>>   exec 'signals = ' + line
>>
>> Now I want to iterate over "signals", which works perfect if there are 2
>> or more signals,
>> but it fails when I have none or just 1 signal.
>> for value in signals :
>> do something
>>
>> As this meant for real-time signals, I want it fast, so (I think) I
>> can't afford extensive testing.
>>
>> Any smart solution there ?
>> 
>
> First: don't collect data into strings - python has many container
> types which you can use.
>   
Well I'm not collecting data, I'm collecting pointers to data.
This program simulates a user written program in JAL.
As Python doesn't support pointers, instead I collect names.
The names are derived from an analysis of the user program under test,
so the danger some of you are referring to, is not there,
or at least is not that simple.
Besides it's a local application where the goal is to let a user test 
his program (and hardware),
so if the user want to hack, he can better type directly "format c:\".

> Next, your strings look like they're supposed to contain tuples. In
> fact, tuples are a bit awkward sometimes because you have to use
> '(a,') for a tuple with one element - (2) isn't a tuple of length one,
> it's the same as 2. Either cope with this special case, or use lists.
> Either way, you'll have to use () or [] for an empty sequence.
>   
Of course, thanks Paul,
if I change tuple to list, everything works ok, even with empty lists.

cheers,
Stef Mientki
> --
> Paul Hankin
>
>   
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: globals accros modules

2007-01-11 Thread stef

>
> Change a=1 to amodule.a=1
> If you find yourself doing tricks with the module globals, think about 
> redesigning your application.
>
Of course I completely agree with you.

But ...
if you're moving from MatLab to Python,
and want to show your collegaes,
with how little effort they can reuse all their existing MatLab routines 
in Python,
then the global issue is a real pain !!

You can explain your collegaes, that
- the startindex of arrays changes from 1 to 0
- slices are upto, instead of including the final border
- indention is thé key
And tell them about all beautiful things in Python,
but tell them that they are going to loose all their globals ???

cheers,
Stef Mientki

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Projects anyone?

2007-01-16 Thread stef
placid wrote:
> Hi all,
>
> I'm looking for anyone who is working on a project at the moment that
> needs help (volunteer). The last project i worked on personally was
> screen-scraping MySpace profiles (read more at the following link)
>
> http://placid.programming.projects.googlepages.com/screen-scrapingmyspaceprofiles
>
>
> but that didn't go all to well, so im kinda bored and need something to
> do, with Python. So any suggestions anyone? 
>
> Cheers
>
>   
hello Chad,

I would have expected lots of reactions on your message,
buts as there's still none, I'll kick of.

I don't know what your knowledge and interests and

I'm just a completely newbie in Python (3..4 weeks),
so I might not have a good overview,
but coming from MatLab (and I'm not the only one who is thinking of 
switching to Python ;-)
there are a couple of fairly general modules that I'm missing in Python:
- SimuLink
- (PowerSim)

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Windows Editors

2007-01-22 Thread stef
gonzlobo wrote:
> I prefer PyScripter too, but would like to know if I can have
> 'indentation guides' enabled like PythonWin allows.
If you mean, typing a for-statement, then when placing the final ":"+Enter,
the indentation auto increases,
then the answer is yes,
otherwise I don't kno what you mean.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Windows Editors

2007-01-23 Thread stef
Laurent Pointal wrote:
> W. Watson a écrit :
>   
>> I downloaded python-2.5.msi and installed it. I believe its editor is
>> IDE. I understand there's a Win editor called pythonwin. I believe it's
>> in the download pywin32-210.win32-py2.5.exe, but I'm not sure if this
>> exe file has just the editor or all of Python. Comments? If not how do I
>> get the PythonWin editor by itself?
>>
>> 
> Have you take a look at the IDEs page in the Python Wiki (python.org)?
>
> http://wiki.python.org/moin/IntegratedDevelopmentEnvironments
>
>   
just what I said, TOO many ;-)
and of course how do you keep these pages up-to-date ?
Zeus (commercial) isn't mentioned ...
SPE which has great credits, but can't be found, and if you find it 
somewhere, no manual and it crashes within 30 seconds (repeatly)  ;-)

Not an easy task I guess,
but it would be nice to have some voting system,
(maybe only to allow voting when you have compared at least 2 programs)
that would represent the current state,
and in which new programs would have a fair chance to start.

cheers,
Stef Mientki

-- 
http://mail.python.org/mailman/listinfo/python-list


another newbie question: why should you use "*args" ?

2007-01-31 Thread stef

why should I use *args,
as in my ignorance,
making use of a list (or tupple) works just as well,
and is more flexible in it's calling.
So the simple conclusion might be: never use "*args",
or am I overlooking something ?

# method 1
def execute (self, *args):
for i in range ( len(args) ):
... do something

# method 2
def chunk_plot(self, list):
for i in range ( len(list) ):
  do something


# calling method 1:
execute (S[0], S[4] )

# calling method 2:
execute ( ( S[0], S[4] ) )

# or *the extra flexibility)
mylist = ( S[0], S[4] )
execute ( mylist )


thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: another newbie question: why should you use "*args" ?

2007-01-31 Thread stef



It's bad practice to use built-ins like 'list' as a regular variable
name.
  
ok, but it was just an example (in practice, I always use very long 
names ;-)
  

# calling method 1:
execute (S[0], S[4] )

# calling method 2:
execute ( ( S[0], S[4] ) )



Let's take a look at those side-by-side:
execute (S[0], S[4] )
execute ( ( S[0], S[4] ) )

Now, which one *looks* better?

  

# or *the extra flexibility)
mylist = ( S[0], S[4] )
execute ( mylist )



Also, take into consideration the opposite end of the pole; you have
your list of arguments (args), and your about to call a function that
was declared something like this:
def someFunction(arg1, arg2, arg3):
  # etc.
Which is clearer?
someFunction(*args)
someFunction(args[0], args[1], args[2])

And if you've got a variable number of arguments, it becomes virtually
impossible to avoid using the *args syntax.

  

# So with this construct, I have all flavours:

def chunk_plot(*args):
   if len(args)==1: my_example_var = args[0]
   else: my_example_var = args
   for i in range  ( len ( my_example_var ) ):
   ... do something with  my_example_var [i]

# calling the procedure
chunk_plot (S[1], S[4])
chunk_plot ( ( S[1], S[4] ) )
my_action_list = ( S[1], S[2] )
chunk_plot ( my_action_list )


And sorry, no need for kwargs for now ;-)

thanks guys,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: another newbie question: why should you use "*args" ?

2007-01-31 Thread stef
Eugene Antimirov wrote:
> stef wrote:
>
>> # method 2
>> def chunk_plot(self, list):
>> for i in range ( len(list) ):
>>   do something
>
>
> And one note more. Just to be more pythonic you shouldn't use form 
> range(len(blabla)). Instead use:
>
> for i in list:
> blabla...
>
>
I would love that,
but please tell me how (I need an integer counter for something else too):

def chunk_plot(*args):
if len(args) == 1:  list = args[0]
else:   list = args
 
color = ['g','r','b','y','m']
plot ( list[0], color[0])
hold (True)
for i in range  (  1,  len(list)  ):
 plot  (  list[i],  color[i]  )



cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: another newbie question: why should you use "*args" ?

2007-01-31 Thread stef



I would love that,
but please tell me how (I need an integer counter for something else too):

def chunk_plot(*args):
if len(args) == 1:  list = args[0]
else:   list = args
 
color = ['g','r','b','y','m']

plot ( list[0], color[0])
hold (True)
for i in range  (  1,  len(list)  ):
 plot  (  list[i],  color[i]  )



No need for the counter here.

for args in zip(list[1:], color[1:]):
plot(*args)

  

that looks nice, thanks!
All the other people also thanks, "enumerate" looks also better than 
range(len(  nice !

Ciao,
Marc 'BlackJack' Rintsch
  


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Testers please

2007-02-13 Thread stef
martien friedeman wrote:
> I have written this tool that allows you to look at runtime data and 
> code at the same time.
> And now I need people to test it.
>
> The easiest way to see what I mean is to look at some videos:
> http://codeinvestigator.googlepages.com/codeinvestigator_videos
>
> It requires Apache and Sqlite.
>
> It works for me with a Firefox browser on Linux. 
Great idea !
Especially for newbies, so you've to make sure it's always in the "first 
starters package".

As most modern code-editors, already support context sensitive popup's,
can't you make a module that can be added to any editor ?

a few other suggestions
- for large datasets, display only the "corner" values
- for loops, also only display the "corner" values
- to decrease datasize enormuous, limit the functionality to a piece of 
code selected by the user
- get rid of Apache and SQLite, too complicated for newbies

keep on the good work,
cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What do you use with Python for GUI programming and why?

2011-03-12 Thread Stef Mientki
On 11-03-2011 22:45, Dan Stromberg wrote:
>
> On Fri, Mar 11, 2011 at 12:54 PM, Fred Pacquier  <mailto:xne...@fredp.lautre.net>> wrote:
>
> Robert mailto:sigz...@gmail.com>> said :
>
> > Is there a push to one toolkit or the other?
>
> If you are just now getting started, I would honestly suggest you save a
> whole lot of time and dive straight into PyQt. I've tried most 'em over 
> the
> years (including some now discontinued), and in my experience Qt is way
> above the rest, especially as far as consistency and productivity are
> concerned. The Python bindings are very mature and well maintained, and go
> a long way attenuating the evil C++ roots.
>
> I havent tried Nokia's equivalent (PySide). I'm not sure what its fate 
> will
> turn out, given the company's change of heart and Microsoft honeymoon. At
> least PyQt is't going anywhere soon.
>
>
> Didn't Nokia acquire Trolltech (and hence the rights to much if not all of 
> Qt) in 2008?
yep, and they just sold the commercial part of QT to Digia.
>
> I'm not at all sure Qt's future is as bright as one might wish for.  They've 
> already declared that
> Qt will not be ported to Windows Mobile in any official way, and of course 
> mobile (not necessarily
> Windows Mobile) is where just about everything is headed.
And Nokia is talking with Micraosoft about using theirs Phone 7
>
> Actually, for something that's very cross-platform, you might check this out:
> http://radicalbreeze.com/  Bryan can be a bit of a goober, but it sounds like 
> he's successfully
> implemented a great idea for quickly and easily writing cross-platform 
> applications.
another way of reaching the same goal,
is to use a wrapper that supports the different backends.
As I found wxPython much too difficult (I was a Delphi guy),
I started directly with a wrapper when I started using wxPython a few years ago.
In the meanwhile I've extended (very experimental) the wrapper so it not only 
supports wxPython, but
also PyJamas, PySide and PyGUi.

cheers,
Stef
>
> "Illumination even gives you the full Adobe Flex, Android Java, iOS Obj-C and 
> Python source code
> to the projects you create.  Making it a great way to prototype new projects, 
> or learn new languages."
>
> I've still got a soft spot for Pyjamas though - it's opensource.
>

-- 
http://mail.python.org/mailman/listinfo/python-list


is there an autocompletion like Dasher ?

2011-05-07 Thread Stef Mientki
hello,

I would like to have a autocompletion / help /snippet system like Dasher :

http://www.inference.phy.cam.ac.uk/dasher/

anyone seen such a component ?

thanks,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: is there an autocompletion like Dasher ?

2011-05-07 Thread Stef Mientki
On 08-05-2011 01:28, Dan Stromberg wrote:
>
> On Sat, May 7, 2011 at 3:40 PM, Stef Mientki  <mailto:stef.mien...@gmail.com>> wrote:
>
> hello,
>
> I would like to have a autocompletion / help /snippet system like Dasher :
>
> http://www.inference.phy.cam.ac.uk/dasher/
>
> anyone seen such a component ?
>
>
> Ummm...  For what OS and what hardware?
Windows desktop (and webbrowser would be nice)
>   Do you need something that was written in Python?
>
>  
preferable

thanks,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


maybe useful : datetime conversion

2011-05-20 Thread Stef Mientki
hello,

using datetimes from a lot of different sources,
in many languages,
I had about 30 python helper routines,
which I now packed in one class,
much simpler.
Although I used the Delphi date-format as the base,
it shouldn't be difficult to rewrite the class for another type.

The input can be one of the following types :
  - None: the current date-time is used
  - 3.9 : a Delphi datetime
  - 3   : a Delphi datetime
  - "3.9"   : a Delphi datetime as a string
  - "3,9"   : a Delphi datetime as a (Dutch) string
  - "20-5-11"  : short year notation
  - "20-05-2011"   : long year notation
  - "2009-09-24 10:12:24"  : Access string
  - datetime.datetime ( 2011, 1, 15 )
  - time.struct_time
  - wx.DateTime
  - time.time()  (through method from_time)

Maybe someone can use it.

cheers,
Stef


import time
import datetime
import wx

Delphi_Date_0 = datetime.date ( *time.strptime ( '30-12-1899', '%d-%m-%Y' )[0:3]).toordinal()

# 
# 
class Delphi_Date ( float ) :
  def __new__ ( self, Something = None ) :
"""
Class meant to handle any datetime type, and converts it basically to
a Delphi DateTime (float: number of days since 1-1-1900).

The input can be one of the following types :
  - None: the current date-time is used
  - 3.9 : a Delphi datetime
  - 3   : a Delphi datetime
  - "3.9"   : a Delphi datetime as a string
  - "3,9"   : a Delphi datetime as a (Dutch) string
  - "20-5-11"  : short year notation
  - "20-05-2011"   : long year notation
  - "2009-09-24 10:12:24"  : Access string
  - datetime.datetime ( 2011, 1, 15 )
  - time.struct_time
  - wx.DateTime

with extra methods, also the following can be used
  - from_time   : time.time float

The following output methods are available
  - to_time ()
  - to_datetime ()
  - to_String ( self , Format = "%d-%m-%Y" )
  - to_String_Short ()
  - to_String_Date_Time_Short ()
  - to_String_Time_Short ()
  - to_String_Date_Time ()
  - to_wxTime ()
  - to_Iso ()
"""

# The current date-time is used, if no parameter is specified
if Something is None :
  Something = datetime.datetime.now ()

# floating point is assumed to be a Delphi datetime
# to specify a time.time float, use the method from_time
# Delphi_Date().from_time ( time.time()
# which is equivalent to
# Delphi_Date()
if isinstance ( Something, float ) :
  Value = Something

# sometimes a Delphi datetime is stored as an integer
elif isinstance ( Something, int ) :
  Value = Something

# A string can represent a lot of things
elif isinstance ( Something, basestring ) :

  # a float or integer,
  # also the Ducth notation where deceimal separator is a comma
  try :
Value = float ( Something.replace(',','.') )
  except :

# a string as a short year notation
try :
  Value = datetime.datetime.strptime ( Something, '%d-%m-%y' )
except ValueError :

  # a string as a long year notation
  try:
Value = datetime.datetime.strptime ( Something, '%d-%m-%Y' )
  except :

# a string as a (Dutch) Access notation
try :
  # Access string : "2009-09-24 00:00:00"
  Value =  datetime.datetime.strptime ( Something.split(' ')[0], "%Y-%m-%d" )
except :
  Value = Delphi_Date_0
  import traceback
  traceback.print_exc

Value = Value.toordinal() - Delphi_Date_0

# datetime.datetime ()
elif isinstance ( Something, datetime.datetime ) :
  Value = Something.toordinal() - Delphi_Date_0

# time.struct_time
elif isinstance ( Something, time.struct_time ) :
  Value = time.mktime ( Something )
  DT = datetime.datetime.fromtimestamp ( Value )
  Value = DT.toordinal() - Delphi_Date_0

# wx.DateTime
elif isinstance ( Something, wx.DateTime ) :
  DT = datetime.date ( Something.GetYear (),
   Something.GetMonth () + 1,
   Something.GetDay () )
  Value = DT.toordinal() - Delphi_Date_0

else :
  print type(Something), Something
  raise error ( 'aap' )

return float.__new__ ( self, Value )

  def from_time ( self, Time ) :
DT = datetime.datetime.fromtimestamp ( Time )
return Delphi_Date ( DT )


  def to_time ( self ):
return time.mktime ( self.to_datetime().timetuple() )

  def to_datetime ( self ) :
#return datetime.datetime.fromordi

and becomes or and or becomes and

2011-05-22 Thread Stef Mientki
hello,

must of us will not use single bits these days,
but at first sight, this looks funny :

>>> a=2
>>> b=6
>>> a and b
6
>>> a & b
2
>>> a or b
2
>>> a | b
6

cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


how to make a nested list

2011-09-15 Thread Stef Mientki

hello,

I need a nested list, like this

>>> A= [ [None,None], [None,None], [None, None] ]
>>> A[2][0] =77
>>> A
[[None, None], [None, None], [77, None]]


Because the list is much larger, I need a shortcut (ok I can use a for loop)
So I tried
>>> B = 3 * [ [ None, None ]]
>>> B[2][0] = 77
>>> B
[[77, None], [77, None], [77, None]]

which doesn't work as expected.

any suggestions ?

thanks,
Stef
--
http://mail.python.org/mailman/listinfo/python-list


Re: (don't bash me too hard) Python interpreter in JavaScript

2011-11-15 Thread Stef Mientki

On 15-11-2011 21:37, Passiday wrote:

Hello,

I am looking for a way how to bring Python interpreter to JavaScript, in order 
to provide a web-based application with python scripting capabilities. The app 
would have basic IDE for writing and debugging the python code, but the 
interpretation, of course, would be done in JavaScript. I'd like to avoid any 
client-server transactions, so all the interpretation should take place on the 
client side. The purpose of all this would be to create educational platform 
for learning the programming in python.

I hoped somebody already had done something like this, but I couldn't google up 
anything. I've found some crazy project emulating PC in JavaScript (and even 
running Linux on top of it), but not a python interpreter.

Of course, I could take the python source and brutally recode it in JavaScript, 
but that seems like awful lot of work to do. Any ideas how I should proceed 
with this project?

skulpt ?

cheers,
Stef
--
http://mail.python.org/mailman/listinfo/python-list


[ANN] Android Debug Bridge (ADB) Scripting Language For Android (SL4A) convenience library

2011-11-27 Thread Stef Mientki

hello,

The information on ADB / SL4A is quiet overwhelming.
Despite that, especially for people, not familiar with Linux, it's not an easy task to get their 
first program running.
This library allows you to easy upload and run Python files on a Android device, without pressing 
any button on the Android device.


After installing SL4A and Py4A on the Android device, and ADB on the hostmachine, it's just a matter 
of connecting the USB cable between Android device and host-PC, and run the program.


One of the simplest program that will run out of the box (without touching any button on the Android 
device) :


# *
from adb_sl4a_support import ADB_Connection

ADB = ADB_Connection ()
print ADB

# Create a simple program
Simple_Program = """
import android
droid = android.Android (( '%s', %s ))
droid.makeToast ( "Wasn't that easy?")
""" % ( ADB.SL4A_Servers [-1][0], ADB.SL4A_Servers [-1][1] )

# execute the program (this will run the program from the host PC !!)
exec ( Simple_Program )
# *

you can find the library here:
http://code.google.com/p/pylab-works/downloads/detail?name=adb_sl4a_support.py&can=2&q=

cheers,
Stef
--
http://mail.python.org/mailman/listinfo/python-list


Re: regular expression

2006-12-24 Thread Stef Mientki
Dustan wrote:
> Kleine Aap wrote:
>> Asper Faner wrote:
>>
>>> I seem to always have hard time understaing how this regular expression
>>> works, especially how on earth do people bring it up as part of
>>> computer programming language. Natural language processing seems not
>>> enough to explain by the way. Why no eliminate it ?
>> I.M.H.O. anyone that is not capable to grasp the concept of regular
>> expressions should not attempt to write computer programs at all! My
>> suggestion to you would be to find a job that involves working with your
>> hands...
> 
> Your humble opinion doesn't get much ruder...
> 
> Perhaps you meant "anyone that is not capable to grasp the concept of
> regular expressions after some experience with programming should not
> attempt to write computer programs at all!" Then at least newbies would
> have a leg to stand on.
> 
> Otherwise, you're practically cutting off all entrances into the world
> of programming! The concept of regular expressions isn't exactly the
> simplest one out there. Just because you understood it immediately
> (which I'm guessing you did, considering your harsh response), doesn't
> mean others find the concept that simple.
> 
I agree, and in addition:

(large) regular expressions are easy to write,
but can be almost impossible to read back !

I once had a program to generate and evaluate regular expressions,
but can't find it anymore :-(

If someone has links to regex generators/evaluators,
I'ld be much obliged.

cheers.
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: file/directory format/size help

2006-12-24 Thread Stef Mientki

>> #1 What type of file is the file? Is it a movie, image, or text
>> document?
> 
> In the Windows world, one simply looks at the file extension (e.g. .gif,
> .avi, .txt, etc.) and hopes that it is correct.
or simply use TRID:
http://mark0.net/soft-trid-e.html

Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


persistant gloabl vars (very newbie) ?

2006-12-27 Thread Stef Mientki
hi all,

I'm investigating the possibilities to replace MatLab with Python
(+NumPy +SciPy).
I'm a very newbie, I just typed my first characters and calculated the
sum of 2 and 3 in Python.

My application is a Delphi program, for data-acquisition and real-time
data analysis. The real-time analysis is done with MatLab, embedded
through a OLE coupling. I already found PythonforDelphi which probably
helps a lot to make the first steps.

But I'm now stumbled about something very basic, which I don't
understand. The problem might be due to the IDE I use (PyScripter), but
I tried several and they all behave the same. And I expect that the
observed  behaviour might be very important notch in my final 
application (blockwise, real time interaction).

In MatLab I declare a workspace, in which each variable I declare
is automatically global, and can be reached from all views, i.e. from 
the command line interpreter as well as form the OLE environment, no 
matter where they are declared.
I try to do something similar in Python:
- I want to run an initialization part just once
- I want to run some testcode often and interactively

So the most simple example:

#Initialization
import time;
A = 5;

#code under test
x=time.time();
# do something time consuming
print 1000*(time.time()-x);

Now if I run the initialization part, manual line by line in the command 
line interpreter, I can run the code under test as often as I want.
My real initilization code is much larger and therefor very clumsy to 
run line by line in the command line interpreter.

Is there a way to run the initialization code from a script(file) once,
to achieve the same effect ?

thanks,
Stef Mientki



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: persistant gloabl vars (very newbie) ?

2006-12-27 Thread Stef Mientki
> other module that has done 'from init import *'.
> 
> If you want that kind of behaviour it is better to use: 'import init' and
> refer to the variables as init.X and init.Y so that you can change them.
> Whether that is a good idea is another matter.
> 
> There are other reasons for not using the from init import * form, as you
> might overwrite bindings in the module in an unforseen way. from init
> import X,Y explicitely is probably safer. And, by the way, from init import
> * can only be used at module level, not in inner namespaces.

thank you guys,
but it's still not quit handy

# initialization file (init1.py)
import time;
xx = 44

# main file was
print xx
x=time.time()

# main file should become
print init1.xx
x=init1.time.time()

so even for the "standard" functions like "time" I've to include the 
preceeding module "init1" :-(

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: persistant gloabl vars (very newbie) ?

2006-12-28 Thread Stef Mientki
Erik Johnson wrote:
>> but it's still not quit handy
>>
>> # initialization file (init1.py)
>> import time;
>> xx = 44
>>
>> # main file was
>> print xx
>> x=time.time()
>>
>> # main file should become
>> print init1.xx
>> x=init1.time.time()
>>
>> so even for the "standard" functions like "time" I've to include the
>> preceeding module "init1" :-(
> 
> 
> Ummm... does this help?
> 
> /src/python/Foo> cat init.py
> #! /usr/local/bin/python
> 
> from time import time
> xx = 44
> 
> /src/python/Foo> python
> Python 2.3.4 (#1, Feb  7 2005, 15:50:45)
> [GCC 3.3.4 (pre 3.3.5 20040809)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from init import *
>>>> dir()
> ['__builtins__', '__doc__', '__file__', '__name__', 'time', 'xx']
>>>> xx
> 44
>>>> time
> 
>>>> time()
> 1167262478.6845641
>>>> xx = 42  # this does not change the init module's value!
>>>> import init
>>>> init.xx
> 44
> 
> As Piet points out, you get a copy of variables defined in a module when
> using the from module import * syntax (as is demonstrated by the assignment
> above). (And I stand corrected on the notion that you could execute "from
> module import *" in other than module level scope.)
> 
> If it is your intention to use those variables defined in init to
> communicate with other modules making the same sort of import, then you
> probably don't want to use  "from module import *"  syntax.  In that case,
> you can import just the module, and make assignments into that module's
> namespace. (e.g., init.xx = 3)
> 
> If all you care about is getting some "stuff" into your global namespace
> in a convenient and repeatable way, then I think what I showed both above
> and originally is fine.
> 
thanks Erik,

I think I'm slowly getting the picture:
always use "import", which is the most unambiguous approach.
Life is sometimes difficult for a MatLab user, see my next post ;-)

Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Stef Mientki
I want to return a "simple" variable from a function,
not using the function result.
Is that in any way possible ??

The code below is from O'Reilly, "Learning Python",
and there seems no way
to return a simple var like "z" in the example below.
Is that true ?

thanks,
Stef Mientki


def some_function (z, y):
   z = 2
   y[2] = 'global ?'


x = 5
y = [1,2,3,4]
print x,y
some_function(x,y)
print x,y

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Stef Mientki
Carsten Haese wrote:
> On Thu, 2006-12-28 at 15:28 +, Paul Hummer wrote:
>> You'd have to either pass the variables by reference into the function, [...]
> 
> In Python, all function calls are call by reference. Period. The key
> difference between Python and other programming languages is in the
> behavior of the assignment statement.
> 
> To paraphrase http://effbot.org/zone/python-objects.htm :
> 
> In C/C++, assignments modify objects by copying the value from the right
> hand side into the memory allocated to the object on the left hand side.
> 
> In Python, assignments modify namespaces by making the name on the left
> hand side become a reference to the object on the right hand side. It is
> irrelevant whether the name referred to some other object before the
> assignment, and it is irrelevant whether that object is mutable or not.
> 
> The only way to achieve call-by-reference-like behavior in the
> "assignment modifies objects" sense is by passing a reference to a
> mutable object and then invoking the object's methods to mutate it.
> Maybe that's what you meant, but that wasn't clear from what you said.
> 
> -Carsten
> 
> 
Laszlo, Carsten, Paul, Marc,
thanks for your valuable input,
I'm beginning to see the light, but it's still very dimmed.
Not only Python looks much more promising than MatLab,
but the also the Python newsgroup is much more helpfull than ... ;-)

Maybe one of you could give me hint to solve the next problem
(copied from one of my Matlab procedures ;-)
I can find a solution (= something that works) myself,
but I have the feeling this is completely the wrong way to go .


# filter a chunk of a continuous signal IOI,
# so a continuous filtered signal is created.
# The function itself returns the filtered signal IOO,
# now to handle the chunks and create a continuous signal
# we must preserve a piece of history: "filter_prev"
# so this should either be an input and output variable

def chunk_Filter (filter_b, filter_a, Signal_IN, filter_prev):
   Extended = r_ [filter_prev, Signal_IN]
   filter_prev = Extended [ len(Signal_IN) : ]
   Extended = signal.lfilter(filter_b, filter_a, Extended)
   Signal_OUT = Extended [ len(filter_prev) : ]
   return Signal_OUT

# call the function with actual parameters

IOO = chunk_Filter (BP_filter_b, BP_filter_a, IOI, BP_filter_prev)


When I replace the assignment to "filter_prev", by a loop,
the function works as expected.

   #filter_prev = Extended [ len(Signal_IN) : ]
   for i in range( len(filter_prev )):
 filter_prev[i] = Extended [ len(Signal_IN) + i ]


I can not use a global variable here, because this function should be 
called for several signals, each of course with it's own history.

thanks,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to return a simple variable from a function (still newbie) ?

2006-12-28 Thread Stef Mientki

 I'll hope to understand that later on !

  You can achieve the
> same result without side-effects by returning more than one return value
> from your function.
> 
> Hope this helps,
Wow this certainly helps,
thanks very much Carsten!

Why is the obvious sometimes so far away ;-)

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


probably a stupid question: MatLab equivalent of "diff" ?

2006-12-29 Thread Stef Mientki
Does anyone know the equivalent of the MatLab "diff" function.
The "diff" functions calculates the difference between 2 succeeding 
elements of an array.
I need to detect (fast) the falling edge of a binary signal.

There's derivate function in Python diff,
but when you use an binary (true/false) input,
it also detects rising edges.

Probably a stupid question,
but I still have troubles,
digging to huge amount of information about Python.

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Wow, Python much faster than MatLab

2006-12-29 Thread Stef Mientki
hi All,

instead of questions,
my first success story:

I converted my first MatLab algorithm into Python (using SciPy),
and it not only works perfectly,
but also runs much faster:

MatLab: 14 msec
Python:  2 msec

After taking the first difficult steps into Python,
all kind of small problems as you already know,
it nows seems a piece of cake to convert from MatLab to Python.
(the final programs of MatLab and Python can almost only be 
distinguished by the comment character ;-)

Especially I like:
- more relaxed behavior of exceeded the upper limit of a (1-dimensional) 
  array
- much more functions available, like a simple "mean"
- reducing datatype if it's allowed (booleans of 1 byte)

thanks for all your help,
probably need some more in the future,
cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread Stef Mientki

>> MatLab: 14 msec
>> Python:  2 msec
> 
> For times this small, I wonder if timing comparisons are valid. I do
> NOT think SciPy is in general an order of magnitude faster than Matlab
> for the task typically performed with Matlab.
The algorithm is meant for real-time analysis,
where these kind of differences counts a lot.
I'm also a typical "surface programmer"
(don't need/want to know what's going inside),
just want to get my analysis done,
and the fact that Python has much more functions available,
means I've to write far less explicit or implicit for loops,
and thus I expect it to "look" faster for me always.
> 
>> After taking the first difficult steps into Python,
>> all kind of small problems as you already know,
>> it nows seems a piece of cake to convert from MatLab to Python.
>> (the final programs of MatLab and Python can almost only be
>> distinguished by the comment character ;-)
>>
>> Especially I like:
>> - more relaxed behavior of exceeded the upper limit of a (1-dimensional)
>>   array
> 
> Could you explain what this means? In general, I don't want a
> programming language to be "relaxed" about exceeding array bounds.
> 
Well, I've to admit, that wasn't a very tactic remark, "noise" is still
an unwanted issue in software.
But in the meanwhile I've reading further and I should replace that by
some other great things:
- the very efficient way, comment is turned into help information
- the (at first sight) very easy, but yet quit powerfull OOPs implemetation.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread Stef Mientki
> 
> I'm not sure about SciPy,

Yes SciPy allows it too !
  but lists in standard Python allow this:
> 
>>>> array = [1, 2, 3, 4]
>>>> array[2:5]
> [3, 4]
> 
> That's generally a good thing.
> 

You're not perhaps by origin an analog engineer ;-)

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread Stef Mientki
Mathias Panzenboeck wrote:
> A other great thing: With rpy you have R bindings for python.

forgive my ignorance, what's R, rpy ?
Or is only relevant for Linux users ?

cheers
Stef

> So you have the power of R and the easy syntax and big standard lib of 
> python! :)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread Stef Mientki
Doran, Harold wrote:
> R is the open-source implementation of the S language developed at Bell
> laboratories. It is a statistical programming language that is becoming
> the de facto standard among statisticians.
Thanks for the information
I always thought that SPSS or SAS where thé standards.
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Wow, Python much faster than MatLab

2006-12-30 Thread Stef Mientki
> I think of SAS and R as being like airliners and helicopters -- 
I like that comparison,...
.. Airplanes are inherent stable,
.. Helicopters are inherent not-stable ;-)

cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Difference between __init__ (again) and nothing ...

2007-01-02 Thread Stef Mientki
What's the difference between using __init__ and using nothing,
as the examples below.


class cpu:
   PC = 4



class cpu:
   def __init__:
 self.PC = 4

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Difference between __init__ (again) and nothing ...

2007-01-02 Thread Stef Mientki
Marc 'BlackJack' Rintsch wrote:
> In <[EMAIL PROTECTED]>, Stef Mientki wrote:
> 
>> What's the difference between using __init__ and using nothing,
>> as the examples below.
>>
>> class cpu:
>>PC = 4
> 
> This is a *class attribute*.  It's the same for all instances of `cpu`.
> 
>> class cpu:
>>def __init__:
>>  self.PC = 4
> 
> This is an *instance attribute* which is set in every instance of `cpu`.
>
thanks Marc,

Oh so obvious, why didn't I discovered that myself ;-)

cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


list/dictionary as case statement ?

2007-01-02 Thread Stef Mientki

If I'm not mistaken, I read somewhere that you can use 
function-names/references in lists and/or dictionaries, but now I can't 
find it anymore.

The idea is to build a simulator for some kind of micro controller (just 
as a general practise, I expect it too be very slow ;-).

opcodes ={
   1: ('MOV', function1, ...),
   2: ('ADD', function2, ),
   3: ('MUL', class3.function3, )
   }

def function1
   # do something complex


Is this possible ?

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: list/dictionary as case statement ?

2007-01-02 Thread Stef Mientki
> 
> Yes. Functions are (so called) first class objects. You can refer to one 
> by name, and pass that reference around in variables and other data 
> structures.
> 
> That said, your code above won't work as written because function1 is 
> not in existence when you refer to it.
> 
Yes, I just found that out.

Thanks Gary and Grant,
this principle really works like a charm.

cheers,
Stef Mientki

-- 
http://mail.python.org/mailman/listinfo/python-list


function without brackets ?

2007-01-03 Thread Stef Mientki
If I call a parameterless function without brackets at the end,
the function is not performed, but ...
I don't get an error message ???

Is this normal  behavior ?

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: function without brackets ?

2007-01-03 Thread Stef Mientki

> Hope this helps,
> 
thanks You all guys,
It's perfectly clear to me now !

cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: list/dictionary as case statement ?

2007-01-03 Thread Stef Mientki
Tom Plunket wrote:
> Bjoern Schliessmann wrote:
> 
>> Intels aren't RISC, are they?
> 
> Not the ones in PCs.  The OP didn't specify the CPU that's being used,
> however.
> 
Well it was meant for a small micro-controller, the PIC-14-series,
e.g. PIC16F877.

I already build a simulator for this device in  Delphi,
but it seemed a nice idea, and a good exercise for me,
to see how this could be done in Python.

And thanks to you all,
I've the core (not the pheripherals) working now,
and my experience with Python are very positive.

The main advantages of the simulator in Python are:
   - very elegant and lean code
   - the treshold of Python is much lower
 (in my opinion, simulators only live when more people are involved)
The main disadvantages (I think, not yet tested)
   - the speed is much lower
   - the GUI is much more complex

For those who are interested,

The rough code of the Python code can be seen here
(I might have committed a mortal sin, by changing "self" into "S" ??)
   http://oase.uci.kun.nl/~mientki/download/cpu2.txt
btw, as I'm a total newbie, any comment is welcome !!

The Delphi simulator can be seen here
   http://oase.uci.kun.nl/~mientki/data_www/pic/jalss/jalss.html

thanks again,
for all your fast and very adequate responses !!

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


(newbie) Is there a way to prevent "name redundancy" in OOP ?

2007-01-05 Thread Stef Mientki
Not sure I wrote the subject line correct,
but the examples might explain if not clear


*** first attempt ***
class pin:
   def __init__ (self):
 self.Name  = 'Unknown Pin'

aap = pin() # create an instance
aap.Name = 'aap'# set it's name
print aap.Name  # print it's name
# but why should I set it's name ??
print 'aap' # I can just as well print a constant string !!
 # (ok there will be an extra check)


*** second attempt ***
class pin2:
   def __init__ (self, naam):
 self.Name  = naam

aap2 = pin2('aap2') # seems completely redundant to me.
print aap2.Name
print 'aap2'


Can this be achieved without redundancy ?

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (newbie) Is there a way to prevent "name redundancy" in OOP ?

2007-01-06 Thread Stef Mientki

Steven Bethard wrote:
> Stef Mientki wrote:
>> Not sure I wrote the subject line correct,
>> but the examples might explain if not clear
> [snip]
>> class pin2:
>>   def __init__ (self, naam):
>> self.Name  = naam
>>
>> aap2 = pin2('aap2') # seems completely redundant to me.
>> print aap2.Name
> 
> You can use class statements to create your instances with some 
> metaclass trickery. Unlike normal assignments, class statements get 
> access to the name being assigned. So you could write your class like::

thank you all guys,
this gives me a lot to study,
for the moment I'm satisfied with the fact that it "is possible".

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


howto overload with a NOP (empty statement)

2007-01-06 Thread Stef Mientki
How should I overload / disable a method ?
In the example below I have defined the class "Power_Supply", derived 
from baseclass "device".
The baseclass has a method "execute", which will be implemented in most 
derived classes, but not in all.
Now apparently it's not allowed to overload a method with an empty 
statement.
I could write a nonsense dummy statement, like "A= 3", but isn't there 
another way ?

thanks, Stef Mientki

class device:
   def execute (self):
 print 'execute not yet implemented for', self.Name


class Power_Supply (device):
   def execute (self): ;
-- 
http://mail.python.org/mailman/listinfo/python-list


still struggling, howto use a list-element as a name ?

2007-01-06 Thread Stef Mientki
In the example below, "pin" is an object with a number of properties.
Now I want
1- an easy way to create objects that contains a number of these "pin"
2- an multiple way to access these "pin", i.e.
 device.pin[some_index]
device.some_logical_name
ad 1:
a dictionary (as "pinlist" in the example) seems a very convenient 
 way (from a viewpoint of the device creator).
As you can see in the "__init__" section this dictionary can easily be 
transported to the pin-objects.

ad 2:
THAT's the problem: how do automate these lines "self.GND = self.pin[0]"

I'm also in for other solutions.

thanks,
Stef


class Power_Supply(device):
 pinlist = {
 0: ('GND', _DIG_OUT, _par2),
 1: ('VCC', _DIG_OUT, _par33)
 }

 def __init__(self):
 # store pin-names and pin-parameters in pins
 for k in self.pinlist.keys():
   self.pin[k].Name = self.pinlist[k][0]
   self.pin[k].Value = self.pinlist[k][2]

 # for some pins, we also want to be able to use logical names
 # HOW TO USE SOMETHING like
 # "self.pinlist[0] = self.pin[0]"
 # INSTEAD OF
 self.GND = self.pin[0]
 self.VCC = self.pin[1]

# create a Power_Supply instance and
# test if pins can be referenced in
Power = Power_Supply()
netlist1 = ( Power.VCC, Power.pin[1], Power.GND, Power.pin[0] )
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: still struggling, howto use a list-element as a name ?

2007-01-06 Thread Stef Mientki
>> class Power_Supply(device):
>>  pinlist = {
>>  0: ('GND', _DIG_OUT, _par2),
>>  1: ('VCC', _DIG_OUT, _par33)
>>  }
> 
> I may be confused about what you're after, but wouldn't something 
> like this work? (I don't know what a _par2 object is; I've named 
> it something here.)
_par2, is just (a reference to) a constant
> 
> class Power_Supply(device):
> def __init__(self):
> self.pin = {
> 0:dict(Name='GND',Value=_DIG_OUT,something=_par2),
> 1:dict(Name='VCC',Value=_DIG_OUT,something=_par33),
> }
Why so complex, I need 10 or more parameters (or empty),
and then this becomes completely unreadable.
As this is part of the "user interface",
(I want that completely unknown with Python people,
write these lines),
I think my "pinlist" is much easier.


> for k in self.pin.keys():
> self.__dict__[self.pin[k]['Name']] = self.pin[k]
thanks "rzed" ?,
that is exactly what I was looking for:
   self.__dict__[self.pinlist[k][0]] = self.pin[k]


cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: still struggling, howto use a list-element as a name ?

2007-01-06 Thread Stef Mientki
Jussi Salmela wrote:
> Bruno Desthuilliers kirjoitti:
>> Stef Mientki a écrit :
>>> In the example below, "pin" is an object with a number of properties.
>>> Now I want
>>> 1- an easy way to create objects that contains a number of these "pin"
>>> 2- an multiple way to access these "pin", i.e.
>>> device.pin[some_index]
>>> device.some_logical_name
>>> ad 1:
>>> a dictionary (as "pinlist" in the example) seems a very 
>>> convenient way (from a viewpoint of the device creator).
>>> As you can see in the "__init__" section this dictionary can easily 
>>> be transported to the pin-objects.
>>>
>>> ad 2:
>>> THAT's the problem: how do automate these lines "self.GND = self.pin[0]"
>>>
>>> I'm also in for other solutions.
>>
>> I'm afraid I don't understand your design (nor the domain FWIW). 
> ditto
>> 
>>
>> But the whole thing still looks awfully convulted and kludgy to me, 
>> and I suspect serious design flaws... Why don't you try and explain  
>> your real problem, instead of asking how to implement what you *think* 
>> is the solution ?
> ditto

thank you all guys.
I'm just doing some exercises in Python,
and therefor I'm trying to rewrite some programs
I've written in other languages into Python.

The first program I tried to convert was a MatLab program,
which could almost be written identical in Python.
Even with my little experience in Python,
I can tell you that it could have been written in Python
in a much better way, but I deliberately did not,
to show other people who are familiar with MatLab.

The second example I'm now exercising with,
is a simulator of (electrical) circuits,
which I build in Delphi
   http://oase.uci.kun.nl/~mientki/data_www/pic/jalss/jalss.html





> 
> Cheers,
> Jussi
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: still struggling, howto use a list-element as a name ? Sory, hit send button to early

2007-01-06 Thread Stef Mientki
Stef Mientki wrote:
> Jussi Salmela wrote:
>> Bruno Desthuilliers kirjoitti:
>>> Stef Mientki a écrit :
>>>> In the example below, "pin" is an object with a number of properties.
>>>> Now I want
>>>> 1- an easy way to create objects that contains a number of these "pin"
>>>> 2- an multiple way to access these "pin", i.e.
>>>> device.pin[some_index]
>>>> device.some_logical_name
>>>> ad 1:
>>>> a dictionary (as "pinlist" in the example) seems a very 
>>>> convenient way (from a viewpoint of the device creator).
>>>> As you can see in the "__init__" section this dictionary can easily 
>>>> be transported to the pin-objects.
>>>>
>>>> ad 2:
>>>> THAT's the problem: how do automate these lines "self.GND = 
>>>> self.pin[0]"
>>>>
>>>> I'm also in for other solutions.
>>>
>>> I'm afraid I don't understand your design (nor the domain FWIW). 
>> ditto
>>> 
>>>
>>> But the whole thing still looks awfully convulted and kludgy to me, 
>>> and I suspect serious design flaws... Why don't you try and explain  
>>> your real problem, instead of asking how to implement what you 
>>> *think* is the solution ?
>> ditto
> 
> thank you all guys.
> I'm just doing some exercises in Python,
> and therefor I'm trying to rewrite some programs
> I've written in other languages into Python.
> 
> The first program I tried to convert was a MatLab program,
> which could almost be written identical in Python.
> Even with my little experience in Python,
> I can tell you that it could have been written in Python
> in a much better way, but I deliberately did not,
> to show other people who are familiar with MatLab.
> 
> The second example I'm now exercising with,
> is a simulator of (electrical) circuits,
> which I build in Delphi
>   http://oase.uci.kun.nl/~mientki/data_www/pic/jalss/jalss.html
> 
> 
> Sorry, pressed send button too soon, so here it continuous:

In this exercise, I don't attempt to write "beautiful" Python code,
but the first thing is to write a simple "user-interface" for non-Pythians.
I understand that standardization about naming conventions is important,
but the purpose here is to serve the user, who has to write and 
unerstand this,
therefore IORLW is in the domain always written in capitals,
spaces here makes it lot easier to compare the different actions,
in this domain we're used to 2 spaces etc.

  def IORLW(S):  S.Accu_ZERO ( S.Accu | S.lit [S.PC] )
  def ANDLW(S):  S.Accu_ZERO ( S.Accu & S.lit [S.PC] )
  def XORLW(S):  S.Accu_ZERO ( S.Accu ^ S.lit [S.PC] )
  def SUBLW(S):  S.AddLW (~S.Accu + 1 )
  def ADDLW(S):  S.AddLW ( S,Accu )


So to come back to my last question:
this is what the user has to do:
define devices with pins, and the actions what todo when input signals 
changes.

class LED (device):
  pinlist ={
  # pinname type init-value   other-parameters
  1: ('Cathode',   _DIG_IN,   [],   _par2),
  2: ('Anode', _DIG_OUT,  [],   _par33)
  }

  Status = {True:('On'), False:('Off')}

  def execute (self):
old = self.On
self.On = (~self.Cathode.Value & self.Anode.Value) > 0
if self.On <> old : print self.Name, self.Status[self.On]

And now this looks quit  familiar,
although I miss the "with" statement of Delphi to make it even more 
readable ;-)
like this

class LED (device):
  pinlist ={
  # pinname type init-value   other-parameters
  1: ('Cathode',   _DIG_IN,   [],   _par2),
  2: ('Anode', _DIG_OUT,  [],   _par33)
  }

  Status = {True:('On'), False:('Off')}

  def execute (self):
with self:
  old = On
  On = ( ~Cathode.Value & Anode.Value) > 0
  if On <> old : print Name, Status[On]


thanks again for all your wonderfull help,
cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: subexpressions

2007-06-02 Thread Stef Mientki
> 
> 
> Check the two alternatives:
> 
> def f(x):
> y = x*x
> return sin(y) + cos(y)
> 
> 44 key presses, including tabs and newlines and a blank line after the
> function, but excluding counting the shift key separately.
> 
> lambda x: (lambda y: sin(y) + cos(y))(x*x)
> 
> 42 key presses.
> 
> Apart from the extremely minor issue of "namespace pollution", I think
> that speaks for itself.

and now I've only 60 lines on my screen,
so what about

   def f(x): y = x*x; return sin(y)+cos(y);

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: subexpressions

2007-06-02 Thread Stef Mientki
Steve Howell wrote:
>>def f(x): y = x*x; return sin(y)+cos(y);
>>
> 
> Although I know valid trigonometry is not the point of
> this exercise, I'm still trying to figure out why
> anybody would ever take the square of an angle. 
> What's the square root of pi/4 radians?
Maybe he meant
   sin(x)^2 + cos(x)^2
which is well known demodulation technique if you create two signals 90 degrees 
out of phase.

Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Who uses Python?

2007-06-05 Thread Stef Mientki
walterbyrd wrote:
> On Jun 5, 3:01 am, Maria R <[EMAIL PROTECTED]> wrote:
>> I tend to agree with some earlier poster that if you use Python you
>> are, in a sense, a programmer :o)
>>
> 
> Yes, in a sense. But, in another sense, that is sort of like saying
> that people who post on message boards are "writers."
> 
> I should have been more clear, when I posted "programmers" I meant
> "professional programmers" i.e. people who develop software
> applications for a living.

I've heard that 80% of what google is doing, is done in Python ;-)

I use Python as  a replacement for MatLab,
and intend to use it as replacement for Delphi, AutoIt, PHP, VB.
And I'ld love to use it as a replacement for micro controller programming.
The hardest to replace language is Delphi.
And all the work I perform with these languages is paid ;-)
The compagnies that only uses Python is growing.

cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


PATH or PYTHONPATH under Windows ???

2007-06-05 Thread Stef Mientki
hello,

after cleaning up a PC, Python can't find any libraries anymore.
But happily I've still one PC, where Python is running perfect.
Now I always read about the environment variable "PYTHONPATH".
But on neither PC there exists a "PYTHONPATH".

On the PC that works ok,
there is the standard "PATH" environment variable,
and indeed there are all the Python Library references.

Please enlighten me.

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Who uses Python?

2007-06-07 Thread Stef Mientki
Hendrik van Rooyen wrote:
> "Stef Mientki" <[EMAIL PROTECTED]> wrote:
> 
>> I use Python as  a replacement for MatLab,
>> and intend to use it as replacement for Delphi, AutoIt, PHP, VB.
>> And I'ld love to use it as a replacement for micro controller programming.
> 
> If you have a little sub - 64k micro this is not really practical.
> 
> What we have done is to define a limited virtual machine with
> a simple "assembler" language and used Python to write the
> "compiler" for it.
> 
> Then you have to write the interpreter for the virtual machine
> in the native micro's code - Either using C or assembler, and
> you are away from the hardware, into a useful layer of abstraction.
> 
> ... well sort of - in such a small thing, you are never really far from
> the hardware, as that is what its supposed to be controlling - but
> what it definitely buys you is that your apps written in your special
> language become portable between disparate processors like say
> an ARM at the upper end and an 8031/8051 at the lower...
> 
> Such "interpreters" are surprisingly little code, and they work
> well - faster than what one would expect. - often outperforming
> C code that does pass by value...
> 
> - Hendrik
> 
hello Hendrik,

I use even smaller micro controllers (PIC) and
as I'm just writing a functional simulator for it in Python,
(see 
http://oase.uci.kun.nl/~mientki/data_www/pic/jalcc/python/jal_simulation.html
and even a small movie: (600 kB) 
http://oase.uci.ru.nl/~mientki/download/jal_simulator1.htm

I would love to see your code,
not directly to use it (I want JAL),
but it might give me some good ideas.

cheers,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: howto obtain directory where current (running) py-file is placed?

2007-06-07 Thread Stef Mientki
Gerard Flanagan wrote:
> On Jun 7, 8:39 am, dmitrey <[EMAIL PROTECTED]> wrote:
>> Hi all,
>> I guess this question was asked many times before, but I don't know
>> keywords for web search.
>>
>> Thank you in advance, D.
> 
> import os
> 
> d1 = os.path.dirname(__file__)
here I get an error "__file__" is not defined ??
> d2 = os.path.dirname(os.__file__)
here I get a completely different path ??
> 
> print d1
> print d2

This seems to work (but I doubt it's always working !! )
print os.getcwd()

so what's the real answer ?

thanks,
Stef Mientki

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: wxPython / Dabo demo shell ?

2007-06-08 Thread Stef Mientki
Ed Leafe wrote:
> On Jun 8, 2007, at 10:01 AM, stef wrote:
> 
>> I'm interested in the overall demo setup,
>> really beautiful and powerful, just one thing missing (user configurable
>> tree).
>>
>> And if you can copy it,
>> I'm allowed to do so also ;-)
> 
> You can certainly copy and customize the DaboDemo code. There is a 
> folder named 'samples' that contains the the code for each individual 
> demo. If you look at a few of those, you should be able to figure out 
> how to create your own. The tree is created dynamically at startup, 
> based on the files in the 'samples' directory, and each of those files' 
> 'category' attribute.
> 
> If you have any further questions, it would probably be best to post 
> them to the dabo-users list. You can sign up for it at 
> http://leafe.com/mailman/listinfo/dabo-users

Thanks very much for the information,
I'll look in that in more detail in the near future.

cheers,
Stef
> 
> -- Ed Leafe
> -- http://leafe.com
> -- http://dabodev.com
> 
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Select one of 2 functions with the same name ?

2007-06-10 Thread Stef Mientki
hello,

For a simulation at different levels,
I need different functions with the same name.
Is that possible ?

I can realize it with a simple switch within each function,
but that makes the code much less readable:

def Some_Function():
   if simulation_level == 1:
 ... do things in a way
   elif simulation_level == 2:
 ... do things in another way
   elif simulation_level == 3:
 ... do things in yet another way


thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Select one of 2 functions with the same name ?

2007-06-10 Thread Stef Mientki
thanks Francesco and "7stud",

The solution with objects is too difficult,
because I want to stay very close to the orginal language,
( so the users can understand the Python code,
   and the automatic translation becomes as simple as possible).

But after some tests, it seems to be quit simple:


   simulation_level = 0

   def f1():
 print 'f1'

   if simulation_level == 2:
 def f1():
   print 'f2'

   f1()



cheers,
Stef Mientki

Francesco Guerrieri wrote:
> If the functions are
> f1, f2, f3  you could go this way:
> 
> def SimulationRun():
>if simulation_level = 1: SimulationFunction = f1
>else if simulation_level = 2: SimulationFunction = f2
>else 
> 
> 
> and in the rest of the code you can refer to SimulationFunction
> instead of explicitly calling f1, f2 or f3.
> 
> I'm sure that there are many smarter methods :-)
> 
> 
> 
> On 6/10/07, Stef Mientki <[EMAIL PROTECTED]> wrote:
>> hello,
>>
>> For a simulation at different levels,
>> I need different functions with the same name.
>> Is that possible ?
>>
>> I can realize it with a simple switch within each function,
>> but that makes the code much less readable:
>>
>> def Some_Function():
>>if simulation_level == 1:
>>  ... do things in a way
>>elif simulation_level == 2:
>>  ... do things in another way
>>elif simulation_level == 3:
>>  ... do things in yet another way
>>
>>
>> thanks,
>> Stef Mientki
>> -- 
>> http://mail.python.org/mailman/listinfo/python-list
>>
> 
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Select one of 2 functions with the same name ?

2007-06-10 Thread Stef Mientki
7stud wrote:
> On Jun 10, 2:03 pm, Stef Mientki <[EMAIL PROTECTED]>
> wrote:
>> thanks Francesco and "7stud",
>>
>> The solution with objects is too difficult,
>> because I want to stay very close to the orginal language,
>>
> 
> Why would you want to duplicate poorly written code?
> 
I didn't know that a program written without OOP's is "poorly written" ;-)

The orginal language is thé best language available for that particular micro.

cheers,
Stef
-- 
http://mail.python.org/mailman/listinfo/python-list


  1   2   3   4   5   6   7   8   >