Skip to content

Instantly share code, notes, and snippets.

@kezabelle
Created May 29, 2015 12:56
Show Gist options
  • Select an option

  • Save kezabelle/af317f2b113ac70a6e78 to your computer and use it in GitHub Desktop.

Select an option

Save kezabelle/af317f2b113ac70a6e78 to your computer and use it in GitHub Desktop.
Yay, PyPy doesn't work like CPython 2.7
Python 2.7.9 (9c4588d731b7fe0b08669bd732c2b676cb0a8233, Mar 31 2015, 07:51:58)
[PyPy 2.5.1 with GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>> from datetime import datetime
>>>> datetime.strftime(datetime.now(), format='%Y')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: strftime() got an unexpected keyword argument 'format'
>>>> datetime.strftime(datetime.now(), '%Y')
'2015'
>>>> datetime.strftime(datetime.now().date(), '%Y')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unbound method strftime() must be called with datetime instance as first argument (got date instance instead)
>>>>
Python 2.7.6 (default, Feb 7 2014, 09:34:05)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> datetime.strftime(datetime.now(), format='%Y')
'2015'
>>> datetime.strftime(datetime.now(), '%Y')
'2015'
>>> datetime.strftime(datetime.now().date(), '%Y')
'2015'
>>>
@kezabelle
Copy link
Author

IRC chat about it begins here and ends here
Led to commits db719ce and f501507

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment