most likely this: if k not in d or d[k] is default
I just meant to give any example of dict.get
usage, doesnât matter which one or the quality of it.
most likely this: if k not in d or d[k] is default
I just meant to give any example of dict.get
usage, doesnât matter which one or the quality of it.
Well, I wouldnât be able to use it until 2029, as I want my code to be backwards with the most supported versions (if itâs not too difficult to support it). But that doesnât mean Iâll never use it. For example in 2027 Iâll finally be able to re-use quotation marks in f-strings.
Not everyone writes backwards compatible code, and for those people it would be useful. I do realise we need to find them thoughâŚ
The only thing I can benefit from today are performance improvements or things that can be backported.
Sure, but if youâre trying to say that you wouldnât use it, at LEAST try an example where you logically would
This still doesnât disprove Paulâs statement though. If youâre proposing things that you wouldnât even use in your own library, itâs going to be VERY hard to convince other people that it should be added to the language. With dict.get
, a lot of other people do use it, but the fact that you donât use it doesnât dispute that.
This is not what I was saying at all. What I meant is.
If:
list.get
is a bad construct and I shouldnât use it.list.get
shouldnât be in the standard libraryThen:
dict.get
is in standard library and I use it.dict.get
is a bad construct and I shouldnât use it.Itâs the same reasoning in reverse, nothing more.
You have the logic backwards, though. Itâs more like this:
list.get
a good construct?Versus:
dict.get
a good construct?You can try to argue that something is a good construct despite you not using it, but you have to prove it in some other way. Whereas with dict.get
, all you can show is that YOU arenât using it - but with so many other people, we have sufficient evidence.
That is not what I am saying. You misinterpreting my reasoning and turning it into something ridiculous. I will try one last time.
list.get
in standard library.Your argument: âThen it shouldnât be in the standard library, because you donât implement it for your own usageâ
My contra-argument:
dict.get
, which is in the standard librarydict.get
should not be in the standard library.Result: Your argument is invalid.
You have to convince people that itâs worth having in the standard library.
Iâm not going to prove to you that it SHOULDNâT be in the standad library. You have to prove that it SHOULD.
Part of proving it is proving that your arguments against it are invalid.
This was NOT my argument why it should be in the standard library. This was sound reasoning why YOUR argument against is INVALID.
No. Part of it is making stronger arguments in favour of the proposal.
State your arguments for why it should be in the standard library. At the moment Iâve heard âbecause I want it to beâ and âI would use it if it wasâ. Youâve been asked whether you need the functionality enough to implement your own local version in the absence of a stdlib implementation, and you have said ânoâ. Thatâs fine - although the implication of the question is that the arguments youâve made so far arenât compelling (and I brought the issue up in a good-faith attempt to help you strengthen your proposal, by the way).
So do you have any other arguments, or are you going to leave it there (on the understanding that the response so far hasnât been overwhelmingly positiveâŚ)?
I do want to point out that trying to argue with people providing invalid arguments is exceedingly annoying and is not going to make people want to provide arguments of their own.
If you are just going to shoot down arguments with nonsensical statements itâs not worth the effort to try. Ofcourse, you (@pf_moore) havenât done that, but defending clearly invalid arguments like the one provided by @Rosuav is not going to result in good discussions.
I am personally weakly in favor of this proposal, but my primary point right now is that neither side should be using invalid arguments, especially not after it has been pointed out that they are invalid.
(and yes, it is an invalid argument, specifically of the hidden-assumption kind. It assumes that âany idea worth using when itâs builtin is also worth using as a custom functionâ, which isnât true (at least not obviously). Syntax and performance difference can be big enough to make a difference)
Please donât put words into my mouth. I did not say that.
Exactly! Thatâs the point, that makes it an hidden assumption. You assumed it, but didnât state it. Or you assumed something similar, which you also didnât state. There is a gap in your argument structure which you are somehow bridging in a way that is probably obvious for you, but isnât obvious to everyone else
Neither of you or Chris are following what I am saying. It is hard to prove anything when other party refuses to take time to understand.
For any problem to reach its most optimal conclusion it takes 2 interested parties patiently and respectfully following the course of conversation.
What happens now is that Chris liked your comment 5seconds after you wrote it. Either you two are married or Chris can read at the speed of light. You both treating it as a fight that you have to win, not an opportunity to discuss.
I just came to correct logical mistake on your side of argument. I am not even invested in this. And Chris started attacking me personally out of the blue. Using capital âYOUâ, âYOUâ, âYOUâ, etc.
No, I didnât. But, I donât think thereâs really any point trying this meta-meta-argument here. This thread is not benefiting from further posts from me, and I shall bow out.
I stand by my previous posts: it is not for others to prove that this does NOT belong in the core/stdlib, it is for those proposing it prove that it DOES. There are no hidden assumptions here, this is a simple fact.
I completly agree, and I never argued against that. And I still stand by my previous posts.
Nor did I.
For the people who think weâre âmaking bad arguments against the proposalâ Iâll repeat what I said:
If you write your own version, and then find that you donât use it (because itâs not worth the effort to import it, or because what you need isnât quite the same as the version you wrote, or for some other reason) then maybe the idea wasnât as good in practice as you hoped it would be.
I offered a reasonable way to validate the usefulness of the idea. @dg-pb chooses not to do that - thatâs fine, it just means theyâve lost an opportunity to strengthen their argument (by demonstrating that writing their own version didnât go the way I described). Going on from there to claim that Chris or I are somehow trying to say âif you donât implement and use your own version, your proposal is clearly worthlessâ is a heck of a leap, and is not something I appreciate (and I imagine Chris doesnât either).
I suggest all parties stop posting for a while and take a breather. At best weâre misunderstanding each other, at worst our frustration is leading people to arguing in bad faith.
Finally, no I am not going to prove anything to you. I hope we all together can slowly decide what is best. But you arenât helping it at all.
And all I did was kindly replied that âThis can be a good test, but donât think this is decisive factor for all cases (not even majority in my case).â and gave an example why not.
All what happened afterwards from my side was just defending against some nonsense.
This idea would be really useful for me, but I havenât implemented it even once. There are few reasons for why I think this happens:
The alternative is not that bad, and people are used to it. It would be much nicer if I didnât have to write an inline if-else, but thatâs a pretty standard syntax, so Iâm not going to go out of my way to implement it if this only happens once or twice in a project.
I canât just âimport it onceâ. I work in a lot of different environments, projects, machines, and this is one of those ideas that probably wonât happen a lot of times in a single project, but happen once in most of them. I also use this a lot when writing very short scripts in which I donât bother to write almost any function. This is especially useful to me when sanitizing messy data, which I often do in 1-time migration scripts.
From my experience (and maybe this depends on who youâre working with), people arenât that happy when you add general utilities to a projects, and the potential pushback usually just prevents me from implementing it. Usually this happens because these utilities donât have a good place to put them in, and a lot of people are against util files. Another reason for pushback is that the inline if-else already happens in other places, so consistency wins.
Iâm in favor of this idea. I do recognize the value of your test, but I donât think itâs perfect, and at least for me, it doesnât work here.
One argument against this proposal that I havenât seen is the benefit of having small interfaces, which include:
Also, this idea is to add .get
to list
, but it is much harder to add it to collections.abc.Sequence
, which means that either other sequences will have fewer methods than list
(an unfortunate inconsistency), or you have to add it to Sequence
, which is hard.
Also, I how often do you think youâll really reach for this out of 100k lines of Python? Maybe 10?