miscon:programming.functions.multiple-return-values · draft · trust low · v0.1.1 · kind undergeneralization
A function can return several separate values
return a, b sends back two separate values, so the caller receives two things rather than one tuple.
- Stable URI
- https://open-misconceptions.github.io/miscon-data/m/programming.functions.multiple-return-values
- UUID
ba72c8c8-9a30-4f6a-9c9f-50370cde1a2f- Domain
programming.functions- Level band
- undergraduate
- Locale
- en
- About
- https://open-misconceptions.github.io/miscon-data/c/programming.functions.single-return-value (Miscon)
Evidence patterns
Pattern 0: predict the type of a call that returns a comma-separated list
predicts two values, or that the second is lost, rather than one tuple
Item
def f():
return 1, 2
x = f()
print(type(x))Expected
<class 'tuple'>Response
int (or 'error, two values into one variable')Discriminators
vs a slip. Consistent across items and revealed by asking what x holds after x = f(). A slip is a single wrong type.
Relations
conflicts_with- A function returns one value; several values travel as one tuple (external)
resolved_by- A function returns one value; several values travel as one tuple (external)
return hands a value back to the caller and ends the call (external)
Alignments
- progmiscon Python/MultipleValuesReturn (close-match)
Provenance
Origin: llm-drafted
- Chiodini, L., Moreno Santos, I., Gallidabino, A., Tafliovich, A., Santos, A. L., & Hauswirth, M. (2021). A curated inventory of programming language misconceptions. In Proceedings of the 26th ACM Conference on Innovation and Technology in Computer Science Education (ITiCSE '21), 380-386. doi:10.1145/3430665.3456343
Inventory consulted for the misconception name and scope only; progmiscon publishes no licence for its text, so Open Misconceptions' statements and examples are written independently.
Drafted from the cited literature for the Open Misconceptions seed pack; statement, examples and discriminators are original text. Awaiting maintainer review.
Review status
Status draft, trust low (computed from the reviews below against the reviewer registry).
No reviews yet.
Formats
- Raw JSON
- CASE 1.1 package (CFItem
ba72c8c8-9a30-4f6a-9c9f-50370cde1a2f) - Source on GitHub
Cite
miscon:programming.functions.multiple-return-values
https://open-misconceptions.github.io/miscon-data/m/programming.functions.multiple-return-values