« first day (2914 days earlier)      last day (2037 days later) » 
00:00 - 22:0022:00 - 00:00

10:08 PM
is there any docs that contain all viable keys for map/sort etc
 
That's like trying to compile a complete list of all integers.
 
like there are key uses such as key=snd and key=list.count that I want to know if more exist
or how about standard ones like how would we know 'snd' is a key and its funciton
 
I don't
 
(also what the heck is snd?)
(and don't try to use list.count as a sort key - use collections.Counter.most_common to rank list items by count, or build a counter and use its get or __getitem__ as your sort key.)
 
yeah i know about collections counter just in exploring I discovered other keys that can be used I was wondering if thre were more that might be useful in situations
 
10:12 PM
So what is snd? The suspense is killing me
 
@user2357112 oh if you have a list of tuples say ('h', 1)('a', 2)('b',0) you can use sorted key=snd to sort by the second element of the tuple @AndrasDeak
like where did that come from lol it has to be in some documentation
 
That's not a thing that comes with Python. Someone did snd=operator.itemgetter(1) or def snd(x): return x[1] or snd=lambda x:x[1] or something.
 
>>> sorted([('h', 1), ('a', 2), ('b',0)], key=snd)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'snd' is not defined
>>> sorted([('h', 1), ('a', 2), ('b',0)], key='snd')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'str' object is not callable
 
hmm possibly that would make more sense they must have just been displaying a snip
okay but then still we can use things like key=list.count my query for this key usage is still in play
 
when you see yourself asking these questions, start with help(sorted) and the online docs
 
10:17 PM
i do i find answers scattered I just didnt know if there was a general doc or source that everyone knows about and is pulling them from
 
You can use arbitrary functions so you can write whatever you want that fits your use case. Of course there are problems that come up more often than others (such as "sort container of tuples according to <order>"), but there's no magic
 
wim
@vash_the_stampede documented here
 
@wim ty yes I scour that but I realize now keys are arbitrary can be used at discretion and make our own now , but while you are here, is itertools and operator considered standard lib?
 
wim
snd = chr(7).__eq__
@vash_the_stampede yes both itertools and operator are considered stdlib.
 
i have so much to learn ugh
 
10:29 PM
but then tkinter is also on that path and I never know if it's stdlib or not (but even if it isn't it's admittedly an exeption)
 
wim
it's in /Lib , it's documented, why would you think it's not stdlib?
 
then perhaps there's something about it being stdlib but not being shipped with cpython
I just know "it's complicated" :P
 
wim
it's shipped with cpython
it's possible for it not to import correctly if you build the interpreter without tk-devel headers in the build environment
 
I'll try to find what I vaguely recall
Nov 1 '17 at 17:50, by PM 2Ring
@toonarmycaptain Fair comment, but it would be a bit tricky. Tkinter isn't really a part of the standard Python library: it's a 3rd-party library that's been recently adopted into the family. So the Tkinter docs in the main Python docs are merely a stub. OTOH, the "official" Tkinter docs are a bit of a mess, plus there are a couple of other popular Tkinter docs sites.
probably stuff like that
but there was something more substantial, not just "recently added"
no, that's it
Mar 18 '17 at 7:02, by PM 2Ring
@RaghulM Tkinter is actually a 3rd-party module, but it is included with the standard Python 3 distribution, and it is often bundled with Python 2, but not always. However, in Python 2 the module name is Tkinter so you import it like this:
 
wim
10:45 PM
PM 2Ring is just plain wrong
Tk itself is not part of Python. tkinter module is.
as I mentioned earlier, it's possible for tkinter to raise ImportError if Tk is not there.
 
@AndrasDeak do you have a super memory or how do you pull up these references to what we said, even once you quoted something I said weeks ago ....
 
wim
see the box in the top right corner that says "search" ?
 
@wim you're ruining the magic!
Also, it works for me either way. But @PM2Ring FYI ^
 
11:01 PM
@AndrasDeak ruined it , I thought you were a memory wizard
 
one of the many things I don't like is keeping irrelevant things around in my head
(your mileage of "irrelevant" may vary; the other day I recognized and remembered the Hungarian name of Staphylinus caesareus by looking at it, some 10 years after I read about them)
 
wim
what the common name?
"bug"?
 
11:22 PM
that's not a bug, that's a beetle :P
 
11:39 PM
I wonder how many variations of semicolon insertion/syntactically significant line breaks are in use by modern programming languages. It seems like no two languages do it the same.
Python, Javascript, Go, Julia, and Scala all have different rules. Kotlin seems to do its own weird thing too, but Kotlin's semicolon inference seems to be almost entirely undocumented, so I don't know how it actually works.
 
MATLAB is another one on that list I believe
 
Looks like MATLAB makes the simple choice of not doing any implicit line continuation - all line continuation must use ... explicitly, as far as I can see.
 
That is true, but you can omit separators in loops and conditional blocks if there's a newline. You need a comma otherwise. A bit like in bash...
 
00:00 - 22:0022:00 - 00:00

« first day (2914 days earlier)      last day (2037 days later) »