Re: Stupid Python tricks

2016-01-01 Thread Serhiy Storchaka
On 31.12.15 05:51, Steven D'Aprano wrote: Fifteen years later, and Tim Peters' Stupid Python Trick is still the undisputed champion! It may be platform depended, but on my computer the obvious way is 10% faster the Stupid Python Trick. -- https://mail.python.org/mailman/listinfo/python-list

Re: Stupid Python tricks

2016-01-01 Thread Serhiy Storchaka
On 01.01.16 21:00, paul.hermeneu...@gmail.com wrote: On Wed, Dec 30, 2015 at 11:09 PM, Steven D'Aprano wrote: On Thu, 31 Dec 2015 04:02 pm, Rick Johnson wrote: Fifteen years later, and Tim Peters' Stupid Python Trick is still the undisputed champion! And should we be happy about that revel

Re: Stupid Python tricks

2016-01-01 Thread paul . hermeneutic
On Wed, Dec 30, 2015 at 11:09 PM, Steven D'Aprano wrote: > On Thu, 31 Dec 2015 04:02 pm, Rick Johnson wrote: > > >> Fifteen years later, and Tim Peters' Stupid Python Trick is still the > >> undisputed champion! > > > > And should we be happy about that revelation, or sad? > > Yes! > > Which one,

Re: Stupid Python tricks

2015-12-30 Thread Steven D'Aprano
On Thu, 31 Dec 2015 04:02 pm, Rick Johnson wrote: > On Wednesday, December 30, 2015 at 9:51:48 PM UTC-6, Steven D'Aprano > wrote: >> Fifteen years later, and Tim Peters' Stupid Python Trick is still the >> undisputed champion! > > And should we be happy about that revelation, or sad? Yes! --

Re: Stupid Python tricks

2015-12-30 Thread Rick Johnson
On Wednesday, December 30, 2015 at 9:51:48 PM UTC-6, Steven D'Aprano wrote: > Fifteen years later, and Tim Peters' Stupid Python Trick is still the > undisputed champion! And should we be happy about that revelation, or sad? -- https://mail.python.org/mailman/listinfo/python-list

Stupid Python tricks

2015-12-30 Thread Steven D'Aprano
Stolen^W Inspired from a post by Tim Peters back in 2001: https://mail.python.org/pipermail/python-dev/2001-January/011911.html Suppose you have a huge string, and you want to quote it. Here's the obvious way: mystring = "spam"*10 result = '"' + mystring + '"' But that potentially involve