4 ms·
"The :class:`set` type brings brings the practical expressiveness of set theory to Python. It has a very rich API overall, but lacks a couple of fundamental fea
by _0ffh 12y ago
"The :class:`set` type brings brings the practical expressiveness of set theory to Python. It has a very rich API overall, but lacks a couple of fundamental features. For one, sets are not ordered. On top of this, sets are not indexable"
I suppose that may be because sets are not supposed to be ordered. Nor indexable.
- coldtea 12y agoIn which context? I guess not in math: http://mathworld.wolfram.com/TotallyOrderedSet.html http://mathworld.wolfram.com/TotallyOrderedSet.html
- _0ffh 12y agoYou guessed wrong. From your own link: >>A total order (or "totally ordered set," or "linearly ordered set") is a set plus a relation on the set<< Please note that "set" (unqualified) means the general concept of a set. You can extend that general concept, but then what you get is a new thing (in this case a "totally ordered set").
- coldtea 12y agoAnd who said that our use in Python doesn't need this extended concept?
- _0ffh 12y agoDid anybody say it doesn't? I am sure I didn't. But claiming that Python's implementation of sets "lacks fundamental features" is unfair, wrong, and making the world a dumber place. Some might want to live in that place. I don't.
- coldtea 12y agoIt seems that your confusion stems from the premise that because this Python collection is called a "set" it should have the absolute minimum functionality of the mathematical notion of a set. Python collections are data structures (containers etc). The standard library is not a symbolic math library, and they are not supposed to model math entities perfectly (e.g. they can me mutable), they are used for their utility, which might or might not need them to be ordered.
- deleted 12y ago[deleted]
- _0ffh 12y agoThe only confused person here is plainly yourself. Either that or you are somehow personally offended and desperately looking to excuse that wrongheaded comment, changing tack every time your latest attempt is shot down. Or you're just a troll. I am running out of care to educate you. Go on and complain about tree types for not handling cycles. Because hey, sometimes you need cycles, don't you? I will be sure not to comment. Image related. http://i0.kym-cdn.com/photos/images/newsfeed/000/131/351/eb6.jpg http://i0.kym-cdn.com/photos/images/newsfeed/000/131/351/eb6...
- coldtea 12y agoBesides being rude and offensive (plus tacky, with your meme picture), you still don't seem to comprehend that: 1) the Python standard library is not SymPy or some math modelling library, and its collections are not supposed to map 1 to 1 with the corresponding mathematical entities -- just have those properties that are useful. In fact, the standard python set type is mutable to begin with. 2) even if they were, there are versions of sets in maths were ordering is indeed desired. So this makes your snarky comments needlessly smug and misguiged in 2 different ways. But given the rudeness, I don't think this warrants any more discussion. Have a nice life.