« first day (3166 days earlier)      last day (1787 days later) » 
02:00 - 16:0016:00 - 23:00

wim
4:00 PM
@U9-Forward you post an answer, 7 years later, that you don't recommend, even saying "don't do this". why add answer at all? recommend deletion.
 
Actually, where is this behavior even documented? Which types of objects are subject to interning? Does it affect complex, str, bytes, bytearray, etc?
 
but if it works in a REPL and works as a script it will probably work on that version of cpython everywhere
 
e.g.
a = 257
b = 257
assert a is not b, "Integer interning range is larger than expected"
a,b = loads(dumps([a,b]))
assert a is b, "serializer did not deduplicate equal ints"
 
Good idea, I should do that
 
@Aran-Fey just ints and str I think? And some empty immutables. And b' ' for some reason?
 
wim
4:05 PM
implementation detail does not get documented because it is subject to change without warning
 
I guess if it were in the documentation it would be documented
 
@wim All I'm asking for is a list of types whose instances may or may not be interned
I'm not asking for a complete specification
That has to be documented somewhere, otherwise x is 999 is perfectly good python code and CPython is at fault for behaving inconsistently
 
@Aran-Fey Strictly speaking, only strings are interned. docs.python.org/3/library/sys.html#sys.intern The small ints are pre-allocated, so they all exist whether you use them or not.
 
@PM2Ring Thanks, I was just trying to match strings of type foo=bar and got it done by doing if [[ "$var" =~ .+=.+ ]]
 
Some people say the small ints are interned, and I guess that's ok, but it can be confusing in technical discussions, so other people say they're cached.
 
4:14 PM
is it a bad idea to write a script which can set an env var VAR with value VAL if you give it a string VAR=VAL
 
So "interned" is a subset of "cached"? Or are they two different things?
 
@Aran-Fey I disagree. If the specs don't tell you that some types get cached you can't just assume that out of nowhere.
@Aran-Fey I'd have thought small ints are interned and strings are cached...perhaps it's the other way around then
there's weird sys.intern for strings for what it's worth
 
@AndrasDeak and here I thought only college kids got interned :)
 
@DeveshKumarSingh you can just run VAR=VAL whatever_script anyway...
 
@AndrasDeak Wait, hold up, I'm confused. If the docs don't tell me that ints get cached, then writing code like x is 999 is reasonable, right?
 
4:17 PM
@Aran-Fey Yes, "interned" is a subset of "cached". At least, that's how I understand it. ;)
 
@AndrasDeak no I want these environment variables to persist across reboots
 
Ok, I'll make sure to phrase my upcoming SO question correctly (:
 
@DeveshKumarSingh That should be ok, but my bash is a bit rusty. When in doubt, check on the Unix & Linux stack. Some of the regulars there have encyclopedic knowledge of the subtle variations between different shells.
 
The source uses the term "preallocated" when referring to small ints, FWIW
 
@PM2Ring yes I got the info about the operator from Linux SO, and the regex string from python works here too
 
4:21 PM
@Aran-Fey no. Why would object() is object() be true?
 
oh, right, my bad. But writing y = 999; and later x is y would be reasonable, right?
 
no
999 is only guaranteed to be int(999) if you ask me
Which could return (and does) a new instance each time.
 
@DeveshKumarSingh Depends.Do you want that env var to exist after the script finishes executing? That normally won't happen, because a script runs in a subshell, unless you source it. And a subshell cannot change the environment of its parent shell.
 
Based on the language specs you should only use is if there's a possibility that y = x or equivalent happened upstream
 
I'm not following... if there's no indication that the interpreter is allowed to cache ints, what's wrong with checking if two ints are identical?
Well, if I do y = 999 then x = y could have happened
 
4:25 PM
@Aran-Fey nothing wrong, but they should not be expected to match
 
My mental model is: any object, when instantiated, may be a new object or a reference to an existing object. There is no guarantee that any particular type is cached or not cached. Exception: object() is always unique.
 
@PM2Ring Yes I am running the script as . ./script.sh && source ~/.bash_profile so the script.sh appends the env var into bash_profile, and then I source it to persist those across reboots
 
@Kevin That's mine too
 
@DeveshKumarSingh Fine.
 
@Kevin What about user-defined types (classes)? Those are always unique too, right?
 
4:27 PM
Yes, unless they override the correct dunders to get singleton-like behavior
I think you can do that with __new__?
 
@PM2Ring Thanks, my bash is pretty bad too, just because if you forget a space somewhere, it's hard to figure out what went wrong from the error in bash, most of the times I give up
 
__new__ is responsible for creating new objects, yeah
 
object() is unique, so therefore anything that inherits object.__new__ must also create unique instances... I think.
 
So my opinion is that expecting x is 999 after x = 999 implicitly assumes that integer literals are singletons. Which is the exactly what nobody says if there's no mention of interning/caching.
 
@DeveshKumarSingh There are tools to help with that, like shellcheck.net
 
4:30 PM
the implementation detail is such that it is the same object in a few cases, but this is a red herring
 
wim
@Aran-Fey I don't follow that argument.
 
@AndrasDeak Agreed
 
By the book x is y should only be relied upon if you yourself, as a programmer, write code that creates new references to the same object. For instance by appending to a list and later comparing elements.
 
@Aran-Fey You can write x is 999 if you want, but it's unlikely to evaluate as True, even if the value of x happens to be 999. ;)
 
with x = 999; lst = [x, (2*x)/2]; it's guaranteed that any(elem is x for elem in lst) whereas it's not guaranteed that all(elem is x for elem in lst).
 
4:33 PM
Hmm, ok, I see what you're getting at
 
I had to get back on laptop to try and elaborate on my view :)
 
wim
My opinion: is should be removed from keywords, and converted into a function in inspect module namespace.
inspect.is(obj1, obj2)
 
@PM2Ring thanks, I will bookmark this, it's pretty neat
 
wim
and the common comparison with is None could just be written == None and possibly converted to the fast-path by the peephole optimizer
 
Python devs, please implement the leftwards-unary operator isNone
 
4:35 PM
@wim If the documentation makes no statement about ints being interned, then I can expect x is 999 to behave predictably. CPython has a peephole optimizer, so it doesn't behave predictably.
 
@Kevin working on it D:
@Aran-Fey I agree that it's not predictable. But that's a bit like complaining about the compiler when your undefined behaviour breaks. It's bad code which only sometimes works.
 
Why is it undefined behavior, though?
 
it's not, it was a comparison
 
Then I don't understand the comparison :D
 
well, I guess it's as close to UB in python as it gets
 
4:38 PM
@Aran-Fey Theoretically, any immutables could be interned. But they aren't, only strings may be interned, and generally that's more likely to happen to strings which are valid to use as identifiers. The optimizer can do some recycling of immutables, on the same line. And that's about it, AFAIK. I once tried to manually implement tuple caching (I was making lots of duplicate tuples for an Exact Cover problem), but it was a pain, and gave little benefit.
 
@Aran-Fey C: "I use UB, it's unreliable because the compiler makes arbitrary decisions". Python: " I use is to compare ints, it's unreliable because the interpreter arbitrarily interns ints"
 
wim
IIRC the empty tuple is cached
 
perhaps one could come up with a contorted example where interning gives you a false positive in a legit comparison, but I don't expect this to be relevant in practice
 
is having undefined behavior makes it easier to write Python implementations on exotic architectures that don't store objects as structs in linear addressable memory. I have no idea if there is such an architecture, but it will be nice to have in ten thousand years when we're encoding algorithms in sunspots or whatever.
 
technically the UB is not really about is
is always tells the truth
 
4:40 PM
@AndrasDeak remember that the 2.x series had an actual intern function you could use
 
True. But honestly, I think the docs are intentionally vague about the whole thing.
 
@JonClements I thought we all agreed not to talk about the dark ages of python ;)
 
< 2, I think it even had an "apply" builtin which later became syntax
 
@wim Yeah, ok. I forgot about that. And the other false-ish standard types.
 
>>> x = b' '
>>> y = b' '
>>> x is y
True
>>> x = b'  '
>>> y = b'  '
>>> x is y
False
don't ask me why
 
4:43 PM
@AndrasDeak whether we did or not - we should all shiver at the thoughts of some stuff I guess :p
 
wim
apply is weird because it was deprecated in 2.3 but it's still there even in 2.7
 
@JonClements You still can, it got moved to sys.
 
wim
(usually deprecation in 2.3 would mean removal in 2.4)
 
oh that's the same as str
yet keyword-like bytes don't get interned
 
Maybe we can think of the question like this: If I want to create a sentinel value, which types are safe to use? i.e. SENTINEL = object() is reasonable, but SENTINEL = 1 is not because CPython might give someone the very same 1 instance even if they don't access my SENTINEL variable directly
 
OK, single-char bytes seem interned
 
wim
late answer appeared and got upvoted right away (even though it's totally bogus and irrelevant to the question)
 
I wish I could say that I'm sure it's foul play, but I'm not
 
@AndrasDeak Interesting. I guess that's cheap, since they're essentially small ints.
 
cbg! Is there a way to force pandas to use instance's __hash__ function in place of __iter__ when trying to do .loc on a DataFrame whose columns are instances of classes that have both __iter__ and __hash__?
 
4:46 PM
@Aran-Fey My expectation is that object is the only truly safe sentinel type.
 
make that single-char ascii, probably
@Aran-Fey well yeah, something like a literal is a very bad sentinel. For a sentinel you need something that's guaranteed to be unique.
 
@Aran-Fey CPython might give someone the very same 1instance That's guaranteed. CPython never creates a fresh instance of a small int, it pulls it out of the preallocated ones that are baked into the interpreter.
 
well, figuring out when it's guaranteed is what I'm doing
 
ints? it's defined as a range of values in cpython implementation
-5 to 256 in the source code
 
I'm interested in the python language as a whole, not just the CPython implementation
 
4:50 PM
I was going to say "https://docs.python.org/3/library/functions.html#object says it returns a 'new' featureless object, so it must be referentially unique" but I notice that bytes also claims to return a new object, even though byteses of length one are interned. So maybe that's not a good interpretation of what "new" means.
 
@Aran-Fey and I've been saying that "guaranteed to be distinct" is not true for any of the built-in types (other than object)
 
@Aran-Fey in that case, i'd presume unless a language specifies something as unique/singleton, it should not be considered unique at all. the fact that some values are cached/interned should be considered implementation detail
 
I guess it would be hard to prove that it's true for object.
 
@AndrasDeak The repr might look like ASCII, but they're just bytes, meaningless bit patterns.
 
afaik, python only gives that kind of honour to the bools and None.
 
4:51 PM
looks like I missed a git conversation earlier ;-(
 
Also, is anyone else unable to get an anchor link for bytes on docs.python.org/3/library/functions.html? Usually the little paragraph icon appears when I hover over a function name, but it's not doing it for bytes or bytearray.
 
Hmm, object is mutable! Maybe that's the key: use a mutable type as a sentinel. And not an empty container :P
 
@AndrasDeak yeah, ok. I haven't found an official source yet, though :P
 
I know that the anchor exists, because I can click on it in the table of function names at the top of the page...
 
umm... looks like that's a static page, so can't edit it via the admin
 
4:53 PM
@Code-Apprentice I still have plenty to say about git :-) For example: "this tutorial is building on top of concepts that I haven't fully grasped, like all of rebase, and my little sandcastle of comprehension is going to collapse at any minute"
 
@PM2Ring I meant bytes that happen to correspond to ascii characters (assuming that's a thing)
 
@Kevin I learned git by reading Pro Git. It has some deep dives into the details, but really for day to day usage, chapters 2 and 3 are all you need.
 
@Kevin can confirm the paragraph button is missing
 
You can't be like "oh btw, elements of this tree can have two parents... Moving on" without discussing the consequences of changing your tree into a directed graph
 
yah, the "tree" concept only gets you so far
 
4:55 PM
@Kevin the tutorial teaches rebasing, doesn't it?
 
which tutorial are you working through?
 
@AndrasDeak Ok, but ASCII is a 7 bit code, so that only applies to the bytes upto b'\x7f'
 
@PM2Ring that might be exactly what I meant, let me check
 
@AndrasDeak Yeah, it spends one or two exercises on it in the early chapters. But not enough for me to feel confident about it.
Sometimes rebase just moves a branch so it points at a descendant commit, and sometimes it keeps the branch where it is and gives that commit two parents, and it decides between these approaches via [UNKNOWN]
 
I see
 
4:57 PM
 
> sometimes it keeps the branch where it is and gives that commit two parents,
does it?
I don't think I've ever seen that
 
@Kevin that looks pretty good
 
If you do a = list(); b = list(), then a and b are guaranteed to be separate objects. The same applies to a = []; b = []
 
my understanding is that rebase takes a chunk of predecessor history and moves all those changes as if they would've been applied to another state (commit)
 
@AndrasDeak I... Think so? I passed through the exercise pretty quickly, assuming they would explain it further in the next chapter. I'll backtrack to see if I can find it.
 
4:59 PM
I also don't remember that part of the game, please do point me to it if you find it
 
@AndrasDeak we also need to safe the facts that most people are "completely lousy" at "source control" :p
 
@Kevin I like the visualizations, especially the animations to help you form a mental model of what is happening.
 
I'm losing my grip on reality
>>> bytes([90])
b'Z'
>>> bytes([90]) is bytes([90])
False
>>> x = b'Z'
>>> y = b'Z'
>>> x is y
True
is this REPL fluff again?
guess I really should stick to scripts for testing id shenanigans
I thought I had it nailed with assigning on two different lines...
 
Pretty sure the REPL is better than a script, 'cause it allows fewer optimizations
 
I've seen weirdness very similar to this except it was strings.
 
5:04 PM
I draw the conclusion that CPython has a cache specifically for bytes literals
 
I guess I'll set this issue aside for today...
 
@AndrasDeak I was wrong, I was thinking of level intro3, which is merge, not rebase.
 
oooh perhaps it's for b' '.join?
@Kevin ah, merge yes, merge is a very different animal. It only doesn't spawn a new parent when you're trying to merge into your linear history one way or the other. That's fast-forwarding.
There's a kind of duality between merge and rebase. Both will give you the same end state in terms of your codebase. If you use rebase you copy your old commits and throw away the old ones (e.g. the hashes change, and if you have other branches on the old commits you will have duplicate commits with different hashes). Merge keeps your original commits (it doesn't "rewrite history") at the cost of having multiple parents and "loops" in your tree.
Opinions vary about which one to prefer, some people prefer the "true history" of merge, others prefer the "nice and clean end result" of rebase.
Personally, I think rewriting history is fine as long as nobody had a chance to observe said history. So locally I always rebase.
 
I'm in favor of rewriting history if it saves me from public embarrassment.
 
:) The problem with merging master into your branch is that later when your feature branch gets merged back you can have ugly spaghetti in your master's history.
 
wim
5:11 PM
^ agree. better to rebase off master
then when feature branch is merged to master it should be an easy fast-forward
>>> bytes([90]) is bytes([90])   # 3.7.3 on linux
True
 
Ok, so rebase [target_node] does:
- if the current branch is a descendant of target_node, nothing happens.
- if the current branch is an ancestor of target_node, the current branch is moved to point at target_node.
- if there is no descendant/ancestor relationship, the commit at the current branch is copied and made into a child of `target_node`
 
@wim False on 3.7.0 on linux
 
wim
this was apparently fallout when disambiguate the #bytes label from the anchor in stdtypes html
 
@Kevin #3. along with all the commits that have been made since the common ancestor, I think
with rebase -i you can interactively choose which commits to move I think, and more
 
5:24 PM
@AndrasDeak Oh, that makes more sense. I was trying to figure out what's the use in copying only one commit at a time. If it copies all commits since the point of divergence, that seems more useful to me.
I did the rebase -i segment already and it seems straightforward enough. I'm not completely sure how it interacts with branches pointing at commits that you're rebasing, but I don't think I need to worry about that for practical purposes.
Most of the time I expect to have a master branch and one bugfix/feature branch, and 99 branches for old features and bugs that I never intend to look at again
 
What exactly do you mean by "copy"? I don't think your code is guaranteed to stay the same after rebasing?
 
@Kevin remember that commits always stick around, just sometimes there are no more references pointing to them. This is being greyed out in the game. If there are other branches pointing to commits you rebase, you'll have those commits twice with two hashes, as I've said
 
@Aran-Fey I also don't know what I mean by "copy". The entire tutorial is kind of ignoring the fact that merge conflicts are a thing.
 
(if you do need access to commits you've lost, you can find them in git reflog)
 
wim
@Kevin you know about --prune ?
 
5:28 PM
My understanding is that rebasing A onto B will make a diff between A and its parent, and apply that diff to B, creating C (as a child of B)
 
@Kevin yeah, merge conflicts are one thing that aren't covered. The content of commits is abstracted away.
 
wim
the reflog is a life saver!
 
@wim No, but I'm looking at the man page now. Can it remove branches I don't care about any more? That would be nice.
 
wim
@Kevin yes, that's what it's for.
usually I don't use git prune directly but maybe more like git fetch --all --prune
 
I'm not sure what "unreachable" means here since I haven't yet come upon a command that can make a commit have no parent
 
5:32 PM
@Kevin deleting a branch or rebasing it. You don't have access to children
Unreachable = greyed out in the game
 
Ok, so "reachable" means "a commit that is referred to by a branch, or a commit that is the parent of a reachable commit"?
 
Commits are still there if you know their hash
@Kevin I believe so
 
wim
@AndrasDeak also False on 3.7.1. Then it's True on 3.7.2.
 
I think there is some ambiguity here. When I say "branch" I mean "a mapping between a name and a commit", rather than "a collection of nodes in the commit tree".
When I say I want to delete a branch, I mean that I don't want bugFix123 to show up when I do git branch
 
wim
is it a branch that has already been merged into master?
 
5:35 PM
Yeah.
 
wim
or is it a branch that got some commits and then kind of got abandoned and forgotten about
 
I also have some of those :-)
 
wim
the former you can automatically prune, the latter you might need to set up an alias or something
 
you need branches to be kept for leaves of the tree, for others you don't need them to keep your commits accessible
 
Google tells me that git branch -d bugFix123 will obliterate bugFix123 from my named branches.
 
5:39 PM
Indeed, but if it's a tip you'll lose access to those commits
Branches are just pointers
 
Right. But will the commits still be accessible by hash? Or do they get pruned right away?
 
Yes, hash always give you access. But you normally don't rely on that.
I don't think git normally garbage collects unreachable commits. That's why it's hard to lose work.
 
Ok. I wasn't sure because the man page says "With a -d or -D option, <branchname> will be deleted. You may specify more than one branch for deletion. If the branch currently has a reflog then the reflog will also be deleted". I wasn't sure if the reflog was, like, the authoritative lookup table for commit hashes or whatever.
 
There's probably a command to delete unreachable commits...
 
I think --prune is that command.
 
5:42 PM
Never used it, could be
not sure about those reflog remarks, you have to ask an expert
 
... Is that not what I'm doing right now? :-P
 
Everybody knows the best philosophers are the ones that insist they don't know anything.
 
wim
git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d   # delete branches that are already merged into master
 
I'm very confortable with the very basics of git
 
5:46 PM
The best Wise Men of the Mountain always claim they only moved up there because the bracing air is good for their rheumatism
 
Due to the weird API I dare not extrapolate to behaviour I'm unfamiliar with :P
 
Wouldn't it be wild if the thing that finally convinces me to migrate to Linux is "I need the pipe operator so I can do sick git stunts"
And also the stunts are radical and extreme
 
wim
confortable - an all-upholstered chair of the early 19th century
I can't even imagine using a shell without pipes ... how do you do it in windows?
 
Andras has constructed a chair out of git commands, and reclines in it within his 19th century wood paneled study. There is a fireplace and brandy and perhaps a few mounted animal trophies.
@wim It's fairly awful. Anything I can't do in one command, I have to cobble together using a Python script.
 
wim
surely powershell has pipe
 
5:57 PM
Am I the only one who's never used a shell for anything fancier than running a program... optionally with a couple of arguments?
 
@Aran-Fey yes, and we barely tolerate you amongst our wood paneled midst
 
Powershell has many toys I'm sure, but I am not well acquainted with them.
 
wim
are you telling me you actually use cmd.exe?!
 
@wim ironic that it has "table" in the name and not "chair"
 
Yes, I use cmd.
 
wim
6:00 PM
wow
ok
it's strange for someone to get to your level in knowledge and still be using such a garbage shell
 
It's like Goku's ankle weights.
 
My knowledge level across various domains is practically fractally uneven
 
wim
are you also using internet explorer and notepad ?
 
user10984358
has anyone here used Colab??
 
user10984358
what I want to know is, is there a way in which I can like "import" my local project to Colab so I can make use of the GPU it offers?
 
6:07 PM
@wim Firefox and Notepad++. Let's say I'm 33% of the way between a joke browser/editor and an actually good browser/editor.
 
Try SciTE instead of Notepad++, very easy for quick Python snippetting.
 
wim
isn't it possible to just use bash in windows these days?
 
I typed bash into my command prompt and it's displaying Kevin@MYCOMPUTERNAME MINGW64 ~/Desktop followed by a $ prompt, so I guess it is possible.
 
wim
 
Ok, I'll try... I think the command is syntactically valid, but it fails with fatal: branch name required because the repository I tried it on has zero non-master branches.
I think all of the repositories on this laptop are like that. Maybe I'll try again tonight on my home computer.
I really have to credit MinGW for making my development environment less excruciating in many ways
95% of it is due to grep, but cheers to the other 5% too
 
wim
6:17 PM
@Kevin reasonably sensible error message when there are no branches possible to delete
 
Yeah.
 
wim
if you configure your shell with pipefail then the git branch -d would not get called at all here (since the grep would return a non-zero exit code)
 
I feel unqualified to take on advanced3 of learngitbranching.js.org, even with the cheat sheet I composed
I thought I was all clever right until it told me I can't git reset while I'm in a detached head
 
wim
@Kevin try in your bash shell: curl wttr.in
 
I see bits of a weather report amongst a large quantity of mangled ANSI escape sequences.
 
6:30 PM
You use your shell even for the weather report?
 
@Kevin course; you're just jumping to a commit ID, right?
 
I assumed that reset [label] meant "change the branch label label so it points at HEAD` but I guess it actually means "change the current branch so it points at label"
Well, I got it, but I solved it 80% with rebase -i which is a little cheaty considering the point of this tutorial was to eliminate my dependency on guis
Looking at the intended solution, I guess if I wanted to copy commits I should have considered using the command that exists for the express purpose of copying commits.
(Or at least this tutorial claims that's what cherry-pick is for. I'm sure it has 99 increasingly contrived uses, just like every other git command)
 
I've never got to cherry-pick
 
You very rarely have to. Mostly if you're a package maintainer I think. Or screw something up.
 
My next Git adventure is going to be with subtree, trying to combine 3 repos into one and preserving history
 
6:40 PM
my level of git use which should probably suffice for Kevin relies on commit, fetch, checkout, merge and sometimes stash
 
That's the git local tutorial done, now for git remote
 
wim
@AndrasDeak Or want to screw something up further.
 
> a lot of developers think that running git fetch will make their local work reflect the state of the remote. It may download all the necessary data to do that, but it does not actually change any of your local files.
This right here is why I was 3,000 commits behind yesterday.
 
pull == fetch + merge is a rule often neglected
 
6:55 PM
I don't suppose there's an equivalent command that equals fetch + rebase?
 
git pull --rebase exists I think
 
The tutorial says it will tell me more options for pull "later"
 
Personally, I don't like commands that change state as part of their work. If I want a merge or a rebase I want to do it myself.
but perhaps mostly because I never bothered to learn more than the very basics :P
 
The tutorial confirms that git pull --rebase is a thing.
 
Hi everyone! this is my first time here, I am not sure if this is the right place to ask this.
But I have like 1000s of html files, none of them have any ids or anything and most of them have a different format of html.
For example, some have text in div tags, others have it in p, table, etc.
it's a long html file and I want to extract a section of text from all the files.
for example, starting from "Item 1A." until it reaches "Item 1B."
Is there a way I can do that?
 
7:11 PM
With what language?
 
I am using Python.
 
Then you're in the right place :) Welcome.
 
for future reference here are our rules if you want to make sure you're doing everything right
 
Hmm, after I rebase a branch, what's the idiomatic way to make master point to that branch tip? git checkout master; git reset branchname?
Or is there a cool "rebase and also fast-forward master" ultracommand
 
7:13 PM
So even though the HTML is different in each file, it's guaranteed that the text "Item 1A" and "Item 1B" will appear in every file?
 
@Kevin I don't think there is. Why would master be affected by your rebasing another branch?
 
@Aran-Fey Yes. Every file will have "Item 1A" and "Item 1B"
 
@RishabGupta The good news is that it's possible. The bad news is there's no magic way to handle all those different formats. So your code will get rather messy, and you may reach a point of wanting to inflict violence on the people who created those files. ;)
 
Is there any HTML code between 1A and 1B?
 
@AndrasDeak Is this not a common use-case? If I want my bugfix branch to go into master, and if I don't feel like using merge, then I would rebase bugfix to have master as a parent, and then make master point to the final bugfix commit.
> You solved the level in 16 command(s); our solution uses 6.
 
7:16 PM
@Kevin no, bugfix branches should be merged into master
 
@Aran-Fey yes, it's all html text.
https://www.sec.gov/Archives/edgar/data/61478/000095012309064850/n54727e10vkt.htm#002
 
^^^ Ok, evidently based on my dismal score I shouldn't be doing my checkout-rebase-checkout-reset pattern.
 
you can check it out here.
 
@AndrasDeak So merge is idiomatic and rebase is not idiomatic? I thought it was a personal preference.
 
@PM2Ring hahaha I already want to. Are you aware, how can I achieve that?
 
7:19 PM
@Kevin rebase puts your branch elsewhere. Merge combines branches. When you have to rebase your branches onto master it's so that you can merge only your new change into master after.
 
@Aran-Fey if given one file, I was able to extract that section, but since every file has a different format. I cannot run the same code. I am not sure what and how to give the conditions, that if this is the format, then this etc etc
 
They are different semantics
 
I'm honestly not sure if I can recommend BeautifulSoup here... that page is huge, so there's a good chance BS will set your PC on fire if you make it parse that monstrosity
 
@AndrasDeak Hmm. I will contemplate these words.
Meanwhile, looking at the intended solution for remoteAdvanced1, it sure would have been nice if I had been informed that rebase can take more than one argument
 
@RishabGupta Sorry, but I don't think I can help
 
7:22 PM
I mean, the "merge or rebase" discussion we had originally is about moving your new changes onto commits made by others
Your actual new commits should typically be merged for clear history I think
 
@Aran-Fey that's okay, thank you for taking the time to look at it though. :)
 
wim
rebasing your feature branch can be the last thing you do before merging it to master
the rebase is to avoid an extra spurious merge commit from master back into your branch. not to avoid the merge commit from your branch into master.
does that makes sense?
 
Are there branches other than the feature branch and the master branch in this scenario?
 
I'm a fan of rebasing the heck out of my own work. Maybe it makes sense to just have one commit (squash 'em!) or maybe it makes sense to have a lot of them
but I really hate having 45 merge commits from master/wherever into my branch. That makes me sad :(
 
7:37 PM
@RishabGupta From what Aran-Fey says, I'm afraid to look. ;) (And it's getting rather late in my timezone). One thing I've done in similar situations is to write multiple parsers, one for each variation. So you can try to extract from a section, and if it returns rubbish, you try a different parser. The tricky part is deciding what's rubbish, and what's correctly parsed data. If the number of files to check is smallish, you can do that manually, but that's not practical with 1000 files.
 
@PM2Ring exactly, in order to decide if it is rubbish, I would anyway have to check it manually.
 
Hmm, irritating that you can set a remote branch target with both branch -u and checkout -b, but the arguments are in opposite order.
@wim in that case, I don't see the point in rebasing first. If you rebase feature onto master, is it even possible to merge? The entire repository history is a straight line at that point, isn't it?
 
@wim Interesting. Pity it's so deep. It may never be practical to mine it.
 
@Kevin it's so that you fix merge conflicts and not the maintainer
rebasing forces you to fix conflicts between your changes and the 3k new commits in master
 
7:45 PM
Ah. Merge conflicts are still largely mysterious to me. As you said, this tutorial abstracts them away.
And thanks to my scorched earth policy, I've never resolved a merge conflict myself.
 
:) it sucks
 
Merge conflicts are fine, unless there are loads
 
wim
@Kevin I am of course assuming other stuff has gone into master while you are working on your branch
if nothing has touched master since you branched, then indeed there is no point to rebasing
 
Hmm, I'll think about that.
 
Merge is like two histories lined up side by side, then smashed together
Rebase is dumping one on top of the other
@Kevin don't forget grooming in Scrum
 
7:52 PM
I understand the commands in terms of how they manipulate the commit tree... Mostly
 
I've only just figured a bit more of it out, which is very exciting :)
 
I'm only on exercise remoteadvanced6 and close of business rapidly approaches... Get the hat of shame ready
 
How do I break a long url in docstrings? Good ol' `\`?
 
8:10 PM
@Kevin that seems pretty good
 
Yepp, backslash works, but you have to append r to a docstring, as pointed out by linter.
 
8:52 PM
this, there are 310 questions on "pandas concatenate rows"; this is a duplicate; the only issue is of which. (I'd need to write a regex-based scraper just to figure out which, and extract the tags, python/pandas versions, no of answers, votecounts, dates of question and answers)
...Does anyone have such a scraper? Seems like an interesting useful project for me on a non-priority basis...
 
9:04 PM
@smci You may be interested in the StackExchange API. Particularly /questions or /posts
 
...also users are often unclear on the difference between string-concatenation vs row/column-concatenation and on the difference between row-wise and column-wise. viz. this one which originally said "How to concatenate rows..." but really meant "How to string-concatenate multiple text columns...?"
 
"How to string-concatenate multiple string columns in pandas?" is certainly a more descriptive title, but may not be as searchable. What about "How to concatenate multiple columns of strings in pandas?" FWIW, "concatenation" has different meanings based on the context.
 
@cs95 Thanks a billion cs95 re the Stack Exchange API, have any of you done any scraping on Python/pandas-specific stuff using it? Any suggestions to me on what format the output should be? what other specific items should I extract than the ones I suggest above? (also, both Python and pandas versions will have to be a set or range rather than a single value: e.g. "Python 2" or "2.x" or "2.5 - 2.7"). And where pandas version not stated, I will assume "current" as of [question_date]
@cs95 Yes, that's exactly what I said: '"concatenation" has different meanings based on the context.' But IMO it's better to say "string-concatenate" when you mean "string-concatenate", in pandas context, otherwise people will start talking about pd.concat (dataframe/Series concatenation).
 
@smci No problem. I'm still a bit confused on what you're wanting to do, though. Are you interested in building a queryable model for finding duplicates? In that case, you would probably want to use the data dump in archive.org instead, build some sort of embeddings from questions and use some sort of KNN for matching duplicates with % of certainly.
Re:API, I've done a couple of things with it, the most recent being a script to monitor my canons. It's not much, but it's honest work (:P)
 
@cs95 Well, my specific use-case is I want a gigantic dupe-tool of Thor that aggressively identifies duplicate and bad questions on basic pandas things (with clearly identifiable and standardized keywords), like concatenation (or "long-to-wide-form" or "pivot table"). Then I can manually post findings here and we can discuss. Otherwise the primordial mess that is the tag will never get back into the primordial bottle.
 
9:17 PM
@cs95 umm.... are you the same person that commented on github for pandas regarding excel output and column widths, or is it just the same display picture?
 
@smci If your aim is to monitor new/incoming posts, the API is what you want. If you're looking to build models with a lot of data, start with archive.org :)
 
..instead of the harder questions that do not have any clear, identifiable or standardized keywords, or questions that simply say "My input looks like X, here is my current code, I want the result to look like Y"
 
@JonClements Not me. Definitely the same DP, and possibly the same guy I lifted it from :P
 
@cs95 No, I think I was clear I was talking about the 11 years of existing gloop in the . First we need basic canonicals for common everyday things. (of course the answer change/ evolve/ become obsolete/ have different big-O performance as pandas versions evolve (and also Python 2.x/3.x versions). And it doesn't help that many pandas users are still in production on 2.x. So, extreme fragmentation (just like Android versions :)
...^ That's why I keep saying that any pandas question about performance without a pandas (and Python) version number is bad. Except that iterating through a dataframe, df.iterrows(), + string concatenation and so on are to be avoided.
 
9:24 PM
It wasn't clear whether you were talking about new posts or the existing ones. I think there's a lot of trash lying on the floor and the first port of call would be to start by applying close and delete votes on bad posts.
because those are the low hanging fruit IMO
This would be a good place to start deleting. This would be a good place to start closing.
 
9:53 PM
Pretty convinced there is a lower bigO for stackoverflow.com/q/56638423/2336654 @cs95 now I'm dwelling on it.
 
10:05 PM
@piRSquared I can confirm it is possible with searchsorted but it is tedious.
 
that is what I was going after right now.
if I find something I like, I'll post it
 
If you can figure out a vectorised method to determine if the value at the index or the one to its left is the smaller one, I'd love to see it. That's one problem I can never find a good solution for.
 
10:41 PM
@piRSquared niceee, that is more or less what I had in mind as well. Only thrice as easy on the eyes :P
 
02:00 - 16:0016:00 - 23:00

« first day (3166 days earlier)      last day (1787 days later) »