OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to correctly initialize OrderedDict variable

  • Thread starter Thread starter sfgroups
  • Start date Start date
S

sfgroups

Guest
I am defining variable with type hint and initialize it with empty value like this:

Code:
 accumulator: OrderedDict[str, set[str]] = {}

but this gives warning message:

Code:
Assign to "accumulator" a value of type "OrderedDict[str, set[str]]" instead of "dict" or update its type hint.
Expected type 'OrderedDict[str, set[str]]', got 'dict' instead

How to initialize this variable correctly?
<p>I am defining variable with type hint and initialize it with empty value like this:</p>
<pre><code> accumulator: OrderedDict[str, set[str]] = {}
</code></pre>
<p>but this gives warning message:</p>
<pre><code>Assign to "accumulator" a value of type "OrderedDict[str, set[str]]" instead of "dict" or update its type hint.
Expected type 'OrderedDict[str, set[str]]', got 'dict' instead
</code></pre>
<p>How to initialize this variable correctly?</p>
 

Latest posts

Top