Suppose you are designing a new class with some methods that you don’t want to implement, yet.
class MyClass(object): def meth_a(self): pass def meth_b(self): print "I'm meth_b"
If you were to leave out the pass
, the code wouldn’t run.
You would then get an:
IndentationError: expected an indented block
To summarize, the pass
statement does nothing particular, but it can act as a placeholder, as demonstrated here.
Related Posts:
- TypeError: ‘int’ object is not callable
- Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()
- ImportError: No module named pip
- Showing an image with pylab.imshow()
- Confused by python file mode “w+”
- How to make a flat list out of a list of lists
- Removing duplicates in lists
- Conda command not found
- Where is BeautifulSoup4 hiding?
- File open and close in python
- Append values to a set in Python
- Why is it string.join(list) instead of list.join(string)?
- How to prevent errno 32 broken pipe?
- How to iterate over rows in a DataFrame in Pandas
- How do I concatenate two lists in Python?
- if A vs if A is not None:
- TypeError: ‘function’ object is not subscriptable – Python
- How can I make an EXE file from a Python program?
- Python set to list
- ImportError: No module named ‘pygame’
- Split string with multiple delimiters in Python [duplicate]
- Getting key with maximum value in dictionary?
- ImportError: No module named PIL
- Error after upgrading pip: cannot import name ‘main’
- Perform commands over ssh with Python
- OSError: [Errno 8] Exec format error
- ImportError: Cannot import name X
- TypeError: ‘numpy.float64’ object is not callable
- How to clear variables in ipython?
- Convert a tensor to numpy array in Tensorflow?
- pandas: merge (join) two data frames on multiple columns
- Python Finding Prime Factors
- ValueError: ‘object too deep for desired array’
- ‘int’ object has no attribute ‘__getitem__’
- AttributeError(“‘str’ object has no attribute ‘read'”)
- How to get an absolute file path in Python
- Restart python-script from within itself
- What does “TypeError ‘xxx’ object is not callable” means?
- Python ValueError: No JSON object could be decoded
- Is There Any Way To Check if a Twitch Stream Is Live Using Python?
- Python Save to file
- Pytorch tensor to numpy array
- deleting rows in numpy array
- How to make a 3D scatter plot in matplotlib
- Arrays used as indices must be of integer (or boolean) type
- How can I compare two lists in python and return matches
- How to draw vertical lines on a given plot in matplotlib
- Changing the “tick frequency” on x or y axis in matplotlib
- mysql_config not found when installing mysqldb python interface
- Importing variables from another file?
- Difference between BeautifulSoup and Scrapy crawler?
- Displaying better error message than “No JSON object could be decoded”
- Running Bash commands in Python
- No numeric types to aggregate – change in groupby() behaviour?
- “ImportError: No module named site” on Windows
- How do you read a file into a list in Python?
- How to find elements by class
- SSL error : routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
- What is the best way to call a script from another script?
- Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings
- Euclidean Algorithm / GCD in Python
- Pandas split DataFrame by column value
- Using numpy to build an array of all combinations of two arrays
- Get a random sample with replacement
- Can’t update to numpy 1.13 with anaconda?
- Is there any simple way to benchmark Python script?
- Purpose of python antigravity module
- Error: “dictionary update sequence element #0 has length 1; 2 is required” on Django 1.4
- What is the Python equivalent of Matlab’s tic and toc functions?
- In Flask, what is “request.args” and how is it used?
- Conda command is not recognized on Windows 10
- pyserial, ImportError: No module named serial
- TypeError: only integer arrays with one element can be converted to an index 3
- In Flask, what is “request.args” and how is it used?
- How do I determine the size of an object in Python?
- Python function pointer
- Primality test in python [duplicate]
- Flask-SQLalchemy update a row’s information
- Inline for loop
- Read data (.dat file) with Pandas
- Is there any numpy group by function?
- Python way to clone a git repository
- List append() in for loop
- How to save an image locally using Python whose URL address I already know?
- How to throw error and exit with a custom message in python
- What is the correct format to write float value to file in Python
- How is Python’s List Implemented?
- ImportError: No module named IPython
- How to find length of digits in an integer?
- What exactly do “u” and “r” string flags do, and what are raw string literals?
- “E: Unable to locate package python3-pip”
- Eclipse, PyDev “Project interpreter not specified”
- How to exit an if clause
- Python a &= b meaning?
- Compare two columns using pandas
- ValueError: total size of new array must be unchanged
- Shuffle an array with python, randomize array item order with python
- No handlers could be found for logger
- TypeError: ‘NoneType’ object has no attribute ‘__getitem__’
- File “/usr/bin/pip”, line 9, in
from pip import main ImportError: cannot import name main