PyWarts: time, datetime, and calendar modules
rantingrickjohnson at gmail.com
Sat Jan 14 14:23:29 EST 2012
On Jan 14, 1:01 pm, Devin Jeanpierre <jeanpierr... at gmail.com> wrote:
> What's "horrendous" about the datetime module interface? Your listed
> complaints (OOP etc.) don't seem to have anything to do with it.
Well my immediate complaint about date-time is actually a problem with
the syntactic quandaries of the Python language itself.
I find myself navigating an objects API using the dir function or the
autocomplete function of my IDE. Now. One the continuing issues of the
Python's syntax (and the syntax of many other languages) is the fact
that a reader has no idea which names belonging to an object are
methods and which names are instance/class variables. The status quo
has been to use verbs for methods but you cannot always find the
perfect verb, or even sometimes, anyverb! Consider this:
>>> import datetime, time, calendar
>>> d = datetime.date.today()
<built-in method weekday of datetime.date object at 0x026A5A58>
THAT PISSES ME OFF!!! >:( We should never be forced to guess if a name
is a callable or a variable!
So how do we solve this dilemma you ask??? Well, we need to "mark"
method OR variable names (OR both!) with syntactic markers so there
will be NO confusion.
self. at instanceveriable
I dunno if these are the best markers but the "marker" must be
succinct! Of course if we choose to use the "@" and "@@" then we might
as well drop the redundant "self" and allow the compiler to parse out
More information about the Python-list