Re: try-except syntax

2018-04-06 Thread ElChino
Steven D'Aprano wrote: imp.find_module is deprecated and should not be used in new code. ... try: block except (ImportError, RuntimeError): block Thanks Steven and others who replied. Looks more elegant. By the way, RuntimeError is almost never something you want t

Re: # of Months between two dates

2018-04-06 Thread bartc
On 06/04/2018 07:16, Steven D'Aprano wrote: - instead of counting days, with all the difficulty that causes, we could just count how many times the month changes; - in which case, Jan 31 to Feb 1 is one month. If you book airport parking in the UK, the charge period runs from the midni

Re: # of Months between two dates

2018-04-06 Thread Steven D'Aprano
On Fri, 06 Apr 2018 10:56:21 +0100, bartc wrote: > Agree with the messiness of dealing with months, but I think it's one of > those quirks that make life more interesting, like imperial measure. I > don't think we really want metric applied to time and to dates. (10-day > weeks? I don't think so.)

A bit of Python history

2018-04-06 Thread Steven D'Aprano
I stumbled across this post from the Timbot, Tim Peters, back in 2000, where he correctly predicted that Python would get generators and iterators in Python 2: https://mail.python.org/pipermail/python-list/2000-January/033955.html as well as list comprehensions. -- Steve -- https://mail.py

Re: A bit of Python history

2018-04-06 Thread Abdur-Rahmaan Janhangeer
amazing ! Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ On Fri, 6 Apr 2018, 15:52 Steven D'Aprano, < steve+comp.lang.pyt...@pearwood.info> wrote: > I stumbled across this post from the Timbot, Tim Peters, back in 2000, > where he correctly predicted that Python would get generators

Re: # of Months between two dates

2018-04-06 Thread Jason Friedman
> > >> > It's probably better to write the function yourself according to what > >> > makes sense in your use-case, and document its behaviour clearly. > >> > >> > > I suggest using the dateutil module ( > > https://pypi.python.org/pypi/python-dateutil) before writing your own. > > I'm not seeing a