Modify code with AST

2013-06-12 Thread Ronny Mandal
all method bodies of class FooBar, not only Foo. When ran through a debugger, it iterates both methods. What I really wanted to do, was to replace only one method (Foo) and leave the other untouched. I hope this was understandable conveyed. Answers are highly appreciated. Regards, Ronny

Re: Modify code with AST

2013-06-12 Thread Ronny Mandal
(the same person who wrote ast) and it uses ast to generate python code from the AST. Thanks! Regards, Ronny Mandal import ast class FindAndTransform(ast.NodeTransformer): def visit_FunctionDef(self, node): if node.name == 'Foo': node = ast.parse

Sorting of list containing tuples

2006-05-18 Thread Ronny Mandal
Hi! Assume we have a list l, containing tuples t1,t2... i.e. l = [(2,3),(3,2),(6,5)] And now I want to sort l reverse by the second element in the tuple, i.e the result should ideally be: l = [(6,5),(2,3),(3,2)] Any ideas of how to accomplish this? Thanks, Ronny Mandal -- http

Re: Sorting of list containing tuples

2006-05-18 Thread Ronny Mandal
Uhm, thanks. (I've used lambda-sort earlier, but quite forgot..) :) On 18 May 2006 12:38:55 -0700, Paul Rubin http://[EMAIL PROTECTED] wrote: Ronny Mandal [EMAIL PROTECTED] writes: And now I want to sort l reverse by the second element in the tuple, i.e the result should ideally be: l

OOP and Tkinter

2006-05-15 Thread Ronny Mandal
no attribute '_listbox_1' i.e., it cannot find the listbox! Strange, both files is in the same folder. What is wrong here? Thanks, Ronny Mandal -- http://mail.python.org/mailman/listinfo/python-list

Re: OOP and Tkinter

2006-05-15 Thread Ronny Mandal
Thanks, but the problem was my undentation, after making one indent, it worked as expected. :) -Ronny M -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling python functions from C

2006-05-09 Thread Ronny Mandal
On 9 May 2006 10:05:48 -0700, [EMAIL PROTECTED] wrote: I am a newbie to Python. I want to call python functions from C. I looked for examples but I couldn't get any simple one. Lets say my python code is : def add(a,b) return (a+b) I want to call add from C. Could anybody please help me?

PyX custom x-labels

2006-05-08 Thread Ronny Mandal
Hello. I need to draw a graph, with letters on the x-axis and a numeric value on the y-axis, e.g.. a = 3, b = 6 etc. Suggestions? Thanks, Ronny Mandal -- http://mail.python.org/mailman/listinfo/python-list

Properties

2006-03-27 Thread Ronny Mandal
Is there a way of checking whether the call to a set-function is called from within the class, e.g. the __init__() contra object.set()? Thanks. Ronny Mandal -- http://mail.python.org/mailman/listinfo/python-list

Vectorization and Numeric (Newbie)

2006-02-28 Thread Ronny Mandal
Assume you have a mathematical function, e.g. f(x) = x + 4 To calculate all the values from 1 to n, a loop is one alternative. But to make this function work with vectors instead i.e f(x_vector) = result_vector, how should the function then be implemented? Thanks RM -- Support bacteria -

Difference: __iadd__ and __add__

2006-02-17 Thread Ronny Mandal
Can someone please explain or point me to articles regarding these two methods? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Class subscripting

2006-02-17 Thread Ronny Mandal
to 4.2 Thanks and regards, Ronny Mandal -- http://mail.python.org/mailman/listinfo/python-list