I am trying to learn the details behind some basic functions in Python (kinda new) so any help would be greatly appreciated. Let's say I have the following code:
Code:
def SomeConversion(file):
_content = None
with open(file, 'rb') as inputVar:
I have a few questions regarding this code.
1) Should content be called _content, __content or just content? Does this change depending on the context its being used in. For instance, if I only ever use the variable inside of the SomeConversions method.
2)Should None be changed to "" or does it matter? Are there other options and what is the difference between the different options?
3) Is the file being named as "file" being saved into a variable called inputVar? If so, is Python just assuming the type of inputVar? If so how does it know what to assume?
4) Does the keyword 'as' always need to be used when using the keyword 'with' or are these two keywords actually completely separates entities?
I will continue investigating on my own and if I end up figuring these answers out I will come back and edit this post. I am new to Python btw, did I say that already? XD