"Steven D'Aprano" <[EMAIL PROTECTED]> wrote:
> On Wed, 06 Jul 2005 10:15:31 -0700, George Sakkis wrote:
>
> > Well, they *may* be interchangable under some conditions, and that was
> > the OP's point you apparently missed.
>
> I didn't miss anything of the sort. That's why I spent 15 minutes actua
Steven D'Aprano wrote:
> If, over a thousand runs of the program, you save a millisecond of
> time in total, but it costs you two seconds to type the comment in
> the code explaining why you used frozenset instead of the more
> natural set, then your "optimization" is counter-productive. Even
> ju
On Wed, 06 Jul 2005 10:15:31 -0700, George Sakkis wrote:
> Well, they *may* be interchangable under some conditions, and that was
> the OP's point you apparently missed.
I didn't miss anything of the sort. That's why I spent 15 minutes actually
producing test cases to MEASURE if there was any de
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote:
> On Wed, 06 Jul 2005 14:25:30 +0100, Will McGugan wrote:
> > No need for the 'premature optimization is the root of all evil' speech.
> > I'm not trying to optimize anything - just enquiring about the nature of
> > frozenset. If typing 'frozenset' over
On Wed, 06 Jul 2005 14:25:30 +0100, Will McGugan wrote:
>> But if you are just trying to optimize for the sake of optimization,
>> that's a terrible idea. Get your program working first. Then when it
>> works, measure how fast it runs. If, and ONLY if, it is too slow,
>> identify the parts of the
Will McGugan wrote:
> Are there any benefits in using a frozenset over a set, other than it
> being immutable?
No. The underlying implementation is identical with set. The only
difference is the addition of a hash method and absence of mutating
methods. Everything else is the same.
Raymond
-
Will McGugan <[EMAIL PROTECTED]> writes:
> Qiangning Hong wrote:
> > On 7/6/05, Will McGugan <[EMAIL PROTECTED]> wrote:
> >
> >>Hi,
> >>
> >>Are there any benefits in using a frozenset over a set, other than it
> >>being immutable?
> > A frozenset can be used as a key of a dict:
>
> Thanks, but
Steven D'Aprano wrote:
> There is no significant speed difference between immutable and mutable
> sets, at least for queries. Regardless of whether it is successful or
> unsuccessful, mutable or immutable, it takes about 0.025 second to do
> each test of item in set. Why would you need to opti
On Wed, 06 Jul 2005 11:30:14 +0100, Will McGugan wrote:
> I was wondering if frozenset was faster or more efficient in some way.
>
> Thinking back to the dark ages of C++, you could optimize things that
> you knew to be constant.
Why would you want to?
py> import sets
py> import time
py> bigs
Qiangning Hong wrote:
> On 7/6/05, Will McGugan <[EMAIL PROTECTED]> wrote:
>
>>Hi,
>>
>>Are there any benefits in using a frozenset over a set, other than it
>>being immutable?
>
>
> A frozenset can be used as a key of a dict:
Thanks, but I meant to imply that.
I was wondering if frozenset was
On 7/6/05, Will McGugan <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Are there any benefits in using a frozenset over a set, other than it
> being immutable?
A frozenset can be used as a key of a dict:
.>> s1 = set([1])
.>> s2 = frozenset([2])
.>> {s1: 1}
Traceback (most recent call last):
File "", li
Hi,
Are there any benefits in using a frozenset over a set, other than it
being immutable?
Will McGugan
--
http://www.willmcgugan.com
"".join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in
"jvyy*jvyyzpthtna^pbz")
--
http://mail.python.org/mailman/listinfo/python-list
12 matches
Mail list logo