how to create a def that has the behaviour like a built-in keyword...

BA asdffdsa at bellatlantic.net
Fri Oct 5 14:02:10 EDT 2001


hilo2u,
thanks for reading this,

i would like to create a function that would behave like the print
statement.
for example,
if i were to exectute
    print 10
then
    i would get a result.

if i write my own def called printit,
for example,
def printit(Num):
    print Num

to call my function it using parenthesis like so,
    printit(10), would be legal
but the following seems to be illegal
    printit 10
why, oh why, is it illegal and is there a trick to make it legal.
can i call a function without any parenthesis( ).

thanks,
dave






More information about the Python-list mailing list