Ted wrote:
> Thank you Roy.
>
> It seems if you lurk here long enough you eventually get all you
> questions answered without even asking!
> ;-)
>
+1 QOTW
please avoid top-posting, and please avoid posting back a long message
just to add three lines.
--
bruno desthuilliers
python -c "print '
In article <[EMAIL PROTECTED]>,
Casey Hawthorne <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] (Roy Smith) wrote:
>
> >O(n^0), which is almost always written as O(1). This is a "constant
> >time" algorithm, one which takes the same amount of steps to execute
> >no matter how big the input is.
[EMAIL PROTECTED] (Roy Smith) wrote:
>O(n^0), which is almost always written as O(1). This is a "constant
>time" algorithm, one which takes the same amount of steps to execute
>no matter how big the input is. For example, in python, you can
>write, "x = 'foo'". That assignment statement takes t
Roy Smith wrote:
> In article <[EMAIL PROTECTED]>,
> John Salerno <[EMAIL PROTECTED]> wrote:
>> Roy Smith wrote:
>>
>>> OK, here's a quick tutorial to "big-oh" notation.
>> Wow, that was fantastic (and interesting)! Did you just write that? That
>> should be saved somewhere! Mind if I post it on
In article <[EMAIL PROTECTED]>,
John Salerno <[EMAIL PROTECTED]> wrote:
>Roy Smith wrote:
>
>> OK, here's a quick tutorial to "big-oh" notation.
>
>Wow, that was fantastic (and interesting)! Did you just write that? That
>should be saved somewhere! Mind if I post it on my website? (don't
>worry
Roy Smith wrote:
> OK, here's a quick tutorial to "big-oh" notation.
Wow, that was fantastic (and interesting)! Did you just write that? That
should be saved somewhere! Mind if I post it on my website? (don't
worry, no one goes there anyway) :)
--
http://mail.python.org/mailman/listinfo/pytho
Thank you Roy.
It seems if you lurk here long enough you eventually get all you
questions answered without even asking!
;-)
Roy Smith wrote:
> John Salerno <[EMAIL PROTECTED]> wrote:
> >Roy Smith wrote:
> >
> >> One may be marginally faster, but they both require copying the source
> >> string,
John Salerno <[EMAIL PROTECTED]> wrote:
>Roy Smith wrote:
>
>> One may be marginally faster, but they both require copying the source
>> string, and are thus both O(n).
>
>Sorry, I'm not familiar with the O(n) notation.
OK, here's a quick tutorial to "big-oh" notation. It's a way of
measuring a
John Salerno wrote:
> Duncan Booth wrote:
>
>> If you build a
>> list of lines to join then you don't have to repeat '\n' on the end of
>> each component line.
>
> How would that work? Wouldn't the last line in the list still need the
> newlines?
>>> chunks = ["alpha", "beta", "gamma"]
>>> "\n"
Duncan Booth wrote:
> If you build a
> list of lines to join then you don't have to repeat '\n' on the end of each
> component line.
How would that work? Wouldn't the last line in the list still need the
newlines?
--
http://mail.python.org/mailman/listinfo/python-list
Roy Smith wrote:
> One may be marginally faster, but they both require copying the source
> string, and are thus both O(n).
Sorry, I'm not familiar with the O(n) notation.
> If you're just doing one or a small fixed
> number of these, it really doesn't matter. Pick whichever one you think is
In article <[EMAIL PROTECTED]>,
John Salerno <[EMAIL PROTECTED]> wrote:
> My initial feeling is that concatenation might take longer than
> substitution, but that it is also easier to read:
>
>
> def p(self, paragraph):
> self.source += '' + paragraph + '\n\n'
>
> vs.
>
> def p(self, pa
Leif K-Brooks wrote:
> fuzzylollipop wrote:
>> niether .join() is the fastest
>
> Please quote what you're replying to.
>
> No, it's the slowest:
>
> [EMAIL PROTECTED]:~$ python -m timeit "'%s\n\n' % 'foobar'"
> 100 loops, best of 3: 0.607 usec per loop
> [EMAIL PROTECTED]:~$ python -m time
fuzzylollipop wrote:
> niether .join() is the fastest
Please quote what you're replying to.
No, it's the slowest:
[EMAIL PROTECTED]:~$ python -m timeit "'%s\n\n' % 'foobar'"
100 loops, best of 3: 0.607 usec per loop
[EMAIL PROTECTED]:~$ python -m timeit "'' + 'foobar' + '\n\n'"
100 loops
niether .join() is the fastest
--
http://mail.python.org/mailman/listinfo/python-list
John Salerno wrote:
> My initial feeling is that concatenation might take longer than
> substitution
Doesn't look that way:
[EMAIL PROTECTED]:~$ python -m timeit "'%s\n\n' % 'foobar'"
100 loops, best of 3: 0.6 usec per loop
[EMAIL PROTECTED]:~$ python -m timeit "'' + 'foobar' + '\n\n'"
1
My initial feeling is that concatenation might take longer than
substitution, but that it is also easier to read:
def p(self, paragraph):
self.source += '' + paragraph + '\n\n'
vs.
def p(self, paragraph):
self.source += '%s\n\n' % paragraph
Is there a preference between these two
17 matches
Mail list logo