I found this interesting item in a blog today:
def abc():
try:
return True
finally:
return False
print "abc() is", abc()
Can anyone tell why it does what it does?
Thanks, KR
“Does” is used for singular subjects like “he,” “she,” “it,” “this,” “that,” or “John.” “Do” is used to form imperative sentences, or commands. Example: Do your homework. “Does” is never used to form imperative sentences.
The words “do” and “does” mean the same, that is, “to carry out or to perform an action.” “Do” is used in the first and second persons; “does” is used in the third person. 3. “Do” is used when referring to two or more persons or things while “does” is used when referring to a single person or thing.
We use do/does or is/are as question words when we want to ask yes/no questions. We use does and is with third person singular pronouns (he, she, it) and with singular noun forms. We use do and are with other personal pronouns (you, we they) and with plural noun forms.
To make a question in the Past Tense in English we normally put the auxiliary DID at the beginning of the question or before the main subject. DID is used with regular AND irregular verbs in English. Both Do and Does in present tense questions become Did in past tense questions.
If the finally block contains a return
or break
statement the result from the try
block is discarded
it's explained in detail in the python docu
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With