« first day (2560 days earlier)      last day (2613 days later) » 

06:07
cabbage
06:46
cabbage
07:05
cabbage
07:26
cabbage
07:37
cabbage
jjj
jjj
08:34
cabbage
 
2 hours later…
10:14
cbg folks
I have to recommend a good and pythonic course for our apprentice developer who wants to become a full stack dev. Ofc my first idea was to make him read the official docs/tuts, but it is not a course, he is not forced to do exercises.. I also find the Full Stack Python which we did not list on sopython -- at least it is a bit more specific..
any other suggestions, ideas?
@PeterVaro what does he know now?
The python tutorial level knowledge is an absolute requirement for anyone who intends to learn from anything other than the... (gulp) django tutorial
so, at first I'd say that they should read through the official tutorial
@AnttiHaapala he is pretty confident in Python now, knows the basics. but he is missing obvious skills like debugging and what have you -- which are ofc unrelated to python. More advanced things, like extensive use of dunder methods, for/else, finally blocks, itertools, functools, meta classes etc. are still missing
@AnttiHaapala that's exactly what I've said
so I'd say he should actually go through the tut anyway.
and some beazley videos :D lol
:D
@AnttiHaapala is there a course that is built on top of that tut?
that would be lovely, cause in that case we could just leave him to do as he pleases :)
idk, pyramid tutorial does go in rather detail.
@PeterVaro no matter which stack you end up using, I'd recommend the pyramid tutorial because pyramid's got the sanest packaging conventions etc.
10:35
@AnttiHaapala that actually look good!
cheer, mate!
11:02
recbg
11:36
cbg
does someone have any idea how to extract only name entities or location entities using spacy
@enderland you've been overtaken meta.stackoverflow.com/a/358027/5067311
list(tokens.ents) it is giving all entities
can't you...filter those entities yourself?
[John, New York, Saturday, morning]
something tells me that if you can't distinguish names from locations then spacy won't either
anyway, I've never heard of spacy
11:40
spacy is popular
python library
I was hoping that it's not haskell
my point was just that I can't really help you beyond suggesting reading the docs and googling the problem
popular. Sure. If you are working on stuff like that. So it's popular in that domain.
popular is good because then the interwebz are full of informationz
It seems like a problem that can be easily solved with a bit of reading in to how that packages list methods work...or whatever it supports.
12:20
How can I see which functions become deprecated and what their substitutes are? I think Timegrouper was deprecated because this months = [g for n, g in d1.groupby(pd.TimeGrouper('M'))] no longer works
deprecations usually come with deprecation warnings before something is actually dropped
"no longer works" leaves a bit too much legroom
There was a deprication warning
was there?
yes. i am running it again to verify
perhaps it is time to google "pandas timegrouper"
12:28
Please rate our bot, Andras based on the relevancy of their response
1 - 10
★★★★☆
Thank you. Your feedback is important to us.
@AndrasDeak Thanks for your help. That didn't cross my mind
Andras is not programmed to respond to gratitude
We don't want it to learn emotions.
12:32
aahhh...ok :)
too dangerous? :)
boop >:[_]
we tried it before and we weren't satisfied with the results.
There have been 254 days since the last artificial emotion related incident.
and we need to keep that counter going up
dangerous to the bottom line, maybe. Make an AI too lifelike and they start demanding a livable wage
Some bozo is trying to inline the link to a screenshot of code stackoverflow.com/questions/46830073/…
Is that a bad thing?
if it's polishing poop then yes
Well I mean the only reason why it's bad is because it wastes the time of people in the review queue
12:47
yes, and also it would give 2 rep for the editor for no reason, making them think that edits like this are welcome
@Rawing We don't want images of code, that's one of the reasons why newbies can't embed images into their question. So editing the question to turn the link into an actual image makes the question worse, and encourages newbies to post such screenshots.
That makes sense
IIRC, there are SO Meta questions asking whether it's a bug that higher-rep editors can inline images into low-rep questions. And I think the answer is that it'd be too much of a hassle to fix it.
I inline images for newbies all the time and now I'm frantically trying to remember if I ever inlined a code screenshot
If I did, here's a hasty justification: inlining a code screenshot will make the question more evidently bad to casual readers that don't like clicking on links. Thus hastening its eventual closure and/or downvoting to oblivion
Sometimes images are useful, eg if the OP's building a GUI and the widget placement isn't behaving the way they expect.
12:54
At the very least you know I'm not doing it for the rep, since I'm not eligible for that reward any more
(mcve, but mainly anti-Shaw jihadism on my part tbh)
:P
most tutorials should start with "If you get an error, read it. All of it. Try to understand it."
Hi Zero!
Wotcha.
13:11
I'm tempted to upvote this answer. stackoverflow.com/a/46830496/4014959
I like the use of blockquote to stand out from the crowd.
… which I see answerer does every. single. time ;-)
(fixed)
I think of the use of blockquotes as a subtle way of saying "I've answered this a million times already..."
...which clearly doesn't apply to that person and their 4 answers
I like that they answered without actually giving the OP any code for that too-broad question. Speaking of which...
jjj
jjj
13:27
Zero, thanks for your anit-Shaw jihaddism. I havent seen this before
that's a good one
I just accidentally stumbled upon the w unix command which shows what logged-in users are doing. One of the students has "vim HELP" written as activity. Does that mean that the proverbial "stuck in vim" thing is real? :D
cbg \o
13:42
hello
I started using python recently and thought joining in here might be nice
I can confirm, it is indeed nice.
@AndrasDeak pop fact: :D is an actual command in vim - short for :DoMatchParen, which switches on highlighting of matching parentheses etc.
@ZeroPiraeus that's a weird abbreviation
so why does :nowr not work :P
Well what would you choose as the inverse of :NoMatchParen? It's all perfectly intuitive ;-)
13:45
but :N is not :NoMatchParen :P
@AndrasDeak it's real and a clever user lock-in trick, people can't use other editors if they can't exit yours
I always say that if ctrl+c tells you how to exit, it can't be that hard
On pycharm I am debugging a program step by step, but when I F7 over a print() method, it does not print on the spot, till I finish execution program. Is there any way to make it out as soon as hits the line?
@Teomanshipahi try flushing the print?
as a quick proof of concept, add flush=True to that print call
if it works, you can decide how to do overall flushing
flush=True did not work :\
I will check other option, probably this one stackoverflow.com/questions/230751/… ?
13:49
then either pycharm is doing something fishy or something's not doing what you think it's doing
tried
print('identifiers', flush=True)
sys.stdout.flush()

not printing on the spot as well.
the sys call would set flushing to every print call
if it doesn't work on that given print, it won't work if you enable it overall
make sure your function is actually getting called when you think it's getting called
well, I just restarted pycharm and checking debug console flush=True line are coming through now. Thanks for the hint. I will take a look generic enabling.
sys.stdout.flush() <- that's probably it
and you can google "python output buffering" and the like for further perspectives
rhubarb for now
@AndrasDeak \o
DSM
DSM
14:03
Thursday morning cabbage.
\o cbg
14:33
cbg all
Created an MCVE to display the issue I'm having with Flask-Babelex and it works perfectly.
My code tests out fine both locally and in docker, but fails on the CI system
Not my best day ...
Oh boy, mgmt wants me to look into an error that was probably caused by a race condition
Two users clicking on "delete comment" at the same time and one(?) of them gets a "concurrency violation" message
DSM
DSM
At these things go, that's at least on the easier side to make show up in the lab, it sounds like.
I don't know if my local environment even supports multi-user access so I can't easily replicate it perfectly under identical conditions
I can spawn two threads that both call DeleteComment() nearly simultaneously, I suppose
But solutions that prevent two threads from running code at the same time might not also prevent two users from running code at the same time. In particular if each user gets their own process when running the application
15:01
Cbg
@Kevin you don't have two machines to login?
@Kevin can't you put a synchronised block around is it there? okay delete it. Otherwise it's all good.
Oh sorry, it's a probably, not something that just needs a solution
15:18
Hello, does anyone here knows if django gives me the possibility to do automatic tasks ? For example, each week, set up a flag for tuples inside database
I heard celery beat exists but didn't find another one
That doesn't sound like something Django should be responsible for
that is something you definitely have to implement, and you can use Django as your thing to implement it with I guess?
But what is your trigger to do this automation?
this sounds more like some type of cron job that has nothing to do with Django
Yeah cron or celery
jjj
jjj
there is also this thing called airflow
Or Quartz
I just wrote an answer that has a valid reason to call sys.setrecursionlimit stackoverflow.com/a/46833042/4014959
15:36
@RobertGrant Yeah that's what I want to do. Implementation details which I have not mentioned* keep me from using ordinary multiprocessing lock objects though
(*in particular: the code isn't written in Python)
DSM
DSM
@PM2Ring: I tend to just add a wrapper that goes up by 100 or something.
@DSM Me too. And that's what I did in my initial tests.
wim
wim
16:04
@DSM mock.patch on datetime is fraught with subtle difficulties. I recommend to take a look at freezegun.
DSM
DSM
@wim: I thought about it, but there was actually only one place I had to touch for this, so I worked around it. If it hits about three or four I'll probably switch.
I wouldn't bother patching datetime. I'd just set the times that I needed
I just set the tests to trigger the right number of milliseconds before they hit the date call, and then just get the system date
I'm looking at PEP8 (really I was trying to work through some feedback and apply the PEP). The section on comment style says:
Comments should be complete sentences.  If a comment is a phrase or
sentence, its first word should be capitalized, unless it is an
identifier that begins with a lower case letter (never alter the case
of identifiers!).

If a comment is short, the period at the end can be omitted.  Block
comments generally consist of one or more paragraphs built out of
complete sentences, and each sentence should end in a period.

You should use two spaces after a sentence-ending period.
Now...AFAIK a sentence isn't complete without a fullstop/period.
Is this worth an edit?
> If a comment is short, the period at the end can be omitted.
16:16
two spaces after periods freak me out
@AndrasDeak I just read that myself o.O
Yet another minutae of PEP8 to completely ignore ;)
the quote itself does that if you look closely
Yup, my quibble is that the comment is then not a complete sentence.
"should"
16:18
not MUST :D
one could also argue that having an exclamation mark inside a parenthesized interjection is bad form
Not just that but the two spaces isn't explicitly directed at penultimate sentences of a multi-sentence comment. Which contradicts directives against trailing whitespace, right?
@AndrasDeak I would.
16:33
After 90 seconds of googling I haven't yet come upon a definition of "sentence" that explicitly includes the ending punctuation mark
en.wikipedia.org/wiki/Sentence_(linguistics) mentions "markers such as periods" but only in the context of "delimiters" of sentences, which may or may not themselves count as being part of the sentence
It's like, are the commas in [1,2,3] part of the list?
Google "is a sentence complete without a period" - since the PEP explicitly states "complete".
DSM
DSM
You can speak a sentence, and spoken sentences don't have punctuation at all.
A good amount of these chat messages are complete sentences but are without periods. You understood them, no?
DSM
DSM
Apparently I've never obeyed PEP8 regarding comment structure. My comments fall into two categories: explanations, which are in standard paragraph format, and brief notes, which are just a few words and neither capitalized nor end-stopped.
16:42
I use periods in comments with exactly the same frequency that I use them in here.
More likely to appear in long effortful blocks, but not necessarily exclusive to them
DSM
DSM
See, switching from ending-with-a-period to not-ending-with-a-period like you did just there is strange to me.
I think I'm usually a little more consistent when it comes to the styling of consecutive single sentence messages, and I'm acting slightly out of character because we're getting meta about it
The Observer Effect at work. Never mind that I'm the one observing myself.
My comment style: I capitalize, but I rarely terminate single-sentence comments with a period. But if it's a multi-sentence comment then all the sentences will be terminated correctly.
and I derp
See, to me, in the orthographic sense (written convention) a sentence is that bookended by a capital letter and a fullstop. It might not be a good sentence (missing a verb, for example), but it isn't complete without the fullstop. We're talking about setting the orthographic/written conventions for comments.
16:50
0
Q: How to install regular python (via homebrew) and miniconda in the same computer?

tumbleweedI downloaded conda, however I would like to use pip and a regular python version (homebrew) for a different purpose, is it ok if I install python and pip via brew and then I install conda? Update after installing miniconda I tried to install python via homebrew and both python versions crashed....

I think adherence to written English grammatical standards is only weakly correlated with being able to write good comments. Conscientious programmers can write good comments even without capital letters, and corner-cutting programmers can write bad comments even if they end with a period.
DSM
DSM
As I was searching the room history to see how I typically ended sentences, I came across this gem:
Oct 7 '14 at 14:34, by Ffisegydd
"Moral of the story: be careful with shortbread." -> "While the wrapping paper industry laughs maniacally from their impenetrable oppression palaces." -> "No English teachers please, it's for the good of society"
Good afternoon! I have a question about setting up a Tensorflow implementation - would it be best to post it here (IE question on SO), or the Data Science SE?
Certainly conscientious comments are more likely to resemble grammatically correct English than corner-cutting comments, but the causation chain isn't "good grammar causes good comments" but rather "a good programmer causes both good grammar and good comments"
DSM
DSM
16:59
@Cowthulhu: if the question is about installation and configuration I'd think SO would be a better location.
@dsm
Thank you!
I may be strawmanning a bit here by assuming more about the opposing argument than was actually stated
Nobody said "use complete sentences and bam! You have reached the highest level of existence on the comment quality ladder"
@Kevin One might suggest that a conscientious programmer would write comments according to the specifications for such (eg in the PEP), which prescribes style as well as utility, and when such style does not inhibit utility, comments according to the mode dictated in the style guide.
re-cbg. Lazy day number 4 of 7
SSD and Metroid arrived today. Laziness continues to be 100%
the end is nigh
17:12
it's all good. The now is now
and the now has Metroid in it
DSM
DSM
idjaw is clearly in the "use periods only to separate sentences" camp. ;-)
Is that like ordering a raspbian pre-installed on an sd card? Metroid on SSD?
cbg
@DSM I refuse to conform to social norms!
or grammatical ones either....
frustrating that so many SO answers on git are outdated / incorrect
17:15
Guys any idea why this happens? I have allocated 200 MaxClients in apache.. but when i send 200 requests concurerntly only 15 requests handle at a time. I chekced apache status using this localhost/server-status?auto then all the 200 works are busy..
bro. reset hard -> add . -> commit -> push
i use web py framework
which limits these requests if apache is also allowing them to process?
@idjaw you ever use git add -A?
No. I usually just use '.'.
Or add manually
DSM
DSM
In the sopython-site code, a lot of functions decorated by app_route are nested in the create_app function. I tend not to like lots of nested functions because they're hard to test in isolation. Is this really the recommended approach (and since it's @davidism we're talking about, probably the answer is yes)?
17:23
@DSM can you send me a link as an example
?
DSM
DSM
In the __init__.py here.
ah, yes. OK.
So, when it comes to flask and unittesting, I always use test_client
This in turn lets you do any isolated testing you want to do. So in turn you test endpoint can be hit and unit test that method
If I were to unittest that, my setup would be to mock out all the config stuff and then I can start doing my individual tests per endpoint.
Always with the testing. Have some faith in your code! :P
DSM
DSM
Hmm. I'm not sure if that overcomes my anti-nesting reluctance. It's not just testing, it's that it blocks what's being done from inspection -- you need to actually build an app to see what's been done.
So, you're looking to inspect outside the scope of whatever Flask is wrapping around?
I do have a patten suggestion for you to do this
hold up
    @app('/my/endpoint')
    def foo(*args):
        your_func(args)

    # some other module
    def your_func(*args):
        # stuff
something like that
So, you have your Flask stuff on one side doing all it's flasky stuff, but it calls the code that you want to isolate and now you can go forward with that.
17:29
Facepalm time:
You can't just change the name of a PNG file and expect it to magically become a GIF file, they are quite different file formats. — PM 2Ring 4 mins ago
@PM2Ring walk away bruh. walk away.
DSM
DSM
I'd be tempted just to write foo = app.route('/my/endpoint')(your_func) to avoid the args, but I take your point.
@PM2Ring point them to the "wav to mp3" Q&A
@DSM For myself, that looks more unreadable.
DSM
DSM
@idjaw: I guess I could see writing it out the long way in case I might want to do some arg manipulation. I'll have to think about this.
17:32
You seem to be inching towards a ports and adapters pattern
Where you separate your logic in those compartments and having that isolation you are looking for
DSM
DSM
To do things the way I want, though, I think I might have to put everything in blueprints. I can't decorate things with app.route if the app doesn't exist yet.
Oh, wait, maybe I can use "current_app" somehow? Hmm.
No, looks like a blueprint is the way to go. I'll stop my stream-of-consciousness transcription here. :-P
nah. This was interesting/fun :P
and you reminded me I need to remind myself when to use current_app....
keep in mind, if you don't know this yet, as I got the same warning, you can't nest blueprints.
DSM
DSM
The only ones I need should all be flat, fort.
on that note. I'm going to go outside and take my awning off for the year.
Don't know how long this good weather is going to last. Don't want to take any chances
rbrb!
17:47
Is it wrong to call a thread (from the threading module) a mini process in python?
I would avoid making such a comparison
DSM
DSM
Yeah, it confuses more than it clarifies.
18:12
Is sphinx known to break on extension module (e.g. .so files) importing? Is this documented in some obvious place i've been missing?
Lunch time cabbage
Doing JavaScript today
@AaronHall are you a mod now? I haven't been around the Haskell channel lately to notice the new blue name
He got elected a couple months ago yeah
november?
¯\_(ツ)_/¯
lol
Anyways, regarding sphinx, I've read about issues running it with numpy and scipy where it is suggested you mock them... I was hoping someone here might be a sphinxter... giggles at Wayne's World allusion ... boy.
If this was a known issue, I'd figure there would be more discussion out there on it. I guess my next step is bug trackers...
Found it.
(I think)
18:46
I found autodoc_mock_imports which might help...
hey, can you install the module colorama on mac?
85% sure it's Windows only.
But I think Macs already have colored text capability without you having to install anything
> ANSI escape character sequences have long been used to produce colored terminal text and cursor positioning on Unix and Macs.
yes, but I am developing a game and i have the colorama module in it
and a mac user is testing it but he cant use it cause he needs colorama
well in case it's indeed windows only, you may find this helpful
68
Q: Conditional import of modules in Python

TimIn my program I want to import simplejson or json based on whether the OS the user is on is Windows or Linux. I take the OS name as input from the user. Now, is it correct to do the following? osys = raw_input("Press w for windows,l for linux") if (osys == "w"): import json as simplejson els...

On second thought I suspect it's possible to install colorama on any OS, but it doesn't do much on non-Windows besides bind a couple escape codes to attribute names
It would be kind of silly to create a library that tries to make some behavior OS-independent, while not itself being usable in all OSes
18:53
which would be a more correct approach given that it's a library for OS-specific functionality and does not make sense on all OS-es
is it possible though?
I think your Mac user should try to pip install colorama and see if it works
Before you try anything with catching ImportErrors
mac users dont have pip do they?
DSM
DSM
Everyone has pip! \o/
oh!
ok
so they would just have to open their command prompt and type pip install colorama?
18:56
Ah, the developer of the module has tested it on "Windows XP (CMD, Console2), Ubuntu (gnome-terminal, xterm), and OS X."
DSM
DSM
(36) dsm@winter:~$ pip install colorama
Collecting colorama
  Downloading colorama-0.3.9-py2.py3-none-any.whl
Installing collected packages: colorama
Successfully installed colorama-0.3.9
^ okay, linux, but it'll look very similar.
@EgMusic Yep that ought to do it
okay then
DSM
DSM
Is your program in modern Python or ancient Python?
Python 3.2, so its kinda modern
DSM
DSM
18:59
Ah. I was going to recommend using python -m pip install colorama, to make sure that we were installing the package in the right Python version, but 3.2 is old enough I don't think the pip module existed yet.
i was using it a while back with this version
but it stopped working about 2 weeks ago
Extra credit: package your project so your users don't have to manually install its dependencies.
Hi everyone. I'm having dificult to find the logical necessary to solve a problem. I have a pandas dataframe like this
clock eventid objectid value
0 1505960158 62704261 32219 1
1 1505962773 62711138 32219 0
2 1505400465 61216428 32233 1
3 1504642494 59208977 32254 1
4 1504643325 59210478 32254 0
Question: if what would otherwise be an inline code comment causes the line to break 79 chars, do you break the comment (and indent the second comment line to patch first), or do you put the entire comment on the next line, indented to the same level as the line commented upon?
--- clock-------- eventid ---- objectid --- value
0 1505960158 62704261 32219 1
1 1505962773 62711138 32219 0
2 1505400465 61216428 32233 1
3 1504642494 59208977 32254 1
4 1504643325 59210478 32254 0
19:11
Use Ctrl-K to preserve formatting
@Code-Apprentice thanks
We can probably figure out which column header corresponds to which values even if you can't get them to line up nicely
where valu = 1 means start time and value = 0 means stop time
@toonarmycaptain I don't think I've ever broken an inline comment up at all. If it's long, I put it above the code.
So I need to transforme this dataframe into another whit this headers (objectid, start_time, end_time)
DSM
DSM
19:14
My objections to the 79-character limit are on record. Although that's a cop-out, 'cause the same problem could happen at 120.
x = 23 #Set x to 23. We will do this because
#having x be 23 is only good and right.

y = 23 #Set y to 23. We will do this because
       #having y be 23 is only good and right.

#Set z to 23. We will do this because
#having z be 23 is only good and right.
z = 23
Both x and y look weird to me.
So lines 0 and 1 will be
@Kevin That's my inclination. I had someone on CodeReview say my comments don't meet PEP, and didn't specify as to why when I asked. shrug
32219 --- 1505960158 --- 1505962773
@joao What happens if you have more start times than stop times? rows 2 and 3 both have a value of 1, and there's only one row after them that has a value of 0.
DSM
DSM
19:17
In [17]: df.pivot_table(index="objectid", columns="value", values="clock", fill_value=0).iloc[:, ::-1]
Out[17]:
value              1           0
objectid
32219     1505960158  1505962773
32233     1505400465           0
32254     1504642494  1504643325
I'd explore the pivot and pivot_table commands. They're really good for turning data around.
("Commands," he says. You can tell I've been working on other systems today.)
@Kevin I solve this problem before the create of dataframe.
You say that, but the dataframe that you showed us still has the problem...?
DSM
DSM
I guess pivot would be a little safer because it'll object in the case of colliding entries.
There is just part of the dataframe, the real dataframe contains more than 500 rows.
I'm sure it will all work out.
19:22
Interesting. After refactoring, my archiver performs exactly the same, except faster, and except printing one less "Could not find comic image x' message, yet didn't download the missing comic.
@DSM Thanks. I was trying to do something iterating over the rows and for every row doing a lot of checks with a lot of loops. But what [:, ::-1] means. I know this is slicing notation but I don't understand the ,
@Kevin Same value but diferent objectid
DSM
DSM
@JoaoVitorino: the comma separates dimensions. See here. [:, ::-1] means "every row, and columns in reverse order". You could sort by reverse column index instead if you liked, I'm just lazy and this was less typing.
can't find '__main__' module in '' <- mutter mutter
wim
wim
Anyone elses PyCharm has been crashing a lot since the last update?
DSM
DSM
@wim: I just asked around and she reported the opposite, namely that she'd been having fewer problems lately.
wim's copy of PyCharm has been absorbing all of the crashes from the copies in DSM's office
19:33
@wim I wouldn't notice any difference :D
He's our sacrificial lamb. Er, badger.
DSM
DSM
Dibs on "sacrificial badger" as a name
Ok just remember me when you hit the big time
wim
wim
20:00
hmm :'(
It seems too much pytest makes PyCharm throw the toys out of the pram
most notably the coverage plugin conflicts with pycharm debugger (both try to use the system trace sys.settrace, and step on eachother's toes)
 
1 hour later…
21:08
@wim just don't try the "visualize your database" feature :D
 
2 hours later…
22:40
@wim I am using the Python plugin for IntelliJ and have not had any problems this week.

« first day (2560 days earlier)      last day (2613 days later) »