Python Forum
how to put a frozenset in a frozen set
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to put a frozenset in a frozen set
#1
what is a an expression to put a frozenset inside a frozenset? since a frozenet is hashable it should work ... in theory. when i try it i just get a new frozenset with the members of the one i tried to put in.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
Yeah, that's because frozensets are immutable. That's what makes them hashable.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
i mean in the expression that initially creates them. sorry for the confusion.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#4
Then I have absolutely no idea what you are talking about.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#5
is that what you a looking for

>>> foo = frozenset([1, 2, 3])
>>> foo
frozenset({1, 2, 3})
>>> bar = frozenset((foo, ))
>>> bar
frozenset({frozenset({1, 2, 3})})
not that I see the point of making frozenset with one frozenset inside it (i.e. I guess you did
>>> bar = frozenset(foo)
>>> bar
frozenset({1, 2, 3})
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#6
i was trying a way like one of those and was getting a single frozenset with the original numbers. it appeared that frozenset() was just trying to convert whatever container was passed to it to be a frozenset. but now it seems to be working. now i don't know how to do a conversion. one way or the other it does something, but i never know which.

some other code gets numbers out of containers at any depth, and this is part of the test code for it (trying many combinations).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  cx_freeze frozen executive introduces WinError 10049 KipCarter 3 3,090 Jan-14-2020, 02:34 PM
Last Post: KipCarter

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020