« first day (46 days earlier)      last day (568 days later) » 

2:52 AM
gist.github.com/zahlman/5d4a3900ac0947c3591ec35027c32a05 Here is current progress on a canonical for pip installing to the wrong Python. There is already a decent version of the question at stackoverflow.com/questions/51922364; but I want to offer a question that is as good as possible
in particular, my question seeks to:
* solicit all the information I offer in the answer
* be package-agnostic
* include useful incidental information
* explain the problem clearly, with the hindsight of someone who actually knows the answer in detail.
 
3:37 AM
in Python, 12 mins ago, by tripleee
@KarlKnechtel looking really good, maybe explain PATH a bit more in a sidebar, and python3 and pip3 vs python and pip v2 on some Debian (and Ubuntu, Mint etc) versions
left a couple of comments on the gist to expand on my comments
the Achilles' heel seems to be the scenario "that's all informative, but I already set things up stupidly; so, what can I do to solve this in my specific stupid circumstances"?
 
 
1 hour later…
4:57 AM
@tripleee I guess the first thing is to figure out how many conceptually different "specific stupid circumstances" there are
but I guess it doesn't hurt to have something about what to do if it's already yammed up
depending on the issue? I'm not sure there's anything complex tho
although that does highlight that venvs have the advantage of being relatively disposable (installed wrong stuff and made a mess? just start over and install good stuff)
 
 
1 hour later…
6:15 AM
stackoverflow.com/questions/15478127 thoughts on the duplicate discussion?
 
6:35 AM
@KarlKnechtel I'm divided; certainly the proposed duplicate seems odd, even if some of the answers cover that ground specifically
 
more generally, stackoverflow.com/… there would seem to be a bunch of undetected duplication in here, but the proper factoring is not clear
That seems to be a recurring problem, really.
 
ugh those search results
 
7:12 AM
Now you know my pain.
 
 
1 hour later…
8:19 AM
@KarlKnechtel this sentence: " For Windows, please see stackoverflow.com/questions/304319."; should be rephrased: "For Windows, the command is where pip, see [this thread]"
It makes a better symmetry with the preceding sentence, avoids an untitled URL, and minimalistically shows the command+a link.
@KarlKnechtel I think cherry on top of the cake here is a brief reference/link to something authoritative that nutshells site-packages. Given you have several of them, preinstalled, post installation, and depending on user accounts involved, that's the main problem noobs face after figuring out everything that's already in that post.
If you give them an explanation about site-packages that's all they need summarized in that one post!
2nd suggestion
@KarlKnechtel where it reads "Set up and activate a virtual environment first." direct link to the official Python documentation with the activate keyword highlighted, this link - I honestly think it can't get any better than this.
I also think a link to this excellent overview can help newbies a lot when talking about venvs.
I'm not for "cramming too much info" but the above links are IMHO "must read" essentials.
 
8:46 AM
this duplicate might seem a bit harsh but this is a really common FAQ, any better canonical dupes? stackoverflow.com/questions/73984047/…
 
 
12 hours later…
8:45 PM
31
Q: python: What happens when class attribute, instance attribute, and method all have the same name?

narenHow does python differentiate a class attribute, instance attribute, and method when the names are the same? class Exam(object): test = "class var" def __init__(self, n): self.test = n def test(self): print "method : ",self.test test_o = Exam("Fine") print dir(te...

seems useful and good
@tripleee The question is specifically about the fact that using a list or tuple causes repr to be used for the elements. I know we have a canonical but right now I'm only turning up stuff like stackoverflow.com/questions/5376529
or stuff like stackoverflow.com/questions/3272097/printing-a-list-of-objects, but that's oriented towards your own classes
honestly the main __str__ vs __repr__ canonical is probably better here
since Container’s __str__ uses contained objects’ __repr__ is right there in the top answer.
We should keep an eye on this sort of thing because I know the canonical is out there (like the truth... I want to believe)
stackoverflow.com/questions/73991848 We seriously need something for stuff like this.
just an introductory level "how does method lookup work?".
Stuff like stackoverflow.com/questions/73990497 is a vague hint in that direction.
 
9:29 PM
103
Q: Python for-in loop preceded by a variable

Greg FlynnI saw some code like: foo = [x for x in bar if x.occupants > 1] What does this mean, and how does it work?

Second-guessing my previous duping here. This one does seem higher quality for list comprehensions specifically, but the other one actually explains other comprehensions.
We don't seem to have a good target that actually shows the other syntaxes.
@tripleee thinking about it again. Trying to figure out what the title would be of the canonical we really want.
maybe something like "How does print know what text to display, when given something that isn't a string?"
There was also... something I was working on, talking about what the REPL actually does, and the fact that it suppresses None
 
9:44 PM
43
Q: The `is` operator behaves unexpectedly with non-cached integers

Dimitris Fasarakis HilliardWhen playing around with the Python interpreter, I stumbled upon this conflicting case regarding the is operator: If the evaluation takes place in the function it returns True, if it is done outside it returns False. >>> def func(): ... a = 1000 ... b = 1000 ... return a is b ... >>>...

We need to clean up these kinds of questions, too. Something like "under what conditions will Python reuse an immutable object?"
or "Why do two expressions inconsistently give the same or different object IDs?"
 
10:07 PM
or heck, interning vs. object IDs are actually being reused due to the VM dropping them
16
Q: Why do different methods of same object have the same `id`?

TimurI thought that is operator checks the objects id's equality. But it doesn't seem so: >>> class A(object): ... def f(): return 1 ... def g(): return 2 ... >>> a = A() >>> a.f is a.g False >>> id(a.f) == id(a.g) True

Huh, something like that could actually be reworked to be the canonical, or its duplicate
Nevermind, this one is much better
9
Q: Unnamed Python objects have the same id

usual meLet's create two lists: x = range(3) y = range(3) print id(x), id(y) Out: 4366592912 4366591040 I created two independent lists, and the output shows two different memory addresses. This is not surprising. But now let's do the same thing without the assignment: id(range(3)) Out: 4366623...

 
I see this kind of thing as a refactoring problem
and the first step is to examine the question space, in hindsight, and figure out how to cover it more properly
 
Heh, yeah
 
I feel like a good answer for "under what conditions will Python reuse an immutable object?" could mention the ID reuse gotcha, but the latter probably still needs to be a separate question. If you think that "Unnamed Python objects have the same id" question is good enough, might as well canonize it
My general feeling is that if we haven't already moved hundreds of links, canonical identification should not be thought of as set in stone. Closing a bunch of awful questions as a duplicate of a decent one, and keeping track of the decent one, is better than doing nothing while continuing to search for a good one. Later, we dupe the decent one to the good one, and reroute links. (That's what the SEDE query in the pins is for.)
-1
Q: Here the code is in python . . .but when try to run it . . it shows tk() module error. . . where is error? Complete code link given below

Yasir Imrancomplete code link:https://github.com/Yasir1515/Sorting-Algorithm-ng_Visualizer Error detail: .....(main) $ python3 sortingAlgorithmVisualizer.py Traceback (most recent call last): File "sortingAlgorithmVisualizer.py", line 13, in root = Tk() # Boots up the tkinter module File "/home/gitpod/.pye...

There are many variations of this problem in slightly different contexts. A proper canonical is needed.
stackoverflow.com/questions/73993034 The elif thing is proving to be surprisingly common.
stackoverflow.com/questions/30926758 This is sort of what I want, but backwards.
 
10:51 PM
stackoverflow.com/questions/73993190/… Another important missing general-technique question.
 
11:25 PM
 

« first day (46 days earlier)      last day (568 days later) »