« first day (3180 days earlier)      last day (1993 days later) » 
00:00 - 17:0017:00 - 00:00

17:00
@alkasm in that case, you should have a flag and a custom setattr that checks it
Yea, that's the nicest way I could think of doing it
class Scope:
    def __init__(self):
        self._entered = None

    def __enter__(self):
        if self._entered is not None:
            raise RuntimeError('%s was reentered' % self)
        self._entered = True
        return self

    def __exit__(self, exc_type, exc_val, exc_tb):
        self._entered = False
        del self.__dict__

    def __setattr__(self, key, value):
        if not self._entered:
            raise RuntimeError('%s is not active' % self)
        super().__setattr__(key, value)
@MisterMiyagi okay and by state you mean some combination of existing values, to make a new attribute
it could use the state for practically anything
for example, querying an external resource based on some connection information stored on the instance
@MisterMiyagi Yep, basically the same thing I wrote
17:05
another common use case is just to make attributes read-only
@MisterMiyagi okay example a connection object is a property, and it can be made read-only
@DeveshKumarSingh another common use case is to cache expensive operations so that they're only done once
these all are specific use cases in some scenarios, but yeah they are something to do with a class
you might want to try a tracer
https://stackoverflow.com/questions/54743805/find-previous-value-of-a-variable-in-python/54745181#54745181
not sure if you can do that neatly via a context manager
@DeveshKumarSingh properties need a class
oh that's a neat idea too
17:09
they do not work without one
@MisterMiyagi ohh yes, I forgot that criteria, that they apply to a method, and not a function
import functools
class LongProperty:
    @property
    @functools.lru_cache()
    def takes_awhile(self):
        time.sleep(3)
        return 5
here the first time you call long_property.takes_awhile it takes 3 seconds, but the next time, it is instant.
that's because of lru_cache decorator right? or no?
right, and the decorator needs to be applied to a function.
so what's the use of property here then
17:12
...the property lookup is now a function
it looks like a regular attribute
how would you get this behavior otherwise?
We're using a property here, so it calls a function (which can be decorated, and thus can have the lru_cache)
okay, so LongProperty().takes_awhile, once set to 5, is always set to 5
yes
very useful for lazy attributes
ya
"memoized" attributes
17:14
note that some internals such as object.__dict__ behave similarly
they are only created when needed
I never saw this usage in the wild though, interesting
you can also do it with your own Descriptor class, but the lru_cache works well too
I used it semi-often with database things
another approach will be this, but it's not as pretty
class LongProperty:

    def __init__(self):
        self.counter = 0

    def takes_awhile(self):
        if self.counter != 1:
            time.sleep(3)
            self.counter += 1
        return 5
Yep
and I guess using property you can set it to some other value, say 4 using property.setter
17:17
the point of property is that you hide the function call from your API
Alternatively something like
class LongProperty:
    @property
    def takes_awhile(self):
        try:
            return self._value
        except AttributeError:
            time.sleep(3)
            self._value = 5
            return self.takes_awhile
lol snuck in there, sorry @ParitoshSingh
haha, all good :) also cbg
cbg yo
ohh okay, are these uses of property something specific to python, or in general applied to any OOP programming language, because some of them sounds general
cbg \o
OOP concepts are general by nature.
17:19
Well, in most languages attributes can't be "faked" like that
but it's very common to use methods to get values
eg val = some_obj.getSomeValue()
but property in python is a very specific implementation of abstraction around getter/setter headaches
I am trying to understand the random variables from scipy.stats... does anyone have any idea how I can make a random variable that with 0.5 probability samples uniformly from 0..1 and with 0.5 prob samples uniformly from 5..6?
atleast that is my understanding of it. everything else is secondary.
the core point of property is that you as a user do not need to know whether a method had to be run to set a value first or not. you just want to use the value.
@DeveshKumarSingh many languages have properties, for example C# and Swift
the property decorator serves as the glue
17:21
@Anush step 1. pick a random number between 0 and 1. If it is < .5, then pick a random number between 0 and 1. If it is >= .5 pick a random number between 0 and 1 and add 5
the special thing about Python is that properties are not some language feature, but build on the more general concept of data descriptors
basically __getattribute__ of object is a lot more complex than people think
@Anush oh wait is there a class for this or something and you actually need to create some object with that property?
You can subclass scipy.stats.rv_continuous: scicomp.stackexchange.com/questions/1658/…
@alkasm ah that looks interesting.. thank you
@MisterMiyagi okay, than I won't go near it :) but yes, property and some of it's uses are more clearer now,
@DeveshKumarSingh Embrace the complexity of life, Devesh!
17:28
citation needed :)
@DeveshKumarSingh this might help. seems short and well written.
@MisterMiyagi lol this almost works, except you can't set self._entered in init if you can't setattr :P
@DeveshKumarSingh it is not per se difficult, but not documented (so you have to piece it together yourself) and somewhat impractical to re-implement in pure Python
@ParitoshSingh haha, the examples are picked verbatim from a video playlist I was watching about python, from Corey Schafer
@alkasm woops, forgot to special case that
I did the same thing and checked to see if you also forgot :P
17:32
should be if not self._entered or key != "_entered": in __setattr__
I always miss such details ^^
should be and key != "_entered" I think?
although for setting attributes can you only do
shifty eyes
 @attr.setter
    def attr(self, val):
and not
 @attr.setter
    def attr(self, val1, val2):
that is correct
17:34
so only one argument is allowed in the function decorated by setter
if you need more info from the user, you'll need to put it in as a method.
aah okay, is that a design choice
right, because you can only ever set something equal to a single value
a.b = c => b.setter(a, c)
that's true among the entirety of python
17:34
note that you can do a.b = c, d, which just gets you a tuple of c, d
okay, so if you want to use multiple attributes, pass them as a tuple and index them
sure?
i wouldnt do that though
or at least i cant think of when you'd want to
Actually I guess indexing does that.
@dimensions.setter
def dimensions(self, x_y):
    self._x, self._y = x_y
fine
we don't have up arrows here but take your imaginary updoot anyways
17:36
yes, as was my example before
class Point:

    def __init__(self, x, y):
        self.x = x
        self.y = y

    @property
    def coord(self):
        return self.x, self.y

p = Point(1,2)
print(p.coord)
p.x+=1
p.y+=2
aah right
If I want to set coord, attribute using x and y
yep yep, good examples.
I was thinking like, a.b = (1, 2, 3) and then doing some logic based on the (1, 2, 3) which would be weird
Which is why I gave the indexing example, as you are explicitly doing logic based on a tuple of args.
so something like
    @coord.setter
    def coord(self, point):
        self.x, self.y = point

p.coord = (2,4)
print(p.coord)
17:39
ya
looks good
okay I was actually doing self.coord = point there, but I guess that wouldn't work, but not sure why
it actually raised a maximum depth of recursion reached error
Because you are calling the setter inside the setter (which calls the setter which ...)
where did you do that?
It's a bad idea to have a property with the same name as an attribute
perhaps because dynamic attributes cannot be assigned like that within the class, they only refer back to the state which defines them
17:40
because setting p.coord involves calling self.coord...kevin'd by Paul
    @coord.setter
    def coord(self, point):
        self.coord = point
This here
guess what self.coord is ;)
yes, the method which is now a attribute due to the property decorator
ad infinitum
aah, it does say it here Calling property() is a succinct way of building a data descriptor that triggers function calls upon access to an attribute.
17:43
func fact: properties make a lot more sense when you realise python is a class-based languages that does not have a concept of dynamic instance fields
but then in this case
class A:
    pass

A.a = 1
@MisterMiyagi is that one of those "endomorphism of a Hilbert space" things? :P
Sam
Sam
Hey all - I've got an interview tomorrow for a ML Engineering position.. they've told me there's going to be some sort of programming exercise (in Python), and was wondering if there are any ML engineers about who have had similar interviews and can share there exercises? Trying to get a broad idea of what it is I should read/touch up on.. Obviously it's still highly unknown what it could be
@Sam hey, break a leg
Sam
Sam
Thanks dude
17:45
isn't a a dynamic attribute, since it was defined after the class was created
Sam
Sam
My last startup role fell through :p
@Sam good luck! What's the context? ML on what data? I am a computer vision engineer, if that's helpful.
@DeveshKumarSingh "dynamic attribute"?
Python attributes are as dynamic as it gets. But it's not a property if that's what you're trying to ask. No methods get invoked when you access or rebind it.
@AndrasDeak sorry dynamic instance fields, referring to @MisterMiyagi comment above
he literally said "python [...] does not have a concept of dynamic instance fields"
Sam
Sam
17:46
@alkasm Hey! The company uses text data and their product is based on NLP
@AndrasDeak okay, yes that's what it says in the definition of property
@MisterMiyagi sorry, what exactly is a dynamic instance field, in a language other than python
@Sam ic. I don't know much about that. I'm not an ML specialist but I've been asked generic ML related questions, mostly to do with CNNs though which I assume you don't touch much
I'd assume you'd get asked whatever the equivalent generic RNN questions would be
Sam
Sam
@alkasm I'd imagine the actual programming exercise is going to be something just in the ML space (I'd imagine also quite basic as its within a short time frame) rather than a specific domain of text processing, I hope. The company has NLP experts already
@AndrasDeak Yup, sucks!
Good luck Sam! i myself do not know what to expect in an ML Engineering interview, but i'd consider being familiar with pandas and maybe pyspark. I presume they'd probably want you to demonstrate your ability to navigate through data in some form or another.
17:50
Just from my perspective, I've interviewed for data science roles before but in a different area. In terms of coding for specific problems, I've been given the task in advance (like, a week) and then been asked to talk through it. I suspect most domain-specific coding would be too involved to do in the actual interview
I've been asked things like, "how should you tune <whatever> hyperparameter?" and other debugging things related to NNs, like "vanishing gradients" or "how to know if your step size is too large" or other things.
@Sam is the programming exercise like, on-site? or a take home problem?
I've never heard of anyone doing a real-time ML exercise for an interview
Sam
Sam
@alkasm It's on site. The format is do the exercise, then a face to face interview talking through the exercise
is it possible that it's simply a programming exercise?
Sam
Sam
@roganjosh That is also my suspicion
@ParitoshSingh yea this is my Q too, that sounds intense otherwise.
Sam
Sam
17:52
@ParitoshSingh Yup I suppose it is possible.. I asked HR if I should refresh my general Python or ML specific and they told me the exercise has a few ways to be solved
@ParitoshSingh Thanks dude :)
I mean, just to prepare, I'd say do whatever the NLP equivalent is to "MNIST handwritten digit recognition" for computer vision peeps
aka babby's first ML/CV network
but otherwise I would bet a normal programming problem, maybe with a twist that makes it relevant to you
e.g. maybe a programming problem with a finite state machine
i think it's more likely one isn't going to ask someone to build a neural network off of memory in any case. if they do, i personally would consider it a waste of time anyways. Essentially that's like asking someone to memorize syntax more than anything. the model portion is frankly just available online.
Which makes me suspect it might just be more of a typical programming question, especially considering if it's on-site and on-the-spot so to speak
Sam
Sam
Yeah that makes sense, I'll try to have a browse online to see what kind of exercises others have faced to try and get an idea
Some open ended potential candidates being things around string manipulation, or building a regex subset and so on.
You can see some examples of google interviews on YouTube
Sorry, this was the link I was really looking for, more formal
I suspect it would be along those lines
Sam
Sam
17:59
thanks, I'll check it out now
usually, the "ml" portions of the interviews i've gone through have always been verbal interactions or take-home problems.
Yea the only way I can see knowing how to build a network from scratch in an interview is if you're expected to be really comfortable with keras or TF 2 and allowed to look up docs and such as needed
though take it with a grain of salt, since my experience comes from my own country, and not USA or something
I was asked to live code something CV related in an on-site for the job I now have
but the problem was very relevant to my experience and I was also told I could use whatever resources I wanted (docs, stack overflow, etc)
that's a good way to do it, allowing resources for problems that involved
imo anyways.
18:05
Ya, it was more of a "lets see how you actually work in the domain you know with the resources you're used to"
I'm curious if you solved the problem?
in other words "how you will actually do your job"
The problem was "I took these two images on my phone, and they're on the desktop, stitch them together"
important note: I've done research and have quite a lot of stack overflow answers on image stitching and computational photography stuff
i presume it was a "solvable" problem still, and not exactly a "here's the project we needed to do in 3 months. let's give them as interview questions".
I did not finish it (because "finishing" would include like blending and all that) but I got them into the same coordinate frame.....and it totally didnt work
a+ would recommend
18:07
For my interview for the job before last, it was a combinatorial problem and I was given a week to solve it and submit the code. I actually misinterpreted one of the constraints and still got the job. I guess it's about the process :)
lol it was chill though. they were interested in seeing how I work, not what the result was. that's why they picked something directly in my domain and that I claim to know things about. was really cool tbh.
@roganjosh well, at least if the company is any good :D
True, that :)
Yet another asking about handling user input matching multiple possibilities: "Y"/ "y"/ "yes". I see lots of similar questions but can't find particularly good one as dupe target. Any offerings?
A process tip: ask lots of clarifying questions before you even start thinking about the problem. As like as not, some important bit will be left out, for you to either discover while designing or coding, or to resolve up front by asking questions. Second tip: don't leap right in to writing code. Take a few seconds to visualize what they are asking, what you will use to process the given data, and how you will navigate through to the solution. Then talk through it in conceptual terms. Then code.
6
that's a pretty good tip, thanks Paul, i will keep it in mind in my interviews too :)
@smci perhaps a generic dupe of how to use in like this and a comment saying use this dupe and think of multiple possibilities in a list
Sam
Sam
18:20
@PaulMcG Thank you :)
@DeveshKumarSingh Hmm, but that's a terrible target: a) the title doesn't make it clear whether it discusses string1 in list/tuple/set/collection' or element in list` or both. b) The code snippet sucks: if "0" in next or "1" in next: is silly, we're supposed to use in with a collection yet it avoids doing that, it manually expands into multiple clauses. Also next is a quasi-keyword and is a terrible name for a user input string(/list). c) The Javascript snippet sucks and multiplies confusion.
okay then I will find another question stating the similar concept
@DeveshKumarSingh That question's body actually turns out to be far less general than its general-sounding headline: "Is an if / in statement-ladder (in Python) the same as if() in Javascript?" But then the answers are more general and cover when next is a string, list, tuple, collection... aargh.
@smci I found another target and closed that question, check if it makes sense but I think that is not really a dupe target since it tells of one approach
@DeveshKumarSingh Aargh, don't mean to be ungrateful, but that one's just as awful for different reasons: a) the user is confused about the difference between if ("0","1","2") in sltn and if sltn in ("0","1","2"). b) Those choices are nowhere as intuitive to new users as ('y','yes','ok','affirmative'...). You can see some users there are confused that ("0", "1", "2") is not a tuple of integer, but of string. (also not a range).
18:30
@smci aah okay, there are other dupe targets as well related to in, also I added another comment which sort of leads the user to think of using in but if you want, I will remove the dupe vote to reduce any further concerns
Can it really be we don't have a decent asking of one of the most basic Hello, World-type questions?! I tried also searching for Python questions containing 'input','yes','y' and found 960 of them!!
most of them are very specific to the approach, since there is no catch-all approach for this
unless someone writes them all like this one from our very own!
@DeveshKumarSingh 960! of them! This is insanity. Get out the dropforge hammer. Time to pick a canonical. In the extreme case, if there isn't one please unclose today's reasking, reopen it, write good answers, then close the older dupe askings into it.
@smci reopened this one! unfortunately it's already bedtime for me, so I cannot help you much now, sorry
@DeveshKumarSingh "Bedtime for coherency..." G'night. Fighting against the tide, so we are...
18:36
but we have better authors here to write such catch-all answers like Kevin whose answered I referred
rbrb
A tragedy in one act --
OP: can anyone provide code that does <X>?
Me: the requirements are so vague that nobody could possibly give you functioning code right off the bat. Refine your problem statement and give us an MCVE while you're at it.
OP: ... So, can anyone provide the code?
I don't know Anyone personally but I hear they are going on strike.
Someone might pick up the slack if they are so inclined
I feel bad for OP since he's working with a poorly documented file format from the dark recesses of the medical industry, but no amount of pity will induce me to play who knows how many rounds of "try X. Oh, that didn't work because of a quirk of the data you didn't mention before? Try Y"
Yes! because you'd much rather play several rounds of "You:Please provide an MCVE. OP: MCv... what?"
@DeveshKumarSingh so I retitled and edited that asking into How to use Python 'in' operator to check my list/tuple contains each of the integers 0, 1, 2?; also deleted all the chatty and extraneous bits. That OP confuses a) list, array and tuple b) integers 0,1,2 with strings "0", "1", "2" c) Testing if x in tuple_of_string with if tuple_of_string in x...
..Pretty much confusing everything in sight. Ah, but we all have to start somewhere...
18:47
@piRSquared he misspoke. He meant to say min-reprex. I assume it's all clear now.
Deep thoughts: It's impossible to skip breakfast. Breakfast is the meal in which you break your fast. Therefore, whenever you've fasted, your next meal will be breakfast. That's like saying you can miss your next meal... But, I guess you can if you're dead. But skipping implies that you achieve the thing after what was intended to be next...
@piRSquared thank you
That was deep.
Yw, I'm trying to enrich the community
@piRSquared Kevin has started to rub off on you :)
18:52
Don't insult @kevin like that! Do it a different way.
@smci So is that a good dupe target now? Or you just wanted to remove the clutter from that qs?
@DeveshKumarSingh I keep getting visions of the flamethrower scene at the end of Aliens, and how the queen screams and hisses as the flames lick over the evil eggs...
@piRSquared Well I don't see a lot of philosophically aligned folks here than him, so it was a compliment, although could be mistaken as a back-handed one, but not my intention
@smci then you need a break from SO
Mealtime fact: "noon" used to mean "the ninth hour of daylight" aka 3 PM, but people moved it backwards to 12:00 so they could have lunch earlier.
and we're back :)
18:56
> In monasteries and on holy days, fasting was ended at nones, which also perhaps was incentive to push it forward. Or perhaps the sense shift was based on an advance in the customary time of the (secular) midday meal. Whatever the cause, the meaning change was complete by 14c.
@DeveshKumarSingh But like, the OP confuses integers with strings (which is half his/her issue), tuples with lists (which is irrelevant here, but they think it's part of the cause) and if x in y with if y in x and all(xx in y for xx in x) (which is the other half of the issue, but they weren't ever going to find that, because they confused tuple/list-of-integers with tuple/list-of-string).
@Kevin 3 PM is perfect
I read that message and looked at my system clock and it stayed at 2:59 for one second before ticking over to 3:00. Nice synchronicity there.
@smci , yep I looked at the edit, and yes it's bad
@Kevin East coast then?
Yeah.
19:02
Nice, been there a few times, especially NY and Boston, they have a big city vibe
unlike Bay Area which was more low-key
As the largest city in the US, it would be hard for NY to not have big city vibes
All: why doesn't slice have a __contains__ method, it doesn't work with in operator? Seems counter-intuitive. (Per my comment on How to check if all elements in a tuple or list are in another?
3
Q: Why doesn't Python3's range/slice object support containment testing for other ranges/slices?

Pragy AgarwalPython3's range objects support O(1) containment checking for integers (1) (2) So one can do 15 in range(3, 19, 2) and get the correct answer True However, it doesn't support containment checking b/w two ranges a = range(0, 10) b = range(3, 7) a in b # False b in a # False, even though every e...

Wasn't aware of either the issue or the question. I'd expect slice doc to tell you it doesn't.
I vaguely recall that I asked something like that in here before and the answer was "because it's hard to come up with a definition of slice.__contains__ that doesn't exhibit confusing behavior in corner cases"
In particular things get hairy when slice has negative arguments
19:20
From a question: "So I went to good old trusty w3schools, their stuff usually works with no hassle." Oh my :(
@Kevin Ok but we could easily subclass slice and/or monkey-patch a __contains__ onto it. Do I care about the corner cases? (for a finite range of integers with length < 1e6?) Oh, negative arguments. I can see why stop<start and negative step is pain, but you can just swap (start, stop) and take abs(step). What other corner case do we care about?
take it as you wish to, but w3schools did help me with one thing. Understanding the "3 pillars" of webpage design.
>>> a = slice(5)
>>> b = slice(-10, -5)
>>> x = range(10)
>>> y = range(20)
>>> x[a] == x[b]
True
>>> y[a] == y[b]
False
@roganjosh Ditto, w3schools is plain, clear, direct, fairly complete and always has good clear examples. (which Doc.SE and much package doc sure ain't) EDIT: I thougnt w3schools only did HTML/CSS/JS
Sure, like their arrays docs
19:24
for everything else, w3schools was always so insufficient. It's very superficial
So we can't base __contains__ on anything like "a is a subset of b if you could plug those slices into a list of sufficient size and the result of one is a subset of the result of the other"
arrays. oh dear
@roganjosh EDIT: I thougnt w3schools only did HTML/CSS/JS, wasn't even aware they covered Python. Well if it their Python doc sucks, send them some docbugs/suggestions.
They know their error because they put it in its own little box at the top, and then just talk about arrays anyway
i am now trying, and failing to track down what article/tutorial i read that made everything click re webpages
19:28
W3Schools comes up on top a lot in my frontend searches but I really do just skip all those links unless I can't find something better
Well, I say they know their error, but "Note: Python does not have built-in support for Arrays, but Python Lists can be used instead." is wrong in multiple ways.
@Kevin Sure, but I only asked about slice objects, not slices, or the semantics of slicing when the indices are negative (whether x[a] == x[b]). My point per my comment on How to check if all elements in a tuple or list are in another? was you could kludge a slice object to get a fast compact membership test instead of set(), for testing contiguous integer range1 in range2
@roganjosh Ah, ok, fifty lashes. I don't ever see w3schools in my Google searches, I just use site:stackoverflow.com ... <keywords> to exclude all the other crap.
@Kevin (yes, the semantics of slicing with negative integers on a collection is "numbering backward from the end"). But that behavior isn't about slice objects per se, which was my question.
They, with good reason, probably shouldn't come up for Python searches. They come up a lot on my HTML/JS searches and then it could be confusing for people coming from that space into Python. I think it was PM 2Ring that was also less than happy that their name piggybacks on W3C to make themselves sound more official. Combine those factors and I don't trust the source.
Here's what I'm hearing:
- "If you have two slice objects with positive arguments, you can determine whether one is a subset of the other in O(1) time". I agree with this.
- "This is a useful thing to do and it's not trivial to roll your own solution". I agree with this.
- "`slice.__contains__` should be modified to do this". I don't know about this.
True for their Python contents. But as to naming, they didn't call themselves 'W3C...', only 'w3schools', and 'w3' is generic terminology, almost like 'webschools' or 'netschools' or whatevs. I mean if you want to make mischief, could register 'ICANN_has_a_cheezburger' ...?
<-- thought they were something along the lines of an authoritative source
19:41
Just wondering: what's the reason for the 200 reputation cap per day? You would expect: the more answers the better, but there's probably some logic I'm missing?
minimal upper bound on addiction
though most folks can spend a full 24 hours on SO without earning 200 rep
arguably if there was no rep cap then the worst addicts wouldn't sleep at all
"wonder if I can beat my 1420 rep record this time" *snorts a triple dose of coke*
it probably wouldn't harm answer quality though...
I think I've hit my cap once. I think it's to avoid point brigading or something
I would be one of those @AndrasDeak :)
19:49
@DeveshKumarSingh Also a good question is Asking the user for input until they give a valid response, although that mainly is about how to do the control structures (while-loop); it doesn't require or ask about how to test for multiple values; although some answers illustrate that.
Nah, but still the cap could be a bit higher imo
when you feel hindered by the rep cap it's a good time to reflect on whether there's really all that many good questions to answer on Stack Overflow
though SO is going down anyway so I guess it doesn't really matter
20:06
Regarding to a linked list queue, what is the first and last node in the queue most commonly referred as? I have seen so many instances now ... for instance
head/last
front/rear
start and end. first and last sound acceptable too.
Yeah, but is there a "universal standard" or something.
I find myself changing it quite often, I would like to stick with two terms
not that i know of.
Most universal standards don't exist
@SebastianNielsen how often do you have to implement linked lists in python?
Not that often, but I have to choose such "terms" a lot, now that I study computer science.
And the different datastructures
20:11
For future reference, make sure you stick to python-specific and truly language-agnostic problems here
@AndrasDeak I kinda admire your dedication to the edits there for something I think should be closed :)
I did the first round of editing, but when the OP didn't address any comments in the edit, I just can't find the energy :/
someone else might edit the obvious things later when it's closed, using up OP's one chance to get the question pushed into the reopen queue
Gah, I'm good at forgetting about those mechanics of the site
20:37
And I'm good at never knowing them.
Cabbage. I'm catching up on the transcript. I see that @Kevin was talking about the Coupon Collectors Problem a while ago. That Wikipedia article has changed since I worked on this problem several years ago. It didn't have the generalised version, where you want m copies of each of the n numbers.
21:13
dupe needed Trying to install packages using pip in Linux, getting Permission denied: on /usr/lib but again, I can only find bad targets, not good ones.
@SebastianNielsen "head/tail" is what I learned (in Stanford CPD courses)
@MisterMiyagi "that's all fun and games until someone picks an RNG with too low period" Sure, but the standard PRNG is Mersenne Twister, which has a period of 2^19937-1, so it can generate all permutations of a set of over 2000 items.
I imagine the -1 is very important ;)
@Erfan Rep cap limits the hyperinflation of points that can occur when a question goes on the Hot Network Questions list. Even with the rep cap questions and answers get inflated scores from the HNQ effect, but without rep cap it'd get ridiculous.
Does the HNQ predate the rep cap?
if I had to guess I'd think the HNQ is a new-fangled thing (but I wouldn't know)
@AndrasDeak Yes, it is. :) 2^19937 has lots of factors, but 2^19937-1 is a prime number.
21:28
Ah, tricky. Mersenne prime, I take it?
@AndrasDeak Not sure. But in the early days of SO, when the site was shiny & new, and the user population was growing rapidly, the front page was almost a HNQ list anyway.
@AndrasDeak Hence the name.
@PM2Ring I see, that makes sense
There's nothing wrong with good answers (& questions) attracting points, but when the HNQ effect is operating the points accumulation quickly snowballs, and so early ok answers can easily get far more points than they deserve. And then when a more thoughtful superior answer comes along later, there's almost no chance for its score to catch up with the HNQ rockstar answers.
22:03
I see, thanks for the clarification. What is a HNQ exactly? @PM2Ring
Hot Network Questions
 
1 hour later…
23:07
Anyone aware of a difference in mro between Python 2 and 3 with namedtuple in an inheritance tree? Someone seemed to have something like this demonstrated at work, and I'm not sure where to start to try to recreate the issue...
you mean inheriting from namedtuple?
Yeah, like
class Foo(namedtuple('Foo', 'attr')): ...
ah, for some reason I thought that was a weird thing to do, but even the docs give an example for it
and then
class Bar(AMixin, Foo): ...
docs say the first is fine, but if I recall, the second is warned against...
the only caveat I could see after a quick skim is "Subclassing is not useful for adding new, stored fields. Instead, simply create a new named tuple type from the _fields attribute:"
23:14
was looking at the mro, and it was slightly different between 2 and 3...
If I recall correctly, the mixin came second in 3...
Can you compare the hacky code generated for namedtuple in the two cases?
I think in 3, it's created on the C layer...
thus verbose argument is gone
cabbage
@AaronHall long time no see
@Code-Apprentice what's up?! :)
Not much. Doing some Android programming while I'm on vacation
23:22
The ball card organizer, right?
I went through my ball cards a couple of years ago and threw them all away. They were far from pristine and mint ones were available online for a buck...
> Changed in version 3.7: Remove the verbose parameter and the _source attribute.
@AaronHall yup, that's the one. People pay me money for it, so I have some small motivation to release updates.
...very small
00:00 - 17:0017:00 - 00:00

« first day (3180 days earlier)      last day (1993 days later) »