« first day (3257 days earlier)      last day (1683 days later) » 
00:00 - 15:0015:00 - 00:00

Paz
3:01 PM
Do anyone know how do I use subprocess.Popen() to run 'dir' with shell=False?
I'm stuck at it for so long
 
I'm pretty sure dir can only be run with shell=True. Are you 100% sure you need subprocess at all for this? Is os.listdir() insufficient for some reason?
 
@Kevin Usually when dealing with random variables, I don't think there is anything "random" about them. Instead, I view them as a measurable function that we just don't know all the details about. See the wikipedia page for more details.
This makes no notion of evaluating a random variable. Instead of running multiple simulations, this is circumnavigated by understanding that there are certain things I'm just not allowed to know about a particular random variable. Furthermore, I am allowed to know certain things, like Var(X), E(X) etc... but otherwise nothing else I known. So in some sense the mathematical def has no non-determinism...
At least I think, it's been a while.
 
Paz
@Kevin What does os.listdir() do?
Does it run on the shell?
 
os.listdir: Return a list containing the names of the files in the directory.
 
deterministic non-determinism that isn't even pseudo-non-deterministic.
 
3:04 PM
It does not interact with the shell in any way, as far as I can tell.
 
Paz
ok, got it
thanks
but what if I want to use a path?
Or use dir on the current folder? it won't accept no arguments or '' as argument
:47316498
 
You can provide a path as the argument to listdir. For example os.listdir("C:/users/kevin"). You can do os.listdir(".") for the current working directory.
... But I'm pretty sure os.listdir() with no arguments gives you the files of the current working directory, too. I'm surprised that your version doesn't accept the zero-argument form. Maybe that's a new feature?
Ah, new-ish: "Changed in version 3.2: The path parameter became optional."
Try upgrading to Python 3.7, it has amazing features such as:
- zero argument listdir()
- ... And many more!
 
Paz
Oh, yes. It's for a school project, we're working w/ 2.7 for some reason
 
cabbage
 
@Dair What I'm hearing is, "when doing formal analysis of an algorithm, it makes sense to view 'random' numbers as opaque objects whose concrete values are never known, but whose properties (minimum, maximum, distribution, etc) can be deduced. From this standpoint, f = lambda: random.random() can be considered deterministic, because 100% of the time it returns an opaque object with the properties (minimum=0, maximum=1, distribution=flat)"
This seems sensible to me, although I expect analysis gets real hairy when execution branches based on the concrete value of a random value. f = lambda: g() if random.random() > 0.5 else h() may cause your analysis to end with a piecewise Frankenstein's monster
In the worst case you've got to solve the Halting Problem to make any useful observations about f's return value. But I suppose that's not an issue that's exclusive to algorithms with random numbers
Aside: I nominate "when execution branches based on the concrete value of a random value" for the Garden-path sentence of the day.
"Ok, there are some execution branches, and they're based on the concrete value of a random value... Where's the second half of the clause?"
Revision: "I expect analysis gets real hairy when program execution goes down one branch or another based on the concrete value of a random value"
 
3:34 PM
you may want to take a look at "dependent types"
 
@Kevin If I were you, I'd say you were looking for trouble. But by all means let the self-flagellation continue.
 
Even if 100% readers understood my meaning in practice, in theory a reader could misunderstand me, and so I must be punished
 
hi, do you recommend biggeners to use libraries and expert them, or invent there own algorithims and ... to solve there own problems?
sorry for the spelling mistakes
 
To a beginner, i'd say "get a thing done. do it any way you like".
 
If you're the type of learner that's motivated by getting stuff done, then use libraries. If you're motivated by solving problems from the ground up, don't use libraries. If you fall between the two extremes, use libraries sometimes and invent your own solution sometimes.
 
3:48 PM
I'd say "don't avoid libraries just because you're afraid of having dependencies"
 
If you're not enjoying yourself, try the other way
 
Generally, you'd end up finding out it's a lot easier to let libraries do most of the heavy lifting, with some custom logic as you need it
 
I suspect the average Python newbie is closer to the "get stuff done" category. If they weren't, they'd be learning assembly instead of Python.
 
now now now, easy there Kevin :P
 
i don't know. but in the rise and fall of programming languages, i think building from the ground-up is better, right?
@Kevin take it easy,hhh.
 
3:50 PM
If that is what you think, then you're mistaken.
 
@moeassal to actually know what is worth building, it is advisable to learn with libraries first
 
@ParitoshSingh why??
 
You must walk before you can run. Leverage off of the efforts put in by others at first. start digging deeper into small, managable sections.
 
it helps to have seen a house before laying bricks
 
That is why. ^
 
3:52 PM
@ParitoshSingh makes sense.
 
Essentially, if you try to take too much on your plate at once as a beginner, you may lose sight of the goal, or start getting frustrated too quickly. Programming should be fun
 
There's an argument to be made in favor of ground-up learning. If you learn to use the heapq module, then you will know how to create a heap in Python, but you will not be able to create a heap in any other language. If you learn how to construct a heap using nothing but a primitive collection type that has indexed access and .append, then this knowledge will be communicable to any other language that has that type. And there are quite a lot of languages that do.
 
Agreed. But i'd say that argument is worth exploring once you can get something working with a heapq in the first place so to speak. An intermediate stage of programming
 
@Kevin you probably won't know why you'd need a heapq or why you'd built it that way -- most importantly when to need/build something else
 
But consider: if learning heaps from the ground up takes ten times as long as learning how to use a heap library, and you only plan on learning five languages in one lifetime, then learning to use each language's heap module is still twice as efficient as learning to write your own heap implementation.
 
3:55 PM
on a totally unrelated sidenote: I've just eliminated the last usage of a heapq in all my active programs
 
I think if you've figured out that you need a heap then you already know how they work and what they're good for, no?
 
@Kevin The trick here is to not lock oneself into not learning heapq ever, and so i'd call this comparison skewed.
 
@Aran-Fey something something leftpad
 
@Aran-Fey To some extent. I have a pretty fuzzy idea of how heaps work, but I know they're good for implementing priority queues.
 
so, a good enough idea? ¯\_(ツ)_/¯
 
4:03 PM
Yeah. Kind of like how (almost?) nobody in here could describe how Python dicts really work under the hood, but a lot of us could give the big O complexity of every dict method, which is good enough
 
I just expect that heapq.heapify called on your python file will refactor it so that it uses heaps
 
We all work with a certain level of abstraction away from machine code.
 
Hello, Android!
 
@Code-Apprentice python? ;)
cabbage
 
@AndrasDeak lol...cabbage to you, too
guess I thought I was in another room
 
4:17 PM
I figured :)
You're in the Good Place
 
@AndrasDeak Are you familiar with scipy.optimize.leastsq()? I need to pass in a "guess" to seed the algo. How do I determine a good guess to start with?
 
you have to know something about your model, or just hope for the best :P
meaning choose a value that you think is reasonable
If nothing is reasonable, use zeros or ~ones on the right magnitude scale.
 
well, with the current data set, I'm working with, I can fit some inputs with one guess and other inputs with a different guess.
 
@Arne I see some weekends being allocated to this :)
morning cabbages all, I have survived the plague that took me offline over the weekend
 
@Code-Apprentice have you explored bisection* based optimizers, say brentq?
 
4:22 PM
if there are multiple local minima (non-convex problem) then the one you find can easily depend on the starting point, which is probably why scipy refuses to guess on your behalf
@inspectorG4dget belated get well soon
 
@AndrasDeak many thanks. I'm still not out of the woods yet, so not quite as belated... :)
 
If your problem allows, i find the guarantee of a solution nicer to work with, within a certain interval. But depends on whether you can give a range that will have a solution for sure or not
 
@ParitoshSingh also number of dimensions, right? Something tells me you can only do that in 1d
 
@ParitoshSingh nope, I don't know what those are. I'll take a look, though.
 
I have a saddle point in mind
 
4:25 PM
Could be. the main requirement from a practical solver perspective is that the sign changes between the interval. (so odd number of solutions within the interval)
But i am not quite sure i can understand how dimensions play into that.
 
Well...do you have an "interval" when you minimize f(x,y) with respect to x and y?
say, f(-1, -1) and f(1,1) are positive, f(-1,1) and f(1,-1) are negative
 
I'm reimplementing some R code in Python. This code does a non-linear regression on 10 sets of (x,y) points. With an initial guess of [1,1], some of the curves come back with "'Number of calls to function has reached maxfev = 600.'" So I'm hitting the specified maximum number of iterations. On solution is to specify a higher number of allowed iterations, but I think it will be better to use a different initial guess for the parameters.
 
yes, that's a more likely solution
How complicated is your fitting model? If it's something like a Gaussian (probably not) you could approximate some parameters from mean and variance.
 
hmmm...I'm looking into staring with [1,1] then doing [10,10] and continue to increase the order of magnitude. Probably don't need to go past [100,100] for this.
The function I'm fitting is called "4 parameter log-logistic"
 
Is it reasonable for the two values to have the same sign and magnitude?
 
4:30 PM
Ah i see, so independent variables then. I think the solvers like brentq expect only 1D, you're right
 
I think the first parameter is almost always negative for the data I'm using
 
so...give a negative guess ;)
 
well, with my current example data, I'm getting good results by increasing the order of magnitude
 
still you should make the life of the solver and yourself as easy as possible
and it's not always trivial to get from +100 to -100
 
OH SNAP!
 
4:33 PM
imagine looking at local derivatives to make a step guess...
 
yah, just changing my guess from [1,1] to [-1,1] seems to do the trick
your a genius, Andras! +100 quatloos
 
this was no proof of my genius, but thanks anyway :P
 
well, any rubber duck is a genius when they find the right solution
 
@Kevin Personally I think an assembly language should be a second language. That way, the unmotivated will just learn one, so as long as it's Python they'll be fine.
 
in before "How can I inline assembly into my python code?"
 
4:42 PM
import ctypes, probably
 
How to change this assembly code of 5 lines into 1 line?
 
@ParitoshSingh But people start at different levels and go to different depths. Isn't life interesting?
 
Indeed!
 
@AndrasDeak A quatloo's a quatloo.
 
Don't look a gift quatloo in the mouth. If you do, contact your doctor immediately.
 
4:54 PM
But first, rinse thoroughly with cold water.
 
And under no circumstances should you think about pink elephants
 
I am not thinking about...oh. uh oh.
 
Oh, that's a shame. It's ok, you can still live a rich fulfilling life.
 
Albeit a short one.
 
That was a rotten trick.
 
5:00 PM
Expose your children to the Pink Elephants meme in order to develop a resistance to more dangerous intrusive thought processes in adulthood
Fifteen years ago the recommended cognitive vaccination schedule contained several doses of The Game but it has since lost its efficacy thanks to overuse
 
@Kevin i think dics basically work with some kind of hashing table that lets you quickly select a sub-element (between O(1) and O(N)), right guys?
 
Basically. "It's a hash table, with some fancy bits" is how everyone imagines dicts. But the fancy bits comprise 90% of its behavior and nobody knows what they are
 
I can confirm hash tables are involved
 
are we talking CPython or PyPy dicts? and does anyone know what Jython and IronPython are doing?
 
I'm always talking CPython
 
5:04 PM
CPython is the python programmer's spherical cow in a vacuum.
 
@Kevin What Would KevinScript Do?
 
on an infinite plane of uniform density?
 
when you say a few fancy bits, do you mean literally bits (kinda like the extra bits in a red-black tree)
 
no, some additional indirections
for example, the hashtable does not store key->value, it stores key->index for a separate array of index->value
 
KevinScript's development slowed to a trickle at the exact point that I decided "ok, time to implement a dict to go with this dict literal syntax". So... Nothing. KevinScript would do nothing.
 
5:06 PM
that's why dict's are magically insertion ordered these days
 
The problem with implementing a hash table is that I'd have to implement __hash__ for like ten other built-in types
 
that sounds horrible indeed
 
return 4?
and then after 10k hash attempts if you still have a collision, raise NotImplementedError
 
@AndrasDeak LOL. cbg
 
raise YouReturnToTheMysteriousShopTheNextDayOnlyToFindABrickedUpWallError
You question a passerby. "KevinScript? Why, that language has been closed for forty years!". A cold autumn wind blows through your very core.
 
5:10 PM
spoopy
 
🎃 'Tis the season 🎃 (said while ignoring the fact that it's still summer)
 
5:28 PM
is it possible to patch a global variable while testing? There's this answer stackoverflow.com/questions/38336090/mocking-a-global-variable but it's specific to the asker's needs.
 
A totally hypothetical question but maybe someone faced the reality. If you have a flask app with a Postgres db, gunicorn serving the webapp and Nginx as the reverse proxy, what fails first on scaling?
 
I'd like to add that question, at about what scale?
 
@aadibajpai I think this question came up in here earlier this month and we came to the conclusion that it's possible if you run eval on the function's code object. I'll see if I can find the message.
 
@Skyler A nice addition to my hypothetical :) I think nginx will outlive a conventional Postgres setup tbh but I'm curious about whether people went through the barrier of obsolescence
 
Aug 23 at 16:49, by Kevin
Ah, this tutorial has a fun snippet that lets you swap out the globals dict of a function: eval(func.__code__, new_dict_goes_here). I recall that @ParitoshSingh had a problem the other day and we were looking for a solution like this.
x = 23
def func():
    return x

print(eval(func.__code__, {"x": 42}))
#result: 42
 
5:34 PM
and you can use something like {**func.__globals__, 'x': 42} to update everything else
 
Hmm, it occurs to me that this only works if the function doesn't have any arguments.
 
if you mutate func.__globals__ it will stick, so... :D
if only we could copy functions and swap out the globals... #callback
ah, dict(orig_dict, new='val') is a perhaps-readable version of that update as long as the key is a string
I guess putting a **kwargs in there would defeat the purpose
 
If it's not obvious, I consider this eval trick to be a last resort. If any of the answers on that page work, use them instead.
 
user10984358
guys, what is a relatively lightweight module I can use to create a thumbnail for mp4 videos?
 
I suspect the most lightweight solutions involve out-of-python programs such as ffmpeg or imagemagick
(but this is just a hunch)
 
user10984358
5:49 PM
I saw some suggestions rooting ffmpeg
 
user10984358
I want a python module, PIL seems like it would do it but I wanted to know if there were alternatives
 
PIL is pretty good at making images. Things it is not so good at: opening an mp4 video, using artificial intelligence to choose the frame that best represents the content of the file, and updating the mp4's metadata with a compressed version of that frame.
 
user10984358
I dont care about the suitable thumbnail tbh'
 
user10984358
I just want a thumbnail as long as its an image from a video that shows something
 
then I suggest 300x300 black white pixels
 
user10984358
5:52 PM
lol
 
user10984358
:p
 
user10984358
so I am better off downloading the image that shows before I click the play button and save that as thumbnail?
 
If the only other alternative is using AI etc etc, yes
 
user10984358
is ffmpeg installed by default on windows ?
 
well if they figure out the mp4 part they can always use the middle* frame
@TheNamesAlc ha
 
user10984358
5:54 PM
then I dont have to worry about that I guess, I could get the middle frame but I need cv2 or something to open a file
 
Are you currently expanding your web scraping endeavours to copying entire content? Might as well copy the ratings and comments too etc. :P
 
let's see... The only instance of ffmpeg I have on my machine is in my ImageMagick install directory.
 
user10984358
well I am downloading the video along with the caption and hashtag
 
user10984358
I am just reposting that by adding the word repost to the parts I copied :)
 
Repost bot? Until now I thought you were a regular criminal, but now I see you're attempting a crime against humanity.
 
5:56 PM
I'm going to politely assume that all of this is allowed by the site's Terms of Service, and will now stick my fingers in my ears and hum in case you say otherwise
 
user10984358
well I am crediting them after all, also its not commercial
 
*tells Kevin "they're probably violating a ToS or two" in sign language*
@TheNamesAlc that's good (really, it is)
 
user10984358
lol its not a crime if you credit them :)
 
Aw shucks. Now I'm morally obligated to give Alc bad advice in order to undermine his project from the inside.
 
don't forget user and direct link to original message
 
5:58 PM
I suggest lots of global state, camelCase variable names, and have you heard that default mutable arguments are all the rage?
 
and don't add crappy watermarks of your own but based on your latest question I doubt that's at risk
 
user10984358
doesn't the repost app do the same thing ?
 
user10984358
it just adds the word repost to the image
 
@TheNamesAlc you seem to be assuming I even know what medium you're talking about
 
user10984358
well my bad, repost app is just an "official" version of what I am doing
 
5:59 PM
Because I don't, nor do I know any "apps" as kids these days like to call it
 
I also don't know what this "repost app" is. Is this for reddit? Imgur? digg?
 
user10984358
Instagram
 
Slashdot, it's got to be Slashdot
 
if it's instagram there's no harm you can do, knock yourself out
 
user10984358
for real?
 
user10984358
6:01 PM
@Kevin its called repost app that's it
 
meaning I don't care what happens to instagram :D
 
user10984358
 
it's one of the large sites that are not whitelisted in my noscript
 
user10984358
well to each his own
 
user10984358
I just created an account so I can test this out, not a fan of what it encourages though
 
6:02 PM
If we had half the effort that goes into Instagram going into other causes... :'(
 
@roganjosh ...we could build twice as large facebooks!
 
Instagram is that site where people post pictures of their breakfast and beach vacations, right? It's hard to steal someone's intellectual property from there since there's nothing intellectual about it. </elitist>
 
user10984358
Mr. Zuck knows what he is doing
 
Why is a separate app needed to share a post and credit the author? I'm out of touch with social media but I didn't know I was this far out of touch.
 
user10984358
@Kevin one man's post is another man's data :P
 
6:03 PM
all those selfies will be quite valuable when the AI megagovernment kicks in
 
@AndrasDeak A truly noble cause. So many "likes" to transform lives!
 
user10984358
@Dodge iirc you cant "share" like in facebook, no official way to download images as well, so if you want to share something you need to use that
 
@Dodge because I suspect that there's no built-in "retweet" functionality so you have to copy the content and add attribution manually.
either that or people are even weirder than I assume
 
That is baffling, I'm actually glad I don't know about "Insta"
 
Did I just land in another chat room? What's happening?
 
6:05 PM
the think tank is thinking loudly :P
 
user10984358
I take full responsibility for what is happening
 
user10984358
:)
 
Try coming here when several people change their avatar on the same day
 
this is the "iowait 390%" equivalent for the room
 
@TheNamesAlc I see that :o
 
6:08 PM
cabbage
I need catharsis: I just spent an hour debugging something that was the result of all my methods being indented to define inside of the init
 
The most painful mistakes are the ones you're least likely to make again
 
6 hours ago, by Andras Deak
half an hour ago I managed to smear my pizza all over the wall and floor of my oven :'(
there, now you can feel better :P
 
Aug 29 at 19:01, by roganjosh
Huh. Only an hour of file edits and maybe 20 server restarts, jimmies not quite in overdrive, before "hurr duhh, I'm reloading the wrong server". I'm improving :P
 
Will it help if I say an hour debugging is not that bad?
 
Comfort yourselves by saying "at least I didn't spend a full week debugging my program only to finally discover I needed to change open(filename, "r") to open(filename, "rb") like Kevin did"
 
6:21 PM
Sep 6 at 19:26, by Andras Deak
Oooooh yam. I've been on and off looking for a bug in my code for months. Yesterday when I got to it again I realized that one of my input files were wrong. Rerun proves that the code was working fine all along...
it's not a race but I'm clearly winning
 
@AndrasDeak Ooh I should eat lunch. Hot pizza or cold?
 
the final production version, about to be eaten
 
And if you translate those times into the time it would take a Normal to solve these problems it's like three months and one year respectively ;)
 
6:35 PM
<has had to order pizza on its mention>
 
6:54 PM
@Kevin You realise your programming career will be over in thirteen years.
 
I think, on the whole, I would feel more comforted if I was being compensated for my bug finding ;)
 
@roganjosh Not Postgres.
 
What the... When I try to reply to holden's message, it just stars it.
Anyway. Thirteen years is what I'm hoping for, if my stock fund does what it's supposed to
 
No stars for holdenweb ...
 
How can you have a star when you are a star
 
6:57 PM
@Kevin Ah, the eternal optimism of unshafted youth. This comment is in no way a reflection on my own determined ambition not to cash in on my skills.
 
@holdenweb I'm gonna guess through this cryptic response then that it's gunicorn?
 
I wouldn't mind programming for forty more years if I could find a way to extract productivity from my whimsical development style
Good for gifs and numerical puzzles, not so good for CRUD web apps
 
I'll take the Monty Hall problem presented by the obscure answer :)
 
Why stop coding? As long as my eyes still move I should be able to interact with the computer.
 
Python looks fun
 
7:10 PM
@Dodge Hopefully Neuralink will be out before I ever need anything like that.
 
Trying to decide whether Holden 1) was taking my Needful Things reference and parlaying it into an IT reference by implying that my career would end because I would be devoured by Pennywise the next time he awakens (although I think that's actually every 27 years); or 2) implying that in 13 years I would be on the management career track and I should cherish my self-directed projects while I can; or 3) making a bona fide psychic prediction about my future in an eerily unspecific manner
 
Gonna start using it more.
 
@JBis That's because it is fun. ;)
 
@JBis welcome to the asylum our midst
 
@toonarmycaptain Ohhh, see, even more reason to never stop
 
7:13 PM
@Dodge Now...if the brain can take it's power from the link, we will be able to while True: laugh_manically()
 
XD
I'm coming from JS. Some things seem similar.
Like functions are objects.
 
everything's an object \o/ (and dicts I guess)
just embrace the whitespace
 
I'm trying to remember my dumbest Python bug, but nothing comes to mind. :D These days, I tend to catch bugs fairly quickly, before they can do too much damage. And anyway, most Python bugs are pretty mild, compared to the stuff that can happen in languages with pointers... and old compilers that don't warn you about dubious things.
Jan 23 at 0:49, by PM 2Ring
Even veteran coders still make silly mistakes from time to time. But we tend to catch those mistakes pretty quickly because we recognise the symptoms through past experience. ;)
 
Thats the only annoying thing. Python is very particular about the white space.
 
you'll get used to it over time
 
7:16 PM
I put off learning python due to whitespace, but when I decided to switch I never regretted it and honestly you get used to the whitespace very fast.
 
I started following a youTube tutorial on godot today... just because. Then I get to clicking "play" and apparently I can't do that on this laptop. My new epic game was just around the corner
 
@JBis No, that's one of the best things. But it may take you some time to fully appreciate that.
 
The annoyance of whitespace is isomorphic to the annoyance of curly brackets. It all evens out in the end.
 
@PM2Ring to be fair that's exactly what someone with Stockholm syndrome would say
 
But I love keyword args
 
7:18 PM
Like Andras, I thought the whitespace thing was dumb. It put me off learning Python for about 4 years.
 
... and then you found out that it didn't need to be four spaces - that it could have just been two spaces, and you could have started learning the language two years prior? :P
 
nooo :P
 
Finding the "automatically convert tabs into 4 spaces" option in Notepad++ was very important for my adoption of the language
 
apparently google code style guidelines say two-space indents
 
They say that for tensorflow, I'm not sure it's their general guide
 
7:22 PM
@inspectorG4dget and that's exactly what an evil organization would say
 
@inspectorG4dget it isn't
 
@roganjosh sorry, I should have been more specific: their internal style guide
 
I did try 2 space indents for a while, but I eventually decided that the minor increase in line space wasn't worth the cramped look of the code.
 
Whats the MDN of Python?
 
@AndrasDeak shifty eyes
 
7:24 PM
(Really good resource for everything python)
or just the python docs
 
the officlal docs for stdlib are usually pretty decent
 
the docs are pretty good once you are used to searching through them
 
Goes without saying. Python 2 doesn't exist *jedi hand wave* pythonclock.org
 
Wow. I'm in just before it goes out.
 
7:27 PM
@AndrasDeak sobs silently if only that were true
 
@JBis joke?
 
Wordplay, at least
 
or you mean you're in python 3 just before 2 goes out? :P
 
That was my interpretation.
 
phew
 
7:28 PM
I've just joined the python community in time for python2.7 going out to be significant for me.
So I can celebrate with y'all :)
 
OK, thanks for clarifying :)
 
And then it will just be Python
 
@JBis Some of the things that seem similar on the surface are actually quite different, because Python uses a somewhat unusual datamodel. See nedbatchelder.com/text/names.html which is essential reading for anyone coming to Python from most other languages.
 
`python3` → `python`
`pip3` → `pip`
?
 
When I started I had to decide whether to learn Python 2 or Python 3, which was a totally pointless noob dilemma considering that the majority of stuff a newcomer will encounter between the two is nearly identical.
 
7:31 PM
@PM2Ring thanks
 
@Dodge where things don't matter the difference is trivial. Where things matter the difference is crucial and python 3 is the one that isn't broken.
 
@AndrasDeak yup, looking back it was a useless worry. I agree
But I still don't know enough about those critical differences
 
the primary one is unicode text vs bytes
$ python3.7
>>> 'this is text'.encode('utf8')
b'this is text'
>>> 'this is text'.encode('utf8').decode('utf8')
'this is text'
>>> 'this is text'.decode('utf8')  # decode, encode, who remembers! but text can only be encoded into data (bytes)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'decode'
$ python2.7
>>> 'This is text. Or is it...?'.encode('utf8')
'This is text. Or is it...?'
>>> 'This is text. Or is it...?'.encode('utf8').decode('utf8')
 
I'm looking forward to forgetting the entirety of my "upgrade to Python 3, it's better" spiel, as I will no longer have a use for it
 
and of course why the above is an issue in pythoff (2.7):
 
7:39 PM
@MisterMiyagi If it's any consolation, you are not alone. Plenty of Python devs working in the VFX industry (video effects, including stuff like Maya) are still using Py2.
 
>>> u"This is Sierpiński's text"
u"This is Sierpi\u0144ski's text"
>>> u"This is Sierpiński's text".encode('utf8')
"This is Sierpi\xc5\x84ski's text"
>>> u"This is Sierpiński's text".encode('utf8').encode('utf8')
 
Jul 29 '18 at 16:26, by PM 2Ring
@davidism Lucky you. People in the Video Effects industry are obliged to fully support Python 2 through 2020, due to their industry standard, as I recently mentioned here. It saddens me to think that these people are currently starting work on new Python 2 libraries.
 
@AndrasDeak Thanks for that example
 
The problem being that a piece of bytes is either text or data and you can't tell from the type. If you write buggy code it might only become evident the first time someone puts non-ascii text through your program.
 
jeez I keep on putting brackets and semicolons from habbit
 
7:41 PM
Semicolons are allowed, so you can wean off those slowly
 
The corollary is people then switch to 3 and if they don't know better they deduce that "this used to work in 2, now it breaks (because, for instance, strings don't have a .decode method), so python 3 is bad, let me go back to 2". Whereas the conclusion should be "oh, wow, python 3 forces me to fix my latent bugs. Thanks, python!"
 
What IDE's do you guys use? I'm using PyCharm because I like JetBrains and know their products decently.
 
Notepad++ and cmd, who needs intellisense
 
vim and terminal, so basically what he said (just better)
 
7:44 PM
@Kevin I do
 
In that case, don't use Notepad++, terrible autocompletion support
 
@Kevin I blush.
 
And those latent bugs Andras mentioned may not even surface for simple non-ASCII text that uses codepoints < 256. So it will work ok on accented chars supported by Latin1 (or whatever codepage your system happens to be configured for), but try it on more exotic accented chars, or emojis, and it will do weird things. If you're lucky, it'll crash. If you're unlucky, it will silently churn out mojibake.
 
No. I'd lay money on the flask app (but not much). It was a pretty open question.
@Kevin Look for smaller markets, not wider appeal. Embrace the smile curve.
@Kevin None of the above. Just shooting the breeze.
 
Good, good. An air of whimsy/mystery/nonsequitur is essential for a proper Python room.
 
7:59 PM
Too bad, real prophecies are the vaguer, the better
 
There's a fresh question on SF&F: Near future dystopian USA where rampant disinformation has destroyed "truth" This comment's got 10 upvotes:
Are you sure this was fiction? ;) — Zeiss Ikon 3 hours ago
 
My ideal career path is to be locked in the palatial suite of a scheming tyrant who takes my discarded scribbles and uses them as the basis of revolutions in the design of civil infrastructure, transportation, defense, etc
 
Sounds like Leonard of Quirm.
 
Sounds like POTUS
 
I know where all the swinging blade traps are in the hallway so I can leave whenever I want, but it's quiet and the wifi is good, so.
 
8:05 PM
@inspectorG4dget "Thus spake the Lord: Thou shalt indent with four spaces. No more, no less. Four shall be the number of spaces thou shalt indent, and the number of thy indenting shall be four. Eight shalt thou not indent, nor either indent thou two, excepting that thou then proceed to four. Tabs are right out." wiki.fysik.dtu.dk/ase/development/…
 
and BDFL crushes every other convention! :P
 
I assume the discarded scribbles are the ones that didn't make the cut and all of the good ideas are kept hidden away from this scheming tyrant in a attempt to undermine his power and topple his regime
 
The non-discarded ones are mostly cool looking renders that I display prominently on my fridge
Maybe one or two death rays, though. Maximum.
 
@PM2Ring funny thing is how bilateral the misinformation is though,
and how blatantly thats denied by both sides
 
I'd rather not go into actual US politics here beyond the occasional pop culture jab
 
8:11 PM
^ That
 
my acronym refers to "people on the urban subway" ;)
 
true, I'm sure we can all treat this as a scalar and agree on the intensity at least
so thats a good jab to leave it at
 
can I set up wsgi to work with nginx w/o systemd? I'm inside a docker container and don't have systemctl available. But the guide I'm following sets up some systemd unit service then uses that in the nginx conf. digitalocean.com/community/tutorials/…
I'm deploying a flask app if that helps.
 
8:27 PM
oh I do, have access to the service command btw
 
@smci Both hammered. I hope those are good dupe targets, since I'm a Pandas ignoramus. ;)
 
 
1 hour later…
10:06 PM
I've decided to track down my python 2 answers (just a few) and update them to python 3. In the process I discovered that foo.com and other sites are forbidden (foo.com must have been added in the past few years because originally the system let me (and an asker) write our posts containing foo.com).
I can't be bothered to make it decent and importable and foolproof and whatnot, but if anybody else wants to play with something like this here's a gist for grab_all_answers.py -> find_pythoff_candidates.py which first tries to download all your answers via the API (quota permitting), then checks each answer for print statements and xrange (the two likely candidates in my case).
I guess tkinter and some others could also be relevant.
 
 
1 hour later…
11:32 PM
@PM2Ring Sorry I messed up, please reopen. Turns out even pd.merge(..., how='inner') still takes the union (instead of intersection) of the columns; it only drops common rows not columns.
@AndrasDeak Good work. While we're at it, other recent 3.6+ changes that affect old 2.x answers include you can now use f-strings/format(), dicts now guaranteed to be ordered, etc. Anything else major?
...and pd.merge(left, right, on = left.columns, how='inner') gives error if right doesn't have all those columns in common.
 
@smci Oh, ok. You don't have a valid dupe target?
 
00:00 - 15:0015:00 - 00:00

« first day (3257 days earlier)      last day (1683 days later) »