« first day (603 days earlier)      last day (11 days later) » 

12:11 AM
@wjandrea Don't be unkind, just gently help the OP, they have good intent, we were all in their position once. Re "confuses lists with arrays", Java programmers generically say "array" when talking about what would be a list in Python, simply because the fundamental data structure in Java is an array. They're not referring to Python arrays.
That kind of evolved into revert-war leak in title and answers...
^^ (what would be the rough equivalent of a Python list, i.e. O(1) lookup. Java arrays are obviously not a linked-list.)
I went looking for a good answer to "Print/format/convert-to-string a list without spaces between list elements" (list items are not necessarily string, ideally with enclosing '['..']', and possibly with custom separator, and almost noone nested lists), and I found a big mess. I found these:
Printing lists in python without spaces Not general, unnecessarily conflates with OP's use-case of inputting and checking for valid base-7 digits.
Print all items in a list with a delimiter asked back in 2010 under 2.6/2.7, so answers don't mention f-string
How to concatenate (join) items in a list to a single string ok but again, pretty old 2012 answers, no f-strings
A recent downvoted 2018 question Printing a list with custom separators
2018 asking, user confuses print sep argument with end, please close as typo. Display list items with custom separator using print() function
Closed "How to trim spaces between list elements in an f-string?" -> Print all items in a list with a delimiter
So I guess our reluctant canonical is Print all items in a list with a delimiter. The code-example phrasing of the question is bad, but the answers are good, but they need some bringing up to date/
^ Oh and they meant separator. Should I edit title to "Print all items in a list with a comma separator/delimiter and no intervening space?"
^^ Oh and it's Python 2.x Sigh. I rewrote the body for clarity, but left the 2.x syntax in for now
Added a comment about 3.x syntax. That's as much cleaning for a day. Any advice guys?
 
1:03 AM
@smci "They're not referring to Python arrays." - That's what I thought at first too, but they linked the Python array docs and talked about specifics of Python arrays compared to lists.
 
Oh my bad then. I skimmed through the Q&A and didnt' spot that.
 
I think what might have happened was they started by saying "array" meaning "list", went looking for docs to link, found the array docs, then when people pointed out that lists are different, instead of fixing what they wrote before, they just tacked on the list stuff and specifics about arrays.
np
 
SilentGhost's edit #4 unwantedly changed "array" -> "list" stackoverflow.com/revisions/2022031/4
 
@smci Look at edit #3 :)
 
Yeah ok, in #3 user Abel added "arrays". A concatenation of train-wrecks...
Hey what's your advice on my post above? My reluctant choice of canonical is the old 2010 "Print all items in a list with a delimiter" with some surgery.
 
1:15 AM
@smci Ah, I don't know. For me, I only get involved in the canonical discussion when I'm looking to close a new question. (which in the above case was stackoverflow.com/q/78321550/4518341)
 
1:34 AM
@wjandrea Uhuh, would apprecuate your very quick opinion; even if you say "It's a lost cause trying to curate on SO for Python 3.x on an answer-base that still can be mostly 2.x". That's teh creeping feeling I get, 99% of the time I just give up on something unless it's very fundamental and broadly applicable.
 
 
4 hours later…
5:07 AM
Note on "custom sorting in pandas [dataframe]" this can mean one of several things from the following, and it depends on whether the column(s)/indices are int, Categorical, string, date etc: a) sort on a custom order of the index b) sort on a custom order of one column df.sort_values(...cmp=) c) sort on a custom key derived from >1 column e.g. (first 10 letters of lastname, age (descending), zip5).
No single question covers or mentions all of these use-cases; plus the pandas maintainers deprecate some of the functionality. I did find this about sorting a categorical series.
 

« first day (603 days earlier)      last day (11 days later) »