Why not try it out?
>>> def some_func():
... return 2
...
>>> if (a = some_func()):
File "<stdin>", line 1
if (a = some_func()):
^
SyntaxError: invalid syntax
So, no.
Update: This is possible (with different syntax) in Python 3.8
if a := some_func():
More Related Contents:
- Python: Wrong directory
- How can I read inputs as numbers?
- Format timedelta to string
- How to get the return value from a thread in Python?
- Getting computer’s UTC offset in Python
- Python: How to get stdout after running os.system? [duplicate]
- How can I make a for-loop pyramid more concise in Python? [duplicate]
- How to fix character constantly accelerating in both directions after deceleration Pygame?
- How do I create an empty array and then append to it in NumPy?
- What is the official “preferred” way to install pip and virtualenv systemwide?
- How to plot empirical cdf (ecdf)
- Numpy to TFrecords: Is there a more simple way to handle batch inputs from tfrecords?
- How to Run Python Code on SublimeREPL
- How do I use a default namespace in an lxml xpath query?
- pandas dataframe select columns in multiindex [duplicate]
- Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox?
- pandas filtering and comparing dates
- Python requests with multithreading
- Is there a way to split a string by every nth separator in Python?
- Schrödinger’s variable: the __class__ cell magically appears if you’re checking for its presence?
- Specify a sender when sending mail with Python (smtplib)
- Integer File Descriptor “0” in open()
- Python regular expression pattern * is not working as expected
- Pygame rotating cubes around axis
- create file of particular size in python
- Create empty conda environment
- NLTK WordNet Lemmatizer: Shouldn’t it lemmatize all inflections of a word?
- Search and replace dots and commas in pandas dataframe
- How to convert integers in list to string in python
- Python subprocess Popen: Why does “ls *.txt” not work? [duplicate]