[C++-sig] "print" member functions.
Ralf W. Grosse-Kunstleve
rwgk at yahoo.com
Wed Feb 25 18:33:15 CET 2004
I don't know how Pyste works so this me be silly, but consider this simple
example:
class test:
def print_me(self):
print "Hi"
setattr(test, "print", test.print_me)
getattr(test(), "print")()
This suggests:
rename(getattr(test,"print"), "print_me")
Ralf
--- Pierre Barbier de Reuille <pierre.barbier at cirad.fr> wrote:
> "print" being a reserved work, you cannot use it at all in python !!!
> As pyste is in python, you cannot use any object named "print" ...
> you'll have to change the C++ code or write a wrapper in C++
>
> On Wed, 2004-02-25 at 14:55, Hanz Meizer wrote:
> > Hi,
> >
> > I have classes that contain print member functions. If I try to call
> > those from python, I get:
> >
> > print a.print()
> > ^
> > SyntaxError: invalid syntax
> >
> > I can't rename them, either:
> > ------------ test.pyste ------------
> > rename(test.print, "print_me")
> > ------------------------------------
> >
> > gives:
> > ------------------------------------
> > execfile(interface, context)
> > File "test.pyste", line 15
> > rename(test.print, "print_me")
> > ^
> > SyntaxError: invalid syntax
> > make: *** [test.cpp] Error 1
> > ------------------------------------
> >
> > How can I get this print function wrapped and callable from python? (it
> > returns void).
__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools
More information about the Cplusplus-sig
mailing list