andelf fledna Feather

2011年5月24日星期二

some notes on python sets

according to the doc, we have a set and frozenset built-in func in
python now.

so what's frozenset?

doc says:
Set and ImmutableSet were renamed to set and frozenset.

they don't act like str and unicode, where there's a basestring! no
baseset!!

so you must use isinstance(x, (set, frozenset)).
check it with set.mro().

PS: I got a new handful type/function:
function = type(lambda : None)
Docstring:
function(code, globals[, name[, argdefs[, closure]]])

Create a function object from a code object and a dictionary.
The optional name string overrides the name from the code object.
The optional argdefs tuple specifies the default argument values.
The optional closure tuple supplies the bindings for free variables.

没有评论: