Re: Converting functions

2011-01-24 Thread iu2
On Jan 24, 9:51 am, Peter Otten <__pete...@web.de> wrote: > iu2 wrote: > > I'm trying to convert functions - pass a few functions to a converting > > function, which change their behaviour and return the changed > > functions: > > > >>> def cfunc

Converting functions

2011-01-23 Thread iu2
Hi all, I'm trying to convert functions - pass a few functions to a converting function, which change their behaviour and return the changed functions: >>> def cfuncs(*funcs): n = [] for f in funcs: def ff(*args, **key): print 'Start!', f.fu

xmlrpc and processes

2010-08-08 Thread iu2
Hi, I have a SimpleXMLRPCServer running on one PC. I need several ServerProxy-s talking to it, each one running on a different PC. That is, I run on each PC a client application, that talks to the one server using xml-rpc. Is the xml-rpc designed to work like this? If not, is there something I ca

Re: import from a string

2009-11-03 Thread iu2
On Nov 4, 3:10 am, "Gabriel Genellina" wrote: > En Tue, 03 Nov 2009 17:36:08 -0300, iu2 escribió: > > > > > > > On Nov 3, 7:49 pm, Matt McCredie wrote: > >> iu2 elbit.co.il> writes: > > >> > Having a file called funcs.py, I would li

Re: import from a string

2009-11-03 Thread iu2
On Nov 3, 7:49 pm, Matt McCredie wrote: > iu2 elbit.co.il> writes: > > > > > Hi, > > > Having a file called funcs.py, I would like to read it into a string, > > and then import from that string. > > That is instead of importing from the fie system, I wo

Re: comparing alternatives to py2exe

2009-11-03 Thread iu2
On Nov 3, 5:58 pm, Jonathan Hartley wrote: > Hi, > > Recently I put together this incomplete comparison chart in an attempt > to choose between the different alternatives to py2exe: > > http://spreadsheets.google.com/pub?key=tZ42hjaRunvkObFq0bKxVdg&output... > > Columns represent methods of deploy

import from a string

2009-11-03 Thread iu2
Hi, Having a file called funcs.py, I would like to read it into a string, and then import from that string. That is instead of importing from the fie system, I wonder if it's possible to eval the text in the string and treat it as a module. For example with file('funcs.py') as f: txt = r.read()

Re: Commutative object in emulating numbers

2009-09-13 Thread iu2
On Sep 14, 8:16 am, Chris Rebert wrote: > On Sun, Sep 13, 2009 at 9:52 PM, iu2 wrote: > > Hi, > > > I reached the chapter "Emulating numeric types" in the python > > documentation and I tried this: > > >>>> class A: > >        def __m

Re: Commutative object in emulating numbers

2009-09-13 Thread iu2
On Sep 14, 7:52 am, iu2 wrote: > Hi, > > I reached the chapter "Emulating numeric types" in the python > documentation and I tried this: > > >>> class A: > >         def __mul__(self, a): >                 return 'A' * a > > Now, th

Commutative object in emulating numbers

2009-09-13 Thread iu2
Hi, I reached the chapter "Emulating numeric types" in the python documentation and I tried this: >>> class A: def __mul__(self, a): return 'A' * a Now, this works as expected: >>> a = A() >>> a * 3 'AAA' But this doesn't (also as expected): >>> 3 * a Traceback (most re

Re: Dictionary from a list

2009-08-20 Thread iu2
On Aug 20, 9:10 am, Peter Otten <__pete...@web.de> wrote: > Jan Kaliszewski wrote: > > 20-08-2009 o 02:05:57 Jan Kaliszewski wrote: > > >> Or probably better: > > >>      from itertools import islice, izip > >>      dict(izip(islice(li, 0, None, 2), islice(li, 1, None, 2))) > > > Or similarly, per

Re: Dictionary from a list

2009-08-19 Thread iu2
On Aug 19, 11:39 pm, "Diez B. Roggisch" wrote: > iu2 schrieb: > > > Hi all, > > > I need to create a dictionary out of a list. > > > Given the list [1, 2, 3, 4, 5, 6] > > > I need the dictionary: {1:2, 3:4, 5:6} > > dict(zip(l[::2], l[1:

Dictionary from a list

2009-08-19 Thread iu2
Hi all, I need to create a dictionary out of a list. Given the list [1, 2, 3, 4, 5, 6] I need the dictionary: {1:2, 3:4, 5:6} I'll appreciate your help Thanks iu2 -- http://mail.python.org/mailman/listinfo/python-list

Re: multiprocessing and __main__

2009-07-26 Thread iu2
p = Process(target=my_process, args=()) >     p.start() > >     print 'Process started' > > the problem was solved. > So my question is what actually happens when I call p.start()? Is the > entry file reloaded under a different module name? > > Thanks > iu2 Ok, I found it, it is nicely documented, I missed it before. Case closed. -- http://mail.python.org/mailman/listinfo/python-list

wxPython: Plaing widgets in status bar

2009-07-01 Thread iu2
Hi all, I try to placs widgets (button, static text labels) in a status bar, wxPython. >From the examples I could place them using exact positioning by the status bar methof GetFieldRect. In this case I need to add an EVT_SIZER handler to keep the widgets in their propotional places within the sta

Re: wxPython fast and slow

2009-03-09 Thread iu2
On Mar 9, 4:18 am, David Bolen wrote: > iu2 writes: > > Then even a time.sleep() or plain loop isn't sufficient since each may > have additional latencies depending on load.  You will probably need > to query a system clock of some type to verify when your interval has >

Re: wxPython fast and slow

2009-03-08 Thread iu2
On Mar 9, 12:44 am, Scott David Daniels wrote: > iu2 wrote: > > Here is the timer version. It works even more slowly, even with > > PyScripter active: ... > > > I actually tried this one first. Due to the slow speed I changed to > > looping inside the event. > >

Re: wxPython fast and slow

2009-03-08 Thread iu2
On Mar 8, 1:42 pm, Carl Banks wrote: > On Mar 8, 1:52 am, iu2 wrote: > > > > > On Mar 6, 6:52 pm, Mike Driscoll wrote: > > > > ... > > > Can you post a sample application so we can try to figure out what's > > > wrong? You might also cross-p

Re: wxPython fast and slow

2009-03-08 Thread iu2
cripter. When PyScripter is closed, the application runs much less quickly. I experienced this on two PC-s. Maybe this behavior is not even related to wxPython but to the sleep command. I don't know... Thanks iu2 -- http://mail.python.org/mailman/listinfo/python-list

wxPython fast and slow

2009-03-06 Thread iu2
(Windows) for writing the application. While PyScripter is active, the panels move quickly. But when I exit PyScripter and execute the script from the explorer or the command line, the panels move very slowly. Do you have any idea of what is going wrong? Thank you very much iu2 -- http

Re: Pass by reference

2008-12-31 Thread iu2
On Dec 31, 1:48 pm, "Chris Rebert" wrote: ... > > Not really, or at the very least it'll be kludgey. Python uses > call-by-object (http://effbot.org/zone/call-by-object.htm), not > call-by-value or call-by-reference. > > Could you explain why you have to set so many variables to the same > value (

Pass by reference

2008-12-31 Thread iu2
Hi, Is it possible somehow to change a varible by passing it to a function? I tried this: def change_var(dict0, varname, val): dict0[varname] = val def test(): a = 100 change_var(locals(), 'a', 3) print a But test() didn't work, the value a remains 100. I have several variables init

os.system dual behaviour

2008-09-03 Thread iu2
Hi guys I do os.system('ls &> e') On one linux machine it emits ls output to the file e as expected. On another linux machine it emits ls to the standard output, and nothing to e! Both machines run Fedora linux. The command "ls &> e" entered at the shell (no python) behaves ok on both machines.

What Python looks like

2008-08-04 Thread iu2
Hi, This is a little bit strange post, but I'm curious... I learned Python from its tutorial step by step, and practicing writing small scripts. I haven't seen a Python program before knowing Python. I'm curious, what did Python code look like to those of you who have seen a bunch of Python code

Re: block/lambda

2008-07-29 Thread iu2
On Jul 29, 9:36 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > iu2 <[EMAIL PROTECTED]> wrote: > > Is it possible to grant Python another syntactic mark, similar to > > triple quotes, that will actually make the enclosed code a compiled > > code, or an anonymous func

Re: seemingly simple list indexing problem

2008-07-28 Thread iu2
On Jul 29, 2:26 am, John Krukoff <[EMAIL PROTECTED]> wrote: > On Mon, 2008-07-28 at 16:00 -0700, iu2 wrote: > > On Jul 29, 12:10 am, John Krukoff <[EMAIL PROTECTED]> wrote: > > > On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: > > > > My progra

Re: seemingly simple list indexing problem

2008-07-28 Thread iu2
On Jul 29, 3:59 am, John Machin <[EMAIL PROTECTED]> wrote: > On Jul 29, 8:10 am, John Krukoff <[EMAIL PROTECTED]> wrote: > > > > > > > On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: > > > My programming skills are pretty rusty and I'm just learning Python so > > > this problem is giving me t

Re: seemingly simple list indexing problem

2008-07-28 Thread iu2
On Jul 29, 12:10 am, John Krukoff <[EMAIL PROTECTED]> wrote: > On Mon, 2008-07-28 at 16:24 -0500, Ervan Ensis wrote: > > My programming skills are pretty rusty and I'm just learning Python so > > this problem is giving me trouble. > > > I have a list like [108, 58, 68].  I want to return the sorted

Re: block/lambda

2008-07-28 Thread iu2
On Jul 28, 10:06 pm, iu2 <[EMAIL PROTECTED]> wrote: > Hi, > > Playing with imitating lambdas and ruby blocks in Python, I came up > with a very simple construct, for example: > > import compiler > > def dotimes(i, code): >     for i in range(i): >         exe

block/lambda

2008-07-28 Thread iu2
Hi, Playing with imitating lambdas and ruby blocks in Python, I came up with a very simple construct, for example: import compiler def dotimes(i, code): for i in range(i): exec code dotimes(5, ''' for j in range(i): print j, print ''', '', 'exec') This will print 0 0 1 0 1

Re: bad recursion, still works

2008-07-16 Thread iu2
On Jul 16, 2:21 am, Michael Torrie <[EMAIL PROTECTED]> wrote: > iu2 wrote: > > I still don't understand: In each recursive call to flatten, acc > > should be bound to a new [], shouldn't it? Why does the binding happen > > only on the first call to flatten?

Re: bad recursion, still works

2008-07-15 Thread iu2
On Jul 15, 9:30 pm, [EMAIL PROTECTED] wrote: > On Jul 15, 2:59 pm, iu2 <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > I wrote this wrong recursive function that flattens a list: > > > def flatten(lst, acc=[]): > >     #print 'a

bad recursion, still works

2008-07-15 Thread iu2
Hi, I wrote this wrong recursive function that flattens a list: def flatten(lst, acc=[]): #print 'acc =', acc, 'lst =', lst if type(lst) != list: acc.append(lst) else: for item in lst: flatten(item) return acc a = [1, 2, [3, 4, 5], [6, [7, 8, [9, 10],

Re: License of Python

2008-03-31 Thread iu2
On 31 מרץ, 02:32, Bjoern Schliessmann wrote: > iu2 wrote: > > Due to Competitors... I don't want to expost the language I use > > A serious competitor that wants to find out _will_ find out, no > matter what you try. > > Regards, > > Björn > > -- > BOFH

Re: License of Python

2008-03-30 Thread iu2
On 30 מרץ, 15:55, Lie <[EMAIL PROTECTED]> wrote: > On Mar 30, 6:42 pm, iu2 <[EMAIL PROTECTED]> wrote: > > > Hi guys, > > > I'd like to use Python in a commercial application. In fact I would > > like to write the application entirely in Python. > >

License of Python

2008-03-30 Thread iu2
understand is a must do, reveals that the appliation is based on Python. I'll appreciate your advices about this Thanks iu2 -- http://mail.python.org/mailman/listinfo/python-list

Tkinter right-to-left windows

2008-03-17 Thread iu2
Hi, I use tix NoteBook, and I need the tabs arranged right to left. Is it possible? Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: A question about osyco

2008-01-28 Thread iu2
On Jan 29, 1:48 am, [EMAIL PROTECTED] wrote: > Marc 'BlackJack' Rintsch: > > > Try calling the iterative one twice and measure the time of the second > > call.  IIRC psyco needs at least one call to analyze the function, so the > > first call is not speed up. > > That's how Java HotSpot works, but

A question about osyco

2008-01-28 Thread iu2
Hi guys, I wrote two version of a fib functions, a recursive one and an iterative one. Psyco improved a lot the recursive function time, but didn't affect at all the iterative function. Why? Here is the code: import time, psyco def mytime(code): t = time.time() res = eval(code) del

Re: Hebrew in idle ans eclipse (Windows)

2008-01-23 Thread iu2
On Jan 23, 11:17 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > If you are claimaing that the program > > Apparently, they do the OEMtoANSI conversion when you run a console > application (i.e. python.exe), whereas they don't convert when running > a GUI application (pythonw.exe). > > I'm not

Re: Hebrew in idle ans eclipse (Windows)

2008-01-22 Thread iu2
#x27;t know how IDLE guessed cp856, but it must have done it. (perhaps because it uses tcl, and maybe tcl guesses the encoding automatically?) thanks iu2 -- http://mail.python.org/mailman/listinfo/python-list

Re: Hebrew in idle ans eclipse (Windows)

2008-01-20 Thread iu2
On Jan 17, 10:35 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > import pymssql > > > con = > > pymssql.connect(host='192.168.13.122',user='sa',password='',database='tempd­b') > > cur = con.cursor() > > cur.execute('select firstname, lastname from [users]') > > lines = cur.fetchall() > > > pri

Re: Hebrew in idle ans eclipse (Windows)

2008-01-17 Thread iu2
On Jan 17, 6:59 am, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > What do I need to do run my app like IDLE does? > > Can you please show the fragment of your program that prints > these strings? > > Regards, > Martin Hi, I use pymssql to get the data from a database, just like this (this is fr

Hebrew in idle ans eclipse (Windows)

2008-01-16 Thread iu2
laced with '8's: \x88\x89\x85 The IDLE way is the way I need, since using Hebrew words in the program text itself, as keys in a dict, for example, yield similar strings (with 'e's). When running from eclipse I get KeyError for this dict.. What do I need to do run my app l

Re: print >> to a derived file

2008-01-15 Thread iu2
On Jan 15, 12:44 pm, "Ben Fisher" <[EMAIL PROTECTED]> wrote: > This might have something to do with the class being derived from file. > > I've written it so that it doesn't derive from file, and it works. > > class File_and_console(): >         def __init__(self, *args): >                 self.fil

print >> to a derived file

2008-01-15 Thread iu2
o') hello >>> print >>f, 'world' >>> the 'write' method works, but 'print >>' doesn't, it writes only to the file. It doesn't actually call File_and_console.write Why? How can I fix it? Thanks iu2 -- http://mail.python.org/mailman/listinfo/python-list

import from question

2008-01-14 Thread iu2
mport a1 import a2 a2.init() print a1.the_number, type(a1.the_number) gives: 100 Why doesn't it work in the first version of a3.py? Thanks, iu2 -- http://mail.python.org/mailman/listinfo/python-list

Re: using super

2008-01-02 Thread iu2
it), perl, and Lisp (less) but Python is the one that I enjoy the most. That's why I feel free to say what I think is missing (and if you don't like it, I'll try not to do it, I think Python's developers are doing a great work). I missed new style classes though... Now I know ho

Re: using super

2008-01-01 Thread iu2
On Jan 1, 12:32 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > > import read_my_mind_and_do_what_I_want > > first. (Module expected in Python 9.7, due out in 2058.) That's because it seems to you like some esoteric feature. To me it seems natural with OO. > "Special cases ar

Re: using super

2008-01-01 Thread iu2
On Jan 1, 9:59 am, Michele Simionato <[EMAIL PROTECTED]> wrote: > No PEP, this would never pass. There would be no way > to stop a method from calling its parent: you would > lose control of your classes, so I think this is a > bad idea. Not all classes, only classes the programmer chooses to hav

Re: using super

2007-12-31 Thread iu2
ined class System_A(Interface_system): def get_name(self): return 'System_A' Now the programmer both overrides get_name, and calls get_name directly in the application. And no one has to remember to call the parent's get_name method. It's done automatically. (A PEP maybe? I sense you don't really like it.. ;-) What do you think? Good? Too implicit? iu2 -- http://mail.python.org/mailman/listinfo/python-list

using super

2007-12-31 Thread iu2
wrong because I don't give the object instance to super (I don't have it!) and I also get the error TypeError: super() argument 1 must be type, not classobj Can you please help me with this? Thanks iu2 -- http://mail.python.org/mailman/listinfo/python-list

Re: Failure to connect in SimpleXMLRPCServer/xmlrpclib

2007-10-22 Thread iu2
On Oct 22, 12:47 pm, "J. Cliff Dyer" <[EMAIL PROTECTED]> wrote: > iu2 wrote: > > Hi all, > > > I've copied the example of RPC usage from the Python's doc. > > When the client and server were on the same PC ("localhost") (I use > > W

Re: Failure to connect in SimpleXMLRPCServer/xmlrpclib

2007-10-22 Thread iu2
On Oct 22, 10:21 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > iu2 wrote: > > > Hi all, > > > I've copied the example of RPC usage from the Python's doc. > > When the client and server were on the same PC ("localhost") (I

Failure to connect in SimpleXMLRPCServer/xmlrpclib

2007-10-21 Thread iu2
me. Trying to remove the double-backslash from the PC's name raised the error: error: (10061, 'Connection refused') I'll appreciate your help on this. Thanks iu2 -- http://mail.python.org/mailman/listinfo/python-list