Stackoverflow question: Is there a built-in identity function in Python?
Ben Finney
ben+python at benfinney.id.au
Thu Dec 7 18:38:24 EST 2017
More information about the Python-list mailing list
Thu Dec 7 18:38:24 EST 2017
- Previous message (by thread): Stackoverflow question: Is there a built-in identity function in Python?
- Next message (by thread): Stackoverflow question: Is there a built-in identity function in Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ethan Furman <ethan at stoneleaf.us> writes: > My contention is that an identity function is a do-nothing function > that simply returns what it was given: > > --> identity(1) > 1 > > --> identity('spam') > 'spam' These seem good to me. One argument given, the same result returned. > --> identity('spam', 'eggs', 7) > ('spam', 'eggs', 7) That's a confusingly inconsistent result, as pointed out by other responses in this thread. I would expect an identity function to accept exactly one positional argument. Given more than one positional argument, it should raise a TypeError. -- \ Legionnaire: “We have their leader captive!” Cæsar: “Is he | `\ bound?” Legionnaire: “Of his health I know not, sir.” —The | _o__) Goon Show, _The Histories Of Pliny The Elder_ | Ben Finney
- Previous message (by thread): Stackoverflow question: Is there a built-in identity function in Python?
- Next message (by thread): Stackoverflow question: Is there a built-in identity function in Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list