Empty sequence
See original GitHub issueI know I can do seq([])
, but is there a particular reason seq()
isn’t supported?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Definition:Sequence/Empty Sequence - ProofWiki
An empty sequence is a (finite) sequence containing no terms. Thus an empty sequence is a mapping from ∅ to S, that ...
Read more >The empty sequence - OeisWiki
The empty sequence (as there is only one empty sequence) is the "solution" (so to speak) of a countably infinite number of unsatisfiable...
Read more >Chapter 18. Null vs. Empty Sequence - JSONiq
Null and the empty sequence are two different concepts. Null is an item (an atomic value), and can be a member of an...
Read more >emptySequence - Kotlin Programming Language
Returns an empty sequence. Stay in touch: Contributing to Kotlin · Releases · Press Kit · Security · Blog · Issue Tracker ·...
Read more >ValueError: max( ) arg is an empty sequence - STechies
We encountered an error in line 5 i.e ValueError: min() arg is an empty sequence . This Is because min( ) method has...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The idea to have a default doesn’t necessarily mean an equivalent way of doing it is bad style-wise. The reason for not doing
sequence=[]
is because the array is then a singleton across all calls, which leads to very weird behavior. The right way to implement this pattern, is to setsequence=None
and then have aif sequence is None
check, if so then setsequence = []
. In this particular case, I don’t think you’d need to change theSequence
code since the type error is thrown in_parse_args
and theSequence
constructor usually isn’t called by users, rather by the library itself.Back to the question of whether you should be able to call
seq()
with arguments, I can get behind the argument of mirroringset()
andlist()
in returning an empty sequence. The example stephan gave also seems like a reasonable use case for this.Given that, I’d welcome a PR that modifies the
len(args) == 0
code section to instead initialize to an empty sequence. I think that is probably the only change needed, but its possible I’m missing somethingmerged!