Wednesday, August 3, 2011

The Python documentation makes no sense to me

Here's how a Python class function (method?) prototype is presented:

class datetime.datetime(year, month, day[, hour[, minute[, second[, microsecond[, tzinfo]]]]])

I read this as tzinfo is an argument of microsecond which is an argument of second which is an argument of minute which is an argument of hour which is an argument of day. But this isn't the case. It's just a list of arguments that can be passed separated by a comma. So... why the brackets?!

Furthermore in THIS class function the non-bracketed variables are stated as required, and the bracketed ones are optional. So I say to myself "Ah, that's how they define optional and non-optional arguments. However, here:

class datetime.time(hour[, minute[, second[, microsecond[, tzinfo]]]])

the documentation says that all arguments are optional, which blows away that theory of operation.

So yea, the biggest hindrance to getting to the next level in Python is that I can't read the documentation.

No comments:

Post a Comment