Peter Faulks, 27.04.2012 22:31:
On 27/04/2012 6:55 PM, Stefan Behnel wrote:
Peter Faulks, 27.04.2012 10:36:
On 27/04/2012 5:15 PM, Stefan Behnel wrote:
Peter Faulks, 26.04.2012 19:57:
I want to extend an embedded interpreter so that calls to print() are
automagically sent to a C++ gui
Peter Faulks, 26.04.2012 21:28:
All you have to do is assign to print. Sounds great! Can some kind soul
hit me with a clue stick? Were do I look in the API?
Here's the (Py3) Cython code for it:
print = my_print_function
Stefan
--
http://mail.python.org/mailman/listinfo/python-list
Peter Faulks, 26.04.2012 19:57:
I want to extend an embedded interpreter so that calls to print() are
automagically sent to a C++ gui (windows exe) via a callback function in
the DLL.
Then I'll be able to do this:
test.py
import printoverload
printoverload.set_stdout()
On 27/04/2012 5:15 PM, Stefan Behnel wrote:
Peter Faulks, 26.04.2012 19:57:
I want to extend an embedded interpreter so that calls to print() are
automagically sent to a C++ gui (windows exe) via a callback function in
the DLL.
Then I'll be able to do this:
test.py
import
Peter Faulks, 27.04.2012 10:36:
On 27/04/2012 5:15 PM, Stefan Behnel wrote:
Peter Faulks, 26.04.2012 19:57:
I want to extend an embedded interpreter so that calls to print() are
automagically sent to a C++ gui (windows exe) via a callback function in
the DLL.
Then I'll be able to do this:
On 4/27/2012 4:55 AM, Stefan Behnel wrote:
I want the script
itself to update a window in the host application (via the extension) every
time the script calls print().
Then replace sys.stdout (and maybe also sys.stderr) by another object that
does what you want whenever its write() method is
On 27/04/2012 6:55 PM, Stefan Behnel wrote:
Peter Faulks, 27.04.2012 10:36:
On 27/04/2012 5:15 PM, Stefan Behnel wrote:
Peter Faulks, 26.04.2012 19:57:
I want to extend an embedded interpreter so that calls to print() are
automagically sent to a C++ gui (windows exe) via a callback function
G'day,
I want to extend an embedded interpreter so that calls to print() are
automagically sent to a C++ gui (windows exe) via a callback function in
the DLL.
Then I'll be able to do this:
test.py
import printoverload
printoverload.set_stdout()
printoverload.set_stderr()
On Fri, Apr 27, 2012 at 3:57 AM, Peter Faulks faul...@iinet.net.au wrote:
I want to extend an embedded interpreter so that calls to print() are
automagically sent to a C++ gui (windows exe) via a callback function in the
DLL.
Then I'll be able to do this:
test.py
import
Cheers,
Yes was aware this would (might) be possible in 3.x only.
All you have to do is assign to print. Sounds great! Can some kind
soul hit me with a clue stick? Were do I look in the API?
On 27/04/2012 4:26 AM, Chris Angelico wrote:
On Fri, Apr 27, 2012 at 3:57 AM, Peter
On Fri, Apr 27, 2012 at 5:28 AM, Peter Faulks faul...@iinet.net.au wrote:
Cheers,
Yes was aware this would (might) be possible in 3.x only.
All you have to do is assign to print. Sounds great! Can some kind soul
hit me with a clue stick? Were do I look in the API?
(We prefer to avoid
On Aug 25, 5:18 pm, Ross Williamson rosswilliamson@gmail.com
wrote:
Hi All
Is there anyway in a class to overload the print function?
class foo_class():
pass
cc = foo_class()
print cc
Gives:
__main__.foo_class instance at
Can I do something like:
class
variables in a class just by
asking to print it
In Python3 you *can* overload print(), but still, you better define
__str__() on your class to return a string, representing what ever
you want:
In [11]: class Foo(object):
: def __str__(self):
: return foo
Hi All
Is there anyway in a class to overload the print function?
class foo_class():
pass
cc = foo_class()
print cc
Gives:
__main__.foo_class instance at
Can I do something like:
class foo_class():
def __print__(self):
print hello
cc = foo_class()
print cc
On 25 Aug, 22:18, Ross Williamson rosswilliamson@gmail.com
wrote:
Is there anyway in a class to overload the print function?
class foo_class():
pass
cc = foo_class()
print cc
Gives:
__main__.foo_class instance at
Can I do something like:
class foo_class():
On Wed, Aug 25, 2010 at 2:18 PM, Ross Williamson
rosswilliamson@gmail.com wrote:
Hi All
Is there anyway in a class to overload the print function?
class foo_class():
pass
cc = foo_class()
print cc
Gives:
__main__.foo_class instance at
Can I do something like:
class
On Wed, 25 Aug 2010 16:18:15 -0500
Ross Williamson rosswilliamson@gmail.com wrote:
Hi All
Is there anyway in a class to overload the print function?
Your terminology threw me off for a moment. You don't want to override
print. You want to override the default representation of an
* overload print(), but still, you better define
__str__() on your class to return a string, representing what ever
you want:
In [11]: class Foo(object):
: def __str__(self):
: return foo
:
:
In [12]: f = Foo()
In [13]: print f
foo
--
http://mail.python.org
On Wed, Aug 25, 2010 at 2:23 PM, Glenn Hutchings zond...@gmail.com wrote:
On 25 Aug, 22:18, Ross Williamson rosswilliamson@gmail.com
wrote:
Is there anyway in a class to overload the print function?
class foo_class():
pass
cc = foo_class()
print cc
Gives:
19 matches
Mail list logo