[Python-ideas] Provide __main__ for datetime and time

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Apr 1 18:44:33 EDT 2016


On 01/04/2016 19:02, Michel Desmoulin wrote:
> As with my previous email about __main__ for random, uuid and os, I wish
> to suggest a similar __main__ for datetime. The target audience may not
> be the same, so I'm making it a difference proposal.
>
> E.G:
>
> python -m datetime now => print(str(datetime.datetime.now())
> python -m datetime utcnow => print(str(datetime.datetime.utcnow())
> python -m time epoch => print(time.time())
>
> python -m datetime now "%d/%m/%Y" =>
> print(str(datetime.datetime.now().strftime("%d/%m/%Y"))
> python -m datetime utcnow "%d/%m/%Y" =>
> print(str(datetime.datetime.utcnow().strftime("%d/%m/%Y"))

Not very funny for 1st April.  Would you care to have another go?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Python-ideas mailing list