M
Mark E. Fenner
Hello all,
I was migrating some code from sets.ImmutableSet to frozenset and noticed
the following:
******code********
#!/usr/bin/env python
from sets import ImmutableSet
class MSet1(ImmutableSet):
def __init__(self, iterArg, myName="foo"):
ImmutableSet.__init__(self, iterArg)
self.name = myName
class MSet2(frozenset):
def __init__(self, iterArg, myName="foo"):
frozenset.__init__(self, iterArg)
self.name = myName
m1 = MSet1([1,2,3], myName = "donkey")
print m1
print m1.name
m2 = MSet2([1,2,3], myName = "kong")
print m2
print m2.name
*********end code**********
*********run**********
MSet1([1, 2, 3])
donkey
Traceback (most recent call last):
File "./setTest.py", line 22, in ?
m2 = MSet2([1,2,3], myName = "kong")
TypeError: frozenset() does not take keyword arguments
*********end run********
I'm missing something and couldn't find it in the docs.
Speaking of which, in the docs at the bottom of the description of the
builtin set/frozenset, there is a link to a page describing differences
between the builtin sets and the sets module sets. This link is broken
locally and on the python.org docs.
Locally, it reads:
file:///usr/share/doc/python-docs-2.4.2/html/lib/module-comparison-to-builtin-set.html
While it should read:
file:///usr/share/doc/python-docs-2.4.2/html/lib/comparison-to-builtin-set.html
Regards,
Mark
I was migrating some code from sets.ImmutableSet to frozenset and noticed
the following:
******code********
#!/usr/bin/env python
from sets import ImmutableSet
class MSet1(ImmutableSet):
def __init__(self, iterArg, myName="foo"):
ImmutableSet.__init__(self, iterArg)
self.name = myName
class MSet2(frozenset):
def __init__(self, iterArg, myName="foo"):
frozenset.__init__(self, iterArg)
self.name = myName
m1 = MSet1([1,2,3], myName = "donkey")
print m1
print m1.name
m2 = MSet2([1,2,3], myName = "kong")
print m2
print m2.name
*********end code**********
*********run**********
MSet1([1, 2, 3])
donkey
Traceback (most recent call last):
File "./setTest.py", line 22, in ?
m2 = MSet2([1,2,3], myName = "kong")
TypeError: frozenset() does not take keyword arguments
*********end run********
I'm missing something and couldn't find it in the docs.
Speaking of which, in the docs at the bottom of the description of the
builtin set/frozenset, there is a link to a page describing differences
between the builtin sets and the sets module sets. This link is broken
locally and on the python.org docs.
Locally, it reads:
file:///usr/share/doc/python-docs-2.4.2/html/lib/module-comparison-to-builtin-set.html
While it should read:
file:///usr/share/doc/python-docs-2.4.2/html/lib/comparison-to-builtin-set.html
Regards,
Mark