« first day (2995 days earlier)      last day (1954 days later) » 

6:11 AM
Cabbage Peaches and Pears, Potato. Banana? It'd like to present a Python library that combines many Python functions into one. Melon, melon, watermelon. Please asparagus improve this library here. Avocado? Melon.
 
The issue with attempted panacea modules like yours is that they will never be able to cover enough use cases to be sufficiently useful. I would stick to doing one thing, and doing it right
Not to say I don't commend what you are trying to do.
 
6:32 AM
cabbage
What does quilt do @RichieBendall?
 
 
1 hour later…
7:56 AM
cabbage - this raises an AssertionError, what am I missing?
from typing import NamedTuple

class Location(NamedTuple):
    row: int = 0
    col: int = 0

if __name__ == '__main__':

    p0 = Location()
    assert isinstance(p0, NamedTuple)
 
@ReblochonMasque Have a read of the docs: quilt-lang.richie-bendall.ml
 
I did, that's why I am asking.
 
 
2 hours later…
9:44 AM
@ReblochonMasque In typing.py there's 'NamedTuple', # Not really a type., but can't find a good explanation from the docs. Long story short, the meta machinery results in an mro that's based on tuple.
There's of course the description "Typed version of namedtuple" and named tuples state that "Returns a new tuple subclass named typename."
 
Thank you @IljaEverilä - yes, I suspect something like what you said..
namedtuple and now typing.NamedTuple are a constant source of frustration, and, dare I say, disappointment.
 
Hmm, it really just calls collections.namedtuple() underneath when constructing subclasses. :)
 
10:03 AM
@ReblochonMasque Wim mentioned this "feature" 6 months ago
Jun 8 at 20:02, by wim
>>> class Employee(NamedTuple):
...     name: str
...     id: int
...
>>> issubclass(Employee, NamedTuple)
False
Ah, I see Ilja's 2nd link is to an answer by Wim from that time period. Oh well, I should've checked the links before attempting to wrestle with the flaky Chat named search function. :)
 
10:20 AM
ok, thank you for the additional references and explanations @PM2Ring & @IljaEverilä , appreciated.
It still feels like a complication that should have been prevented...
 
It's an unfortunate wart. I guess it's semi-tolerable because Python coders generally use duck typing & try to avoid explicit isinstance checks. And now we have datatypes. But still...
 
yes, it adds to the special cases & gotcha to remember, and pay attention to.
I think I'll use a dataclass, and be done with this.
 
10:56 AM
I just saw something weird on Astronomy.SE. The OP VTC'd their own question. I didn't know that was possible, apart from dupes.
 
What is the name of "manhattan distance" when diagonal moves are allowed? I found minimum bound distance, but is there a better name?
 
@ReblochonMasque Is there a formula for this distance?
 
def min_bound_distance(p0, p1):
    """return the distance on a grid allowing diagonal moves"""
    return max(abs(x0 - x1) for x0, x1 in zip(p0, p1))
I tested in 2 and 3D - I think it generalizes to nD
 
ah, i assumed diagonal moves would still cost 2^(1/2) instead of 1, now i understand
 
cool, thank you @PM2Ring Chebyshev distance follows the Moore neighborhood, indeed.
 
@PM2Ring though I'd expect that for non-dupes OP doesn't have a binding vote
 
11:17 AM
No worries. I couldn't remember Chebyshev distance, I found it via the Moore neighbourhood page.
@AndrasDeak Ok. Still seems weird though that the system permits it, and that an OP would VTC their own question. But that OP has a track record for weird. ;) My guess is that he has some deep-seated misconceptions which cause him to misinterpret stuff he reads so that it fits with his wonky worldview.
 
@ReblochonMasque Quilt is a Python library that lets you write less code to do more things. The list of commands can be found here
 
Thank you @RichieBendall
 
@PM2Ring I'd say closing your question is model citizen behaviour
It's just rare that an asker sees the votes in time and gets convinced
 
 
2 hours later…
1:30 PM
@MartijnPieters would it be deemed acceptable for me to place a bounty on an old question I recently wrote a canonical answer to, to draw attention to it?
 
@coldspeed, you have a link to your answer, I would like to take a look.
 
@ReblochonMasque I recently wrote an answer for How to deal with SettingWithCopyWarning in pandas. I see so many posts by users who get the warning, happen upon the post, read the answers, and still don't understand why/how the problem occurs and how to best solve it.
 
Very nice, thank you!
 
The hope is that the number of questions being asked, re-asked, and answered with the same rehashing can reduce if my answer helps users understand the problem better.
Thank you :)
 
1:47 PM
@coldspeed another thing I wanted to get around to doing but haven't... edit the pandas tag wiki. You can layout these canonicals and others there.
 
@piRSquared +1, the tag wiki is in serious need of some editing. I will make that my next course of action.
 
2:13 PM
@coldspeed sure, but be prepared for some members of the community to react with downvotes, as some members of the community see drawing attention to a question because you answered it as 'cheating' somehow.
 
3:12 PM
Yup
 
 
3 hours later…
6:39 PM
clearly there is a misconception against putting bounties on your own posts, someone needs to raise an issue on meta and get a community concensus
 
Sounds like a good opportunity for a hat
 
wim
>>> import numpy as np
>>> class StareIntoThe(np.void):
...     dtype = np.int32
...
>>> np.dtype(StareIntoThe)
[1]    14598 segmentation fault (core dumped)  python3
 
Indeed. I already have both meta hats, so if for the sake of the hat, I can yield to someone else...
 
wim
7:03 PM
How are you so sure others have the misconception and not you?
 
@wim I'm not sure I follow. Martijn said it was not a problem, and unless Martijn is wrong, then people clearly have negative perceptions about posting bounties on questions you have answered.
it is just like the issue of hammering using your own question as dupe; regardless of how justified it is, if there is a conflict of interest, people are going to make a sour face about it
 
wim
7:20 PM
fwiw, I don't think there's anything wrong with your bounty, personally. But other people are free to disagree, and it's arrogant to immediately label them as misconceived. People just disagree sometimes, and that's OK.
And I think you misrepresent what Martijn said. He actually said you can probably expect downvotes, which is quite the opposite of "not a problem" and more like "some people will have a problem with that".
 
perhaps "misconceived" was not the right choice of word use. I am trying to say that there is a lack of consensus in the community regarding this matter, so opening a meta post to clear up the confusion would really help.
what is right and what is not, different people have different views so having the community discuss it is all I was suggesting
 
wim
Because opening a meta post always brings everyone into agreement? ;)
 
I didn't mean to sound arrogant and I'm sorry it came across that way
@wim maybe not, but hey it's worth a shot, right? :P
 
wim
sure
Or for a similar kind of thrill, you can throw a steak to a pack of hungry dogs and watch them tear it to pieces
 
meta is weird. The traction you receive on a post depends on the opinion of the person who posts the first answer.
at least, from what I have seen in my limited time here
 
wim
7:57 PM
yeah. I have noticed similar.
 
 
1 hour later…
8:59 PM
@wim finally got around to fixing day 20 gist will get around to the rest of AoC and updating github later.
 
wim
oh neat, you've still got 4 days of fun ahead (and 1 day of pain)
 
9:26 PM
afternoon cabbage
 
10:00 PM
@wim so what's going on there? What is dtype supposed to do when fed a custom class?
is this about the mismatch between the arbitrary size of the void parent class and the monkeypatched dtype attribute with a fixed size?
 
wim
10:18 PM
it already fixed upstream so .. meh github.com/numpy/numpy/pull/12254/files
user seems to claim that open('list.json') returns a file pointer but open('list.json', 'r') returns a string
 
wim
yeah I understand, it's just a somewhat weird expectation
 
wim
10:33 PM
it would be nice to have a more effective way of spanking users that answer questions before they are in an answerable state
(their well-intentioned answers just block the roomba)
 
that's why you have delvotes
 
wim
not really - I can't delvote that. And by the time I can, I won't see it again
 
I meant the answers
> You may vote to delete answers in the following cases:

The answer is extremely low quality: There is little to no scope for improvement
The answer doesn't attempt to answer the question; it may be a comment or a separate question altogether.
I wonder if "based on guesswork and provably completely wrong" counts as "extremely low quality"
but there's always scope for improvement by rewriting the answer...
 
11:17 PM
Modestly improved rendering Day 20 Gist
 
11:45 PM
@wim question's been edited, now it's more or less an elaborate "why can't I reuse a consumed iterator" dupe (with the exception that files can be rewound)
 
wim
nice ascii pipe work
 
bit late for "eleven pipers piping", though
 

« first day (2995 days earlier)      last day (1954 days later) »