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
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
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?
>
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
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!
--
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
Thanks for the pointers to appscript, and for the comments on the
page. I have changed the examples at
http://juanreyero.com/article/python/os-x-python.html
to reflect them.
Cheers,
Juan
--
http://juanreyero.com
--
http://mail.python.org/mailman/listinfo/python-list
Greetings,
I've written a short document with some working examples of how to
interface python with other applications in OS-X via applescript (had
to spend some time figuring it out, and thought I might as well write
it down). The examples include asking Google Earth for the latitude
and
On 12/11/09 3:13 AM, joa...@gmail.com wrote:
Greetings,
I've written a short document with some working examples of how to
interface python with other applications in OS-X via applescript (had
to spend some time figuring it out, and thought I might as well write
it down). The examples include
Scott David Daniels scott.dani...@acm.org wrote:
RajNewbie wrote:
On Jan 12, 6:51 pm, Tim Chase python.l...@tim.thechases.com wrote:
[a perfectly fine reply which is how I'd solve it]
RajNewbie wrote:
... The solution that I had in mind is:
while True:
...
if
Hi,
My code has a lot of while loops of the following format:
while True:
...
if condition: break
The danger with such a code is that it might go to an infinite loop
- if the condition never occurs.
Is there a way - a python trick - to have a check such that if the
loop goes
RajNewbie raj.indian...@gmail.com writes:
Could someone chip in with other suggestions?
Set up an iterable that will end under the right conditions. Then,
iterate over that with ‘for foo in that_iterable’. This idiom is
usually far more expressive than any tricks with ‘while’ loops and
‘break’
My code has a lot of while loops of the following format:
while True:
...
if condition: break
The danger with such a code is that it might go to an infinite loop
- if the condition never occurs.
Is there a way - a python trick - to have a check such that if the
loop goes
On Jan 12, 6:51 pm, Tim Chase python.l...@tim.thechases.com wrote:
My code has a lot of while loops of the following format:
while True:
...
if condition: break
The danger with such a code is that it might go to an infinite loop
- if the condition never occurs.
RajNewbie raj.indian...@gmail.com writes:
I do understand that we can use the code like -
i = 0
while True:
i++
if i 200: raise infinite_Loop_Exception
...
if condition: break
But I am not very happy with this code for 3 reasons
I prefer:
from
On Jan 13, 12:51 am, Tim Chase python.l...@tim.thechases.com took a
walk on the OT side:
Could someone chip in with other suggestions?
As an aside: the phrase is chime in[1] (to volunteer
suggestions) Chip in[2] usually involves contributing money to
a common fund (care to chip in $10 for
RajNewbie wrote:
On Jan 12, 6:51 pm, Tim Chase python.l...@tim.thechases.com wrote:
[a perfectly fine reply which is how I'd solve it]
RajNewbie wrote:
... The solution that I had in mind is:
while True:
...
if condition: break
if inifinte_loop(): raise
RajNewbie wrote:
Is there a way - a python trick - to have a check such that if the
loop goes for more than x number of steps, it will cause an exception?
I do understand that we can use the code like -
i = 0
while True:
i++
if i 200: raise infinite_Loop_Exception
RajNewbie wrote:
But, I still feel it would be much more aesthetically pleasing if I
can call a single procedure like
if infinite_loop() - to do the same.
You may find it aesthetically pleasing, and it may very well be, but it
will obfuscate your code and make it less maintainable.
robert
--
19 matches
Mail list logo