« first day (3665 days earlier)      last day (1507 days later) » 

00:15
Does anyone understand this OP pandas true outer join?. Per my comment, OP seems to be asking for a columnwise concat, but insists on misnaming it an outer join(?) Do we leave this open, try to elicit OP to clarify/edit via comments, or cv-pls as Unclear? (or Dupe?)
 
5 hours later…
05:09
Anyone having suggestions on this table extraction procedure. stackoverflow.com/questions/64535422/…
@TaimorrMughal yes. For sthe ake of all the good in the universe, please let Python 2 rest in peace already</suggestion>
@AnttiHaapala Yeah. probably the suggestion is well recieved.(!)
05:39
and sorry bout the typo
@smci I submitted a different duplicate candidate now
06:42
@TaimorrMughal Can you rerun under Python 3.x and edit the output into your question?
06:58
If I wanted to form a graph similar to a exel spreadsheet with times throughut the day along the y-axis and other info along the x axis sort of like colouring in the cells of an excel spreadsheet what library would you use
 
1 hour later…
08:19
@smci Updated
08:33
I'm guessing this is a duplicate, but I can't find as good canonical stackoverflow.com/questions/64568911/…
anyone have some experience with docker ?
No, but I really want to try it out sometime
yes u should its cool
08:47
@MadhawaPriyashantha yes, but is your query related to Python?
08:57
@tripleee seems like even the SOPython canonicals are all rather niche and hard to make the connection. Perhaps we should make a proper canonical for it?
good plan, any volunteers?
Wouldn't mind spending some time on it, but never made a canonical.
09:40
Cbg
How do I login when a page prompts me the browser built in login page with requests? I can't seem to figure out what login url it is calling or at all how to pass credentials using request. I have no problem login into websites with a login page with requests, but I can't pass browser based logins
you mean those small popups that ask for username/password?
yes
All I find is something along the lines of this: stackoverflow.com/questions/38995078/… Which works, but not for these annoying little popups
No idea how to actually do them with requests, but I guess these are RFC 2617 HTTP Authentication. Searching for that might bring up something worthwhile.
Lol, thanks this made me find this: requests.readthedocs.io/en/master/user/authentication It's like the first auth example. I guess I should read the docs before trying google
10:01
Am I crazy or did earlier versions of python strings have a .contains("foo") method?
10:13
@Hakaishin you're crazy
who else is on stack overflow just waiting to fix someones problem?
@ParitoshSingh cbg
how do you guys deal with OP ignoring your answer and commenting on a near identical answer as yours that was posted after yours?
actually something similar happened to me
well ... I did nothing
10:19
I will too ignore the OP :P
I was kinda angry
but thats it
did nothing
my answer was complete, even though OP expected just the last line, and the other answer had some "no op" eg sorted([i for i in seq])
The purpose of the site isn't centered around the OP, if your answer adds value then hopefully it will be useful to others who see it.
seq was a list to begin with
the rep hunter within me wants to say no 3:)
Once you recognize that, then it should be pretty easy to realise that the best option is to just move on, and not dwell on it too much
10:22
but I guess yeah, I have found other answers more useful sometimes, thanks
anyways is someone trying to binge? solve problems
because its kinda fun
Thats good to hear. :)
hmmm, must have been some very old memory from the bachelors, I just checked and Java has it
better java than python, i like my in more!
@Hakaishin yup, insanity
10:26
there's also a pandas str.contains that might have thrown you off.
@ParitoshSingh ah no it was probably that before java
 
1 hour later…
11:57
@Hakaishin Pandas has it, so maybe you were thinking of that
Oh, Kevin'd by Paritosh, oops
How've you been Paritosh? Don't see so much of you these days. Well I hope?
12:18
I've been good, all things considered
Glad to hear it :)
12:58
Does somebody know if there is something like configargparser for c++?
morning cabbages, folks
 
1 hour later…
14:14
In the area of package management things go out of existence so fast. It's crazy how fast tools become obsolete and actually produce more work when you try to use them, instead of sticking to bare bones and building your own things on top of them
aside from "it depends on the corporate culture", does anyone have any opinions on leaving exteraneous comments in commit messages? I just pushed "I need a coffee break" as part of my commit message in one of MANY commits in a branch that'll eventually be merged. I'm all for "keep PR commits clean", but I feel like joking around should be somewhat more ok in smaller commits. Anyone have other opinions? I'll read when I get back with coffee
When I am benevolent dictator over all technology, packages will never become obsolete. If your software breaks, my special agents will escort you to a secure location so you can work on the bug list with no distractions, for as long as it takes
Tip: avoid the responsibility of unlimited maintenance by e.g. creating an "HTML 7.0 parser" rather than an "HTML parser". That way, when HTML 8.0 comes out, it's not your problem any more.
@inspectorG4dget I like my commit messages like I like my mullets. Business up front, party in the back.
In other words, the first line should be explanatory and boring, and the rest can be whatever you want
14:32
@Kevin <3 I love it
@inspectorG4dget I like clean commit messages. Just what happened. Use chat for goofing with coworkers
I imagine that life under my rule will be a lot like it is now, and in practice very few people will be taken away to the secure location. The biggest difference is that people will be very very clear about what their package is intended to be interoperable with.
So rotten old packages will still be around, but you'll know right away that they're rotten and old because they'll say "compatible only with jpegs created before 2014" or what have you
@Kevin yes, It's like look I dont care if your tool doesn't work with what I need thats fine. But I hate to install and start using it to find out it doesn't.
@inspectorG4dget my commits in our internal puppet repository regular have the three commits "typo", "typo..." and "now that was embarrassing". Usually over the span of one minute.
I've got some "welp! that was a waste of an hour" in the explanation. The first line is typically very to-the-point so that it's clear what's happening, when it comes time to merge or go back in time
@Hakaishin is there a similar argument to be made along the lines of "sterile cockpit" vs "pilot chatter", though?
@inspectorG4dget not sure what you mean
user14520680
14:48
what will come in python 4?
@expressjs123 Almost certainly nothing special. The devs say they're not saving any big changes for 4.0 or anything.
user14520680
oh so it's just the version afte 3.9?
Yeah
user14520680
that's sad
@Hakaishin civilian pilots are mandated not not chit-chat while under 10k ft, in what is called Sterile Cockpit. The idea is that there's too much going on and attention needs to be focused. But beyond that, they're free to chat about whatever, roam about the cabin, high-five passengers, etc. Is there a similar argument to be made here (Kevin mentioned "Business up front, party in the back", for example)
14:50
Do you guys clean up your dev virtualenvs? Like I'm writing a deployement script and I'm just realizing how much junk I have of packages I don't need anymore
> My current expectation is that Python 4.0 will merely be "the release that comes after Python 3.9". That's it. No profound changes to the language, no major backwards compatibility breaks - going from Python 3.9 to 4.0 should be as uneventful as going from Python 3.3 to 3.4 (or from 2.6 to 2.7). I even expect the stable Application Binary Interface (as first defined in PEP 384) to be preserved across the boundary.
-- core developer Nick Coghland
user14520680
well we had 2.7.18, and no 2.8?
@Hakaishin oh! coworker is religious about pipenv and keeps it as part of the git commits. This is the preferred way of managing requirements
@inspectorG4dget Yes totally. Commits are for me just not the place to have banter/noise/fun. Neither is the code. Programming is hard enough.
@expressjs123 the version after 3.9 is 3.10. There's already a release schedule for it, AFAIK
14:52
@inspectorG4dget wait like the whole pipenv or just the requirements txt?
@Hakaishin wait, not even silly comments in sourcecode? How about intentionally humorous wordings of real/important code comments?
@Hakaishin I see a Pipfile and a Pipfile.lock
I'm all for keeping silly banter to temporary things. That basically means "commits in branches that will be squashed".
Oops, there's no "d" in Coghlan
@inspectorG4dget No. Meh the Pipfile.lock approach. I don't like it. I just tried PyScaffolds approach on my nano and it didn't work and pip install -r requierements.txt did. So scrap that approach. And no the only comments I make if there is something surprising and maybe from time to time a SO link
understood. I have a feeling I would love to read your code in the codebase. But I can only imagine the amount of restrain it takes to keep them that consistent
14:58
Hmm, word on the grapevine is that GVR was against 3.10 on account of it having a two digit minor version. I guess it's easier to push through his objections now that he's quasi-retired.
user14520680
is there even going to be anything in 3.10 that is a breakthrough for python?
I vaguely recall a comment by Coghlan saying "yeah we changed philosophy a bit since I wrote that article" but I can't find a citation now
@expressjs123 Take a look for yourself :-)
I guess I'm excited for slightly faster string constructors?
Meh looks uneventful
which to me is a good update.
@Hakaishin it's the first or second alpha
they'll be a lot more features by release time
15:13
You could always open every PEP and find the ones that are targeted for 3.10
See if any of those are breakthroughs
they are definitely breaks, from what I've heard
what they break is left to be seen
wakka wakka
eh eh
@Kevin Huh, wasn't aware of the distinction between __int__ and __index__ to mean any and lossless integer conversion. TIL
user14520680
So is 3.10 where the pygame float coords breaks?
15:23
I wasn't aware __index__ was a thing
is there a better way to validate a string than this? dpaste.com/ARUG9E9XB considering the pattern required there?
@Kwsswart yes
if 'Monday' and 'Wednesday' in self.daysdone.data: is always broken
@expressjs123 Good question. I guess it depends on whether pygame is passing those coords to any "builtin and extension functions". Notably, indexing a list does not qualify as one of those, because it already rejects float indices.
check self.daysdone.data = 'Monday', or if you expect both to be contained then check self.daysdone.data = 'Wednesday'
@AndrasDeak during the other validation I have done dpaste.com/9W5QMYDBS in a separate validator to avoid this wouldn't this help cover that issue?
15:29
@Kwsswart try and see?
this function I have here is to use the days to validate the way they are naming the classes
The line of code I posted is fundamentally broken.
you can work around that by not using it
The ideal solution to "the code has incorrect logic" is not "add more logic to cover the issue", but rather "fix the incorrect logic"
@Kevin I wasn't aware __index__ was useful... ;)
15:30
@Kevin Honestly sometimes it's easier to add more logic, but this is not one of those cases
@AndrasDeak I see but how would you ensure those are the two days selected when using a multiselectfield anf they have a few different different ways of using it...
what would be a better way of phrasing it?
@Kwsswart "python check if two words are in a string"
@Kevin Heresy! Add another pyre!
Sometimes the lazy solution is to add more logic on top of the incorrect logic, and sometimes the best solution is the lazy solution because it gets you to the pub as fast as possible on a Friday afternoon
@AndrasDeak so essentially instead of if 'Monday' and 'Wednesday' in self.daysdone.data:it should be if 'Monday' in self.daysdone.data and 'Wednesday' in self.daysdone.data:
15:37
@Kwsswart or one of the other canonical options, yes
what you have will "work"
but it aint pretty
ok well will get to making it pretty then
user14520680
what do you mean by pretty
dpaste.com/ARUG9E9XB as to validating the string input here is there better more elegant way of doing this than all these if functions?
Hard to define, but I know it when I see it
Pretty will be mostly DRY, short, easily modifiable, extensible, all the buzzwords
user14520680
15:41
you can make a function - def in(check, iterable): return check in iterable then call it whenever needed
user14520680
maybe with a global variable to make things more elegant
@Kwsswart is there any reason why users have to enter such complicated labels if they could be computed from the data anyway?
Proposal: write a dictionary that maps time letters to time spans, e.g. {"M": (8, 12), "A": (12, 17), ...}. Then you can iterate through the dict and check each of them against the string. That will let you consolidate three ValidationErrors into one
Also, what MisterMiyagi said
Well mainly to allow them the choice but actually now that you meantion it it may be better to just remove the middle man and just compute the name myself
The old "upload your resume, then fill in this form containing questions that could be answered by reading your resume" pattern
15:47
@MisterMiyagi Honestly this is actually a much better fool-proof method anyway thanks for that mate
@Kevin classic and if I encounter it I just ignore them
user14520680
Proposal: use a for...in range loop with an array of tuples [(8, 12, 'M'), (12, 17, 'A'), (17, 22, 'E')] and check for each tuple. This reinforces the DRY principle
No need for range there, just iterate over the list directly
user14520680
right
user14520680
and why did i say array? :) programmign in js too much
15:56
I wish there was a log somewhere which collected all snarky remarks people wrote but then deleted again, would be fun to read through that.
user14520680
wdym
Presumably people leave comments on questions all the time like "have you tried using your brain?" and then immediately decide it's too mean and delete it
@Kevin yes, some morbid curiosity makes me want to read these. And the fact that you know they never got send, makes it less bad
I know people do this because I am a person and personally I delete 90% of my snippy comments
Hakaishin is curious about never-even-posted comments. Lot harder to quantify those.
16:05
That's simply the set of all strings that are not a member of the set of posted comments :-P
thought-about-but-not-posted comments will require more work, mostly brain surgery
@Kevin actually made me lol for the first time today, thanks :)
I like how lol changed meaning and you now have to prepend it by actually
Unrelated problem. I want to create an iterator that generates all legal arithmetic expression strings using "1" and "*" and "+" and parentheses*. My prototype works properly, but now I want to expand it so it also includes the factorial operator, "!".
(* either including superfluous parens such as "(((1)))" or excluding them, whichever is easier)
If I have a function which takes a function as arg and I want to give the passed function args, I usually did this using a partial, I wonder if a lambda expression could be more succinct.
From a mathematical standpoint, this approach should eventually generate all expressions that use "!" and the other operators, but in practice it only ever generates a "1" followed by N exclamation points and never gets around to using addition or multiplication.
The reason for this is obvious -- I have an infinite loop inside an infinite loop -- but what isn't obvious to me is how I should redesign it
@Kevin you sort of want to turn your DFS to BFS
16:13
Essentially, yes
doing that is left as an exercise to the reader
Oh no :-(
Ok, looks like I will be sticking to partial: stackoverflow.com/questions/3252228/…
@Kevin that seems pretty similar to left-recursion problems in PEG parsers.
16:15
Oh nooooo :-(
Can't you somehow count ! chars as operands?
I'm basically writing the opposite of a parser here, because I want to generate strings that belong to a grammar, rather than check whether a string belongs to a grammar
hey people i'm new to django and ajax and i need someone to guide me to make this login system with ajax!
Of course I could just write a parser and then iterate through all strings in lexicographic order, discarding any syntactically illegal ones, but that seems real expensive
So rather than operands, count tokens
@MohcenCH-TrolL1ng- hello
@AndrasDeak Hmm, perhaps
Ok, the token counting approach produces complete-looking output. I wonder if this generalizes to all context-free grammars...
You'd basically just need a function for each left-hand-side symbol, and a conditional for each production rule that checks the number of available tokens against the number of literals in the rule
Although I worry that it can still enter an infinite loop if you have a chain of rules that contain no literals
A := B B; B:= A A, that kind of thing
@JaimeGonzálezSuárez hello
This is a practical problem if you're trying to generate all combinations of balanced parentheses, because the grammar is S := <empty string>; S:= S S; S:= '(' S ')'. Bam, literal-free left recursion in rule 2
Max
Max
Hello, I'm trying to access to the data (which is a DataFrame) where libelle_français is a null value. I guess it's something like that. But I can't find how. Maybe someone could help me. I'm sure it's a dumb question

Thanks
data[data.libelle_francais=='']
@Max empty strings and NA are different
What does your current code do?
Max
Max
16:36
I'm just trying to print this on my notebook. It's only for showing me the value. I tried something like np.NaN too.
data is a dataframe
nevermind, I misread
@Max that's not an answer to my question
The line you posted, what does it do?
Max
Max
Sorry I'm not good with english, I may have misunderstood the question.

the line is printing in my notebook the lign of the dataframe where libelle_francais column is null.
@Max So it does what you want it to do?
Max
Max
well, it shows nothing, cause as you said '' is different than null value.
it shows empty dataframe, with only titles
So it does not "is printing [...] the line of the dataframe where it is null".
I didn't ask what you want it to do, I asked what it does.
You probably need data[data.libelle_francais.isnull()]
16:39
I'm glad that native Python doesn't have null. It sounds scary.
Max
Max
I have been looking for such a function for two hours ahah. Many thanks
@Kevin Especially now that pandas has float null and int null :)
@Max no problem
(make sure it actually works)
None is familiar. I see it every time I look in my fridge for something I want to eat. Null is a monster from a scifi book that consumes dimensions.
16:53
Hi all, I am trying to make an ML system composing of different models which analyse real time data in a deep reinforcement learning situation. However, the output of the models are actions for which the consequences take time to measure. In such a case where I cannot use gradient descent because there is no ground truth data, how would I be able to train such a system of models? I am using PyTorch
17:11
your training data could include the time-delayed outcome of the decisive action
17:49
@AndrasDeak as an aside, I think you have to be quite deliberate in getting an int null but you've reminded me that I should check that (in other words, .astype(int) on a column with null is a no-no. You have to pick the nullable int type)
cbg, all
@roganjosh that would make sense for backwards compat
18:02
cbg
Does anyone know a way to read Google Docs in Python (any downloadable format) to give a useful document structure?
Google should have its own API for that? I've only ever done it with Googlesheets (for which there's a gspread wrapper) but that also leverages the base API and the free request limit is crazy high
18:25
I know that there is a google drive API that allows for this (had to look into it at work, at some point). I unfortunately do not have an example for you.
Does os.system use some system default shell (e.g. sh) or the user's shell?
@MisterMiyagi should be easy to test
Says "subshell"
> Execute the command (a string) in a subshell. This is implemented by calling the Standard C function system(), and has the same limitations.
That passes on the blame I think
18:42
I was hoping on the collective wisdom of the resident Spelunkers sharing secret knowledge of someone having done that dive before.
On all my systems, the user's shell is the system default shell. p < 0.05 wasn't helpful in my experiments.
start python from a non-default shell...
oh, you mean user default
start python from a temporary user with a non-default shell... :P
in any case I revoke my "should be easy to test" remark; I read "user's shell" as "whatever python is running in"
my non-interactive default shell in debian is dash and my user's login shell is bash, if you want me to test something
The output of python3 -c 'import os;os.system("echo $SHELL")' would be useful.
19:00
Yeah, I checked that command in my shell earlier... and both in sh and bash I get /usr/bin/bash :|
$ dash -c 'echo $SHELL'
/bin/bash
that's within bash though... so perhaps it won't apply to os.system?
$ sh -c 'echo $0'
sh
$ dash -c 'echo $0'
dash
looks better
$ python3 -c 'import os;os.system("echo $0")'
sh
Success!
Wait, how does that python -c line not raise an error?
I meditated for three days on some remote mountain to find it.
Ah, what doesn't work is putting a for loop in there... even on a single line
You can have more than one "simple statement" on a line. Only "compound statement"s are restricted.
It's probably due to quantum. Or indentation of blocks.
19:08
Quantum Loop?
Oh poop: searching that brings up "loop quantum gravity". I couldn't have had a less appropriate audience to try my Quantum Leap pun :/
Remember, quantum jokes are both fun and unfun until you explain them.
19:31
so you can do for-loops with single-line bodies on one line (for a in L: print(a)). But if you need something more complex, you'll need a listcomp
@MisterMiyagi That's why I prefer UDP jokes - I don't care if you don't get them :P
@inspectorG4dget or just a multiline input string
@AndrasDeak touche!
what is cbg?
@inspectorG4dget Unfortunately, it is not a typical ML project with training and validation data. It is a RL project and I've designed it so that it can learn in real time as well as back-testing but have found no way to be able to do gradient descent in RL. Is it possible to do Deep RL but use rewards instead?
@AndrasDeak hahaha. thanks
19:40
won't that have the same problem though? "you won't know how to reward it until the outcome has been decided"?
That is true. Can you think of any other way?
@Kevin I was trying to start the same kind of thing yesterday. I failed miserably. I successfully generated all possible positions for (single or multiple) parentheses, but it's in a messy list of lists. It takes as input a number of digits to compute parentheses for. I'll probably need more time (read 2-3 years) to accomplish this. :D
19:56
Hi all
I have a question on coverage. does coverage report command is based on the results of coverage run command
@arielma you keep asking these questions which makes me curious... does the coverage documentation not specify any of this?
no apperntly
I will try to focus it
my first command is `coverage run -m xmlrunner discover -s tests -p 'test*.py' -o testreport
now the next command of coverage report already knows to run only the files I've mentioned earlier, or I should use discover here as well
Never used the library but this seems to clarify your question to me
Ok, I'm less sure about coverage run -m xmlrunner discover -s tests -p 'test*.py' -o testreport
I read it
still, it doesn't mention if I should use now -s -p for all the other coverage command
s
20:15
@arielma discover is a unittest (runner) command, not a coverage command.
If you look at what each command is supposed to do, these things should be clear, actually.
@arielma yes
tips for using coverage: 1) use pytest instead of unittest 2) install pytest-cov 3) run pytest --cov to get your coverage, and never have problems with coverage ever again
number 1) also goes as general life advice
20:31
@Arne All works for me. The nice thing about pytest is you can start by just writing test_* functions that make assertions before you even install it. Such functions can be used to test the code individually, then discovered automatically when you install pytest.
Thereafter you can write parameterised tests, fixtures and all the other good pytest stuff, but none of it is needed to start with.
it's pretty impressive how pytest manages to both have a lower entry hurdle and more power than unittest. Or any other test framework I came in contact with.
21:04
@MisterMiyagi do you know what is the command for coverage report -m for entire directory?
I tried with `--include "target/path' but it doesn't work
coverage report -m --include "path/to/target"
ok found the right syntax. you can ignore
21:56
Hey guys, I need to test custom exceptions and I want to test whether every of HTTP status codes between 400 and 499 raise one specific exception. Can you help me with the approach using pytest? Writing 99 unit test for each code seems ridiculous
Indeed, testing 418 is super important :P
@EliHalych hello. I'm not much of a testing user, but I know pytest supports parametrized tests; this sounds like something that you should use. And you'd probably want to mock the request part and just lie to your code that it got the given HTTP code, which is the parameter in the test.
The mock response I already have.
```
mocked_response = Response()
mocked_response.status_code = 400
mock_request.return_value = mocked_response
```

I will look up parametrized test with pytest
In the back of my head, I think you're approaching the testing incorrectly, but I'm also not a big tester. You've already assumed that there is a contiguous set of status codes and that all of them are even serious. Is this not overkill?
Do you have different recovery plans for each and every one?
:50801291
> your training data could include the time-delayed outcome of the decisive action
22:05
from importlib.metadata import distribution
distribution("pytest").metadata
<email.message.Message object at 0x00000274D4A0F7C0>
It will never stop to amuse me
@roganjosh The thing is that I am working on a Python SDK that communicates with an API over HTTP and I assume it can return anything. It's an open source project and developers from all over the world contribute to it, it is not a company product, so it's hard to assume specific status codes from the API because of its dynamic nature. But maybe I am getting it wrong again though
@EliHalych In which case don't take my comments as definitive at all, but it just doesn't seem worth it for me. We all know the main HTTP codes and the rest could probably be "soz, I didn't get that" as far as the API is concerned?
The SDK part, I'm less sure about. But making a contiguous list of HTTP codes, even for ones that don't even exist now, seems odd
Don't you want non-existent HTTP codes to raise? Checkmate!
Today we're handling tough questions asked of teapots, what will we have tomorrow?!
Even if I don't need 200 of them, there are at least 20 we can assume can be used. Content-Type length, media type, unauthorized, forbidden, not found etc. Even if that's 10 codes it gets pretty lengthy
22:17
I'm angling more along the lines of "this is the subset of codes that we'll handle - the rest get a generic error" vs. testing every code individually
I like this approach. Sounds reasonable! So far btw handling would mean just raising custom exceptions and there are 3 of them that inherit from each other. ApiException <- ResourceNotFound <- RelationshipNotFound. So I'd say Api axception will be that generic error and my subset will only be [404] that is one code
Not sure about RelationshipNotFound yet, but I guess it would mean just one more code
Hm makes more sense now
I think what I'm saying with "the rest get a generic error" is that you just allow it to bubble up rather than give a generic error. The 404 can have its own error handler. I'm not sure if my mental model is properly aligned with what you're doing
yoo wassupp
One of the requirements is to not allow errors to just disappear, so I'd say a generic error would need to be raised
What is the application?
Roughly
22:31
Of raising a generic exception? To see what went wrong. Like some project settings error, api error, or connection failure, not found error etc. So far there's KeyErrors and ValueErrors raised everywhere and it says nothing about the type of the exception.
If you mean what project, then it's ONAP onap.org
Sorry, by "application" I meant "web app" since you're returning HTTP codes. But ok, I think I understand the problem a bit better.
It's a bunch of applications as microservices
Just looking at that site, I think I best sit down and shut up :P
I might be misguiding you; take what I've said with a good helping of skepticism :)
It is not for the website I sent, it's more for this: gerrit.onap.org ;P Quite complex haha
Thanks for your guidance, I think it is valuable
23:26
Here is some set manipulation trivia (learned while trying to force a random set mismatch in my test code, to verify the validation logic):
1. set.pop() does not give you a random element. For two equal sets a and b, `a.pop()` and `b.pop()` will give you back the same element (only lightly tested).
2. `random.choice()` will not accept a set, since it requires index support.
3. To randomly remove some set element, I found this to work: `sset.remove(random.sample(sset, 1)[0])`

« first day (3665 days earlier)      last day (1507 days later) »