I\'m new to Python, with a background in statically typed languages including lots and lots of Java.
I decided on PyDev in eclipse as an IDE after checking features/
You might want to take a look at WingIDE. It autocompletes your datafile correctly.
If it is unable to infer the type, you can use an assert like
assert isinstance(datafile, file)
to help the autocompleter out