David (dblume) wrote,
David
dblume

Note To Self: Python's Apply

Self, discover why args has to be manipulated the way it does.
def fprintf(file,fmt, *args):
file.write(fmt % args)

def printf(fmt, *args):
apply(fprintf, (sys.stdout,fmt)+args)
Tags: programming, python
Subscribe
  • Post a new comment

    Error

    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments