H
Helmut Jarausch
Hi,
sorry for this probably very simple question.
How can I build a parameter list for 'print' ?
Background:
I'd like to write a function like
def myprint(Msg,*Args) :
print (Msg,)+Args
when called as
myprint(MyMsg,x)
it should be equivalent to
print MyMsg,x
but, e.g.
class ABC :
def __str__(self) :
return "ABC-class"
x=ABC()
myprint('this is',x)
gives
('this is', <__main__.ABC instance at 0x4084fc8c>)
instead of
this is ABC-class
What am I missing (what sort of thing is the parameter list of print) ?
Many thanks for a hint,
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
sorry for this probably very simple question.
How can I build a parameter list for 'print' ?
Background:
I'd like to write a function like
def myprint(Msg,*Args) :
print (Msg,)+Args
when called as
myprint(MyMsg,x)
it should be equivalent to
print MyMsg,x
but, e.g.
class ABC :
def __str__(self) :
return "ABC-class"
x=ABC()
myprint('this is',x)
gives
('this is', <__main__.ABC instance at 0x4084fc8c>)
instead of
this is ABC-class
What am I missing (what sort of thing is the parameter list of print) ?
Many thanks for a hint,
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany