props
should not have a default value like that. Do this instead:
class a(object):
def __init__(self, props=None):
if props is None:
props = {}
self.props = props
This is a common python “gotcha”.
More Related Contents:
- How to name a file using a value in a list in a dictionary?
- I am trying to modify a dictionary value using the exec function
- How to copy a dictionary and only edit the copy
- Python list of dictionaries search
- Replace values in a pandas series via dictionary efficiently
- Why is dictionary ordering non-deterministic?
- Object of custom type as dictionary key
- Get the key corresponding to the minimum value within a dictionary
- Error: ” ‘dict’ object has no attribute ‘iteritems’ “
- Merging dictionary value lists in python
- Convert a python dict to a string and back
- How can I use if/else in a dictionary comprehension?
- python groupby behaviour?
- How to create a dictionary of two pandas DataFrame columns
- Elegant way to remove fields from nested dictionaries
- python: read json and loop dictionary
- Python: use mysqldb to import a MySQL table as a dictionary?
- Is there a difference between using a dict literal and a dict constructor?
- Is self.__dict__.update(**kwargs) good or poor style?
- How can I avoid “RuntimeError: dictionary changed size during iteration” error?
- Creating a dictionary with list of lists in Python
- dataframe to dict such that one column is the key and the other is the value [duplicate]
- Python dictionary comprehension using locals() gives KeyError
- Using Python class as a data container [closed]
- How can I convert string values from a dictionary, into int/float datatypes?
- Python super() arguments: why not super(obj)?
- Rename columns in Pandas based on a dictionary
- sorting list of nested dictionaries in python
- How to convert only numbers in a mixed list into float
- In what case would I use a tuple as a dictionary key? [closed]