Default value for file path in function gives SyntaxError. Work around?

Posted by LtPinback on Stack Overflow See other posts from Stack Overflow or by LtPinback
Published on 2010-03-18T11:52:38Z Indexed on 2010/03/18 12:01 UTC
Read the original article Hit count: 342

for this,

import os.path

def f(data_file_path=os.path.join(os.getcwd(),'temp'),type):
    ...
    return data

I get this,

SyntaxError: non-default argument follows default argument

Is there a way to make this work or do I have to define a variable such as,

rawdata_path = os.path.join(os.getcwd(),'temp')

and then plug that into the function?

© Stack Overflow or respective owner

Related posts about python

Related posts about function