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 happy about that revel
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,
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
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
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
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 a
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 longitu
Scott David Daniels wrote:
> RajNewbie wrote:
> > On Jan 12, 6:51 pm, Tim Chase 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 : break
> >>> if inifinte_l
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
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_Exce
RajNewbie wrote:
On Jan 12, 6:51 pm, Tim Chase 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 : break
if inifinte_loop(): raise infiinte_loop_exception
Wherein infinite_loop is a ge
On Jan 13, 12:51 am, Tim Chase 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 Sally's wedding gif
RajNewbie writes:
>I do understand that we can use the code like -
>i = 0
>while True:
> i++
> if i > 200: raise infinite_Loop_Exception
> ...
> if : break
>
>But I am not very happy with this code for 3 reasons
I prefer:
from itertools import count
fo
On Jan 12, 6:51 pm, Tim Chase wrote:
> > My code has a lot of while loops of the following format:
> > while True:
> > ...
> > if : break
>
> > The danger with such a code is that it might go to an infinite loop
> > - if the never occurs.
> > Is there a way - a python trick
My code has a lot of while loops of the following format:
while True:
...
if : break
The danger with such a code is that it might go to an infinite loop
- if the never occurs.
Is there a way - a python trick - to have a check such that if the
loop goes for more than x numbe
RajNewbie 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’ statements.
For tools
Hi,
My code has a lot of while loops of the following format:
while True:
...
if : break
The danger with such a code is that it might go to an infinite loop
- if the never occurs.
Is there a way - a python trick - to have a check such that if the
loop goes for more than x nu
19 matches
Mail list logo