Tom
Tom

Reputation: 9643

python TypeError: frozenset expected at most 1 arguments, got 4

I'm getting this error when trying to make a frozen set:

class Transcriber:

    DNA_BASES = frozenset('A','T','G','C')
... 

And this is the Traceback:

~/python/project5$ python wp_proj5.py 
Traceback (most recent call last):
  File "wp_proj5.py", line 5, in <module>
    class Transcriber:
  File "wp_proj5.py", line 7, in Transcriber
    DNA_BASES = frozenset('A','T','G','C')
TypeError: frozenset expected at most 1 arguments, got 4

What is wrong here? Can't I initialize a frozenset with more than one string?

Upvotes: 2

Views: 5018

Answers (1)

CppLearner
CppLearner

Reputation: 17040

You need to pass an iterable like a list:

frozenset(['A','T','G','C'])

You can read about it here: http://docs.python.org/2/library/stdtypes.html#frozenset

Upvotes: 2

Related Questions