« first day (2593 days earlier)      last day (2348 days later) » 
00:00 - 17:0017:00 - 00:00

12:01 AM
My stock identicon looks like puke :(
 
just steal one from someone
 
that's mine.... I'm not unhappy with it
 
Huh, never thought of stealing identicons
 
Identicon theft is a big problem
 
of course I just meant playing around with hashes :P
 
12:05 AM
Generated from 'piRSquared'
 
Adam's identicon: gravatar.com/avatar/… . In there is the gravatar hash, which you can freely edit and end up with any identicon; most of them not belonging to anyone on SO
 
I'm sure there's a gravatar generator somewhere
 
^ this one has a different name
"monsterid"
 
That's so cool. I could keep editing that link for decades
 
12:09 AM
I'm a fan of my github one.
 
That could be offensive
Or a smile only shown from the cheeks down
 
I see it as a (heavily) modified power icon
 
Or a man rubbing his belly
 
alternatively, a man's nose and mustache
 
rbrb 4 coffee
 
12:12 AM
Psychiatrists should show identicons to patients and ask for their interpretations
 
would probably be as scientific as Rorschach's
 
There's a joke somewhere in there about self-diagnosing hash, but I'm not sure it's appropriate.
 
evening cabbage
 
rhubarb
 
you going to bed already?
 
12:43 AM
Yup, gotta teach tomorrow
And 2 AM soon...
 
1:00 AM
good luck
 
Thanks
 
1:18 AM
@cᴏʟᴅsᴘᴇᴇᴅ I've edited the post
3
A: Looking to rename clusters based on their size

cᴏʟᴅsᴘᴇᴇᴅThe objective is to relabel groups defined in the 'cluster' column by the corresponding rank of that group's total value count within the column. We'll break this down into several steps: Integer factorization. Find an integer representation where each unique value in the column gets its own ...

I went a little overboard
 
I just finished replacing the screen on my screen door. Hoping no one ever walks into it and puts a foot sized hole in it again.
Way too time consuming.
 
Here's to hoping
 
Now on to the million other things to fix around the house.
 
 
2 hours later…
3:22 AM
Need some advice. Here's a question: https://stackoverflow.com/questions/4477850/python-and-or-operators-return-value

And here's another question closed as a duplicate of the first: https://stackoverflow.com/q/47007680/4909087

I want to switch the dupe targets. Yay or nay?
If needed, the latter can be modified to fit a more canonical form (currently it only mentions 'and' in the question, but that can easily be modified if needed)
 
wim
3:52 AM
nay
 
4:38 AM
0-1
 
5:15 AM
cbg ladies
 
5:38 AM
Gosh django is driving me insane, for some reason for the life of me i cannot override the login template for django-allauth
@JonClements jon, placing a file like this should by default override their login.html right?
~/myproject/mainapp/templates/accounts/login.html
i dont have any seperate directory for the allauth project to place the override files into, but i keep getting a TemplateDoesNotExist error
 
5:53 AM
@piRSquared And yeah, you sure did. Wow.
 
I want to add only specific column sums (as a row), example
` mm=pd.DataFrame([[1,2,3],[4,5,6]],columns=['A','B','C'])`
I can do mm.loc['Total']=mm.sum() to get total in a row
I i need total of only say a and c column
because some columns can be strings or something not summable
 
6:13 AM
@pythonRcpp mm.select_dtypes(include=['number']).sum(axis=1)
Ah, guessing you wanted it along the first axis, so ^ should do
 
I think my problem was not clear
In [84]: mm
Out[84]:
   A  B  C
0  1  2  3
1  4  5  6
In [77]: mm.loc['Total']=mm.sum()

In [78]: mm
Out[78]:
       A  B  C
0      1  2  3
1      4  5  6
Total  5  7  9
 
Err a new row?
 
But i am looking for a way to sum only specif columns ( say A and C only)
       A  B  C
0      1  2  3
1      4  5  6
Total  5     9
 
    mm.append(mm.apply(pd.to_numeric, errors='coerce').sum(0), ignore_index=True)

       A  B  C
    0  1  2  3
    1  4  5  6
    2  5  7  9
Will leave NaNs instead of blanks, call fillna as you wish.
 
@cᴏʟᴅsᴘᴇᴇᴅ cool , but isnt there a way to specify columns
the thing is sometimes some columns can contain stale values (maybe ints) and i know I should not sum them
something close to mm.loc['Total']=mm.sum(['A','C'])
 
6:21 AM
mm.append(mm[['A', 'C']].sum(), ignore_index=True)
Out[401]:
     A    B    C
0  1.0  2.0  3.0
1  4.0  5.0  6.0
2  5.0  NaN  9.0
If that's what you want.
 
@cᴏʟᴅsᴘᴇᴇᴅ Yes EXACTLY ! but this misses the "Total" written in last row
 
    y = mm[['A', 'C']].sum().to_frame().T
    y.index = ['Total']
    pd.concat([mm, y])

           A    B  C
    0      1  2.0  3
    1      4  5.0  6
    Total  5  NaN  9
It ain't as simple as you think.
 
happy to read this "
It ain't as simple as you think." ... and people thought its a blink of any eye thing
thanks a lot for your help
 
No problem. Though I still think select_dtypes is the more idiomatic way to select numeric columns.
 
yes numeric_only is an option in sum for this . But in my case data types are correct sometimes but i know its values are wrong and not to be summed
just as an add on question , suppose i have 3 columns, for 1st column i need mean, 2nd col i need max and 3rd col i need say mode. Now after getting these 3 values in 3 variables. I simply want to add it as a row (just like we have added total here)
like pasting 3 variables below the last row
 
6:36 AM
@pythonRcpp Look into DataFrameGroupBy.agg
In particular, passing function dictionaries
 
6:59 AM
@cᴏʟᴅsᴘᴇᴇᴅ ok, I think i still need to understand the ds behind dataframes, how they are stored, what function will work on what structure etc. Like there is almost anything we can do with pandas but knowing ds is the Key. Any recconnebded reading for that
 
This will work as well
mm.append(mm[['A', 'C']].sum().rename('Total'))
         A    B    C
0      1.0  2.0  3.0
1      4.0  5.0  6.0
Total  5.0  NaN  9.0
 
7:30 AM
@pythonRcpp I can only recommend you the 10 minutes to pandas tutorial.
 
8:21 AM
cbg
 
8:54 AM
cbg
 
9:35 AM
cbg
 
9:54 AM
cbg
 
From the HNQ: fun with Easter eggs: unix.stackexchange.com/questions/405783/…
 
Morning cbg
 
 
2 hours later…
11:56 AM
hi. anyone using pybabel? I have managed to add a project and version to the .pot file. However when updating my po files, the .pot version and project are not transfered to the .po file....
 
12:15 PM
No MCVE, though a lot of code stackoverflow.com/questions/47404963/…
 
@PM2Ring Wrong season? :)
 
12:30 PM
@JonClements True, I guess that Easter egg is probably a bit stale by now. :)
 
Could be loaded with E numbers and preservatives - might be okay :)
 
i have a some variables and i join them as a string (comma seperated)
but i cant put a new line at the end
myl=[a,b,c]
line = ",".join([str(item) for item in myl])
a b c are variables
 
What's wrong with line = ",".join([str(item) for item in myl]) + '\n' ?
 
ohh, i was trying to do myl=[a,b,c,"\n"]
but that added trailing comma
 
Life is simple, if you keep it so
manage to*
 
12:41 PM
Much of programming consists of doing simple things in the correct order. ;)
 
Cbg y'all
 
1:21 PM
recbg also
 
@pythonRcpp you want to join or print?:P
@pythonRcpp if latter, you can do print(*myl, sep=',') and be done with it
 
Anyone else think it'd be nice if print took a fmt arg that it applied to each element as well, with the default being set to !s ?
 
[now looking up !s...]
 
@JonClements that would be awesome :D
I miss sprint :F
 
Then you could do stuff like print(*range(1, 10), fmt='>10')) or something
 
1:32 PM
that would be extremely useful for golfing too!
 
Now you made it sound like a bad feature.
 
The format specification mini-language does not have a ! token. Bamboozled once more.
Probably a percent formatting flag, then. Now where do they keep the specs for that...
 
!s = str and !r = repr...
Unless I'm just making that up!? Stop making me doubt myself!
 
No, I see an example of "!s" being used in the docs, so it definitely does something.
 
You aren't making it up. And you can use !s and !r in f-strings.
 
1:37 PM
It's mentioned here: replacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}"
 
Thank goodness for that. I'd be more worried about my mental health than normal if I'm going to start imagining format specifiers out of nowhere :p
 
Some times I miss the old backquote syntax for getting the repr, but I guess it was a bit fragile.
 
> The field_name is optionally followed by a conversion field, which is preceded by an exclamation point '!'
OK then.
 
@PM2Ring it'd make switching between JS and Python interesting as well :)
 
The thing I was looking for was one section higher than the spot I was looking. I should know better by now, considering how many times Python tells me the SyntaxError is on line 43 when it's actually on line 42.
 
1:41 PM
A previous discussion involving ! in format specifiers starts here: chat.stackoverflow.com/transcript/6?m=38632288#38632288
 
btw, the fastest way to stringify something in Python is now
 
I'm gonna be really rustled if I click that link and it turns out I participated in that discussion and then forgot 100% of the lessons it imparted
 
f'{foo!s}'
 
Phew! At least that didn't involve me... Was half expecting that to be the case and then have to facepalm :)
And I got Kevin'd... So I guess I win one and lose one :p
 
>>> dis.dis(foo)
  2           0 LOAD_FAST                0 (bar)
              2 FORMAT_VALUE             0
              4 RETURN_VALUE
>>> def foo(bar):
...     return f'{bar}'
...
 
1:43 PM
I'm glad that we can do fr strings, but a little disappointed that we can't do fu strings. ;)
 
>>> def foo(bar):
...     return str(bar)
...
>>> dis.dis(foo)
  2           0 LOAD_GLOBAL              0 (str)
              2 LOAD_FAST                0 (bar)
              4 CALL_FUNCTION            1
              6 RETURN_VALUE
@PM2Ring fu'!'
 
2.7's backticks compiles to the bytecode instruction UNARY_CONVERT. Interesting choice of name.
 
@Kevin it is overridden one
 
I guess I usually think of unary operators as being single tokens that go on the left of the object it's modifying. but backticks go on both sides, so it's surprising.
 
1:47 PM
... unary means "single-argument predicate"
but...
indeed UNARY_CONVERT takes no arguments :F
 
In principle I suppose you could have an unary operator that goes on the right. Bet that's a bit tricky to parse, tho
Ah, here's a good example of a rightwards unary op: c++
Originally wrote "here's a good rightwards unary op" but that implies that the operator is good.
It's not so much "good" as it is "an engine for pumping suffering into the universe" in the form of lots of newbies not being sure whether the expression evaluates to the preincrement value or the postincrement value, and their program exploding as a result
 
@Kevin As someone with a lot of nostalgia from his time with c++ I tried to argue with you and the merits of increment/decrement. But then I noticed it is horrible, and a good thing to forget
 
:-P
I had lots of fun in my C++ days but none of that fun involved using the increment operator as part of a larger expression
 
If they read K&R that wouldn' be aproblem. On the same page that introduces that syntax they give the example of i = i++ and explain why it's evil.
 
Getting rid of 99% of all indexing by making foreach loops a core element of its language might be the best thing about python, ever
 
1:58 PM
Even in a better world than ours where every newbie reads K&R, they still have to pass through a larval stage where they have not yet read K&R, and are thus temporarily susceptible to language design gotchas
 
Guido explicit avoided putting an equivalent into Python, and of making assignments expressions (which would make them nestable). It seemed such a cool thing when C introduced it, but it has lead to so much buggy &/or unreadable code.
 
C++: "Here is a gun. First you should try to shoot your blindfold off, from then on you'll have a good time."
 
When I learned C, K&R was the textbook, so that wasn't an issue. :)
 
Hmm, good point. If you learn straight from K&R, then the window of opportunity for harm is however long it takes you to read half a page of text.
 
I never felt the need to buy another C textbook, although I did buy Plauger's The C Standard Library.
 
2:03 PM
Unless you get so excited about increment operators that you put the book down after reading the first half of the entry so you can go implement pacemaker firmware with the neat new concept you just learned
 
hi all,
i have a question
 
We are ready to receive your question.
 
@Kevin :)
 
@PM2Ring Ahh... the number of company style guides that suggest if (0 == retcode) instead of if(retcode == 0) because if (0 = retcode) will break when if (retcode= 0) won't :p
 
My eye gets twitchy when I see people write Python code like if 42 == x:. You don't need to do that, you're free from the tyranny of assignment-as-expression.
Now instead you're under the tyranny of Kevin's Important Opinions On Binary Operator Ordering
 
2:06 PM
@JonClements Aka the Yoda conditional. :) forums.xkcd.com/viewtopic.php?t=122798
 
Wow - it's still being talked about this year? Thought it might have faded out a bit more with modern languages and linters etc...
 
Echoes of old tech reverberate forward in time forever. That's why PEP 8 advocates a line length of 80, in case you're using a terminal from 1980.
And ASCII has all those weird control characters.
I wonder how many format specifications there are which haven't been changed for twenty years but still reserve four bytes in the header "for future use"
> `TEMPORARY, I HOPE HOPE HOPE`
-- comment from the Apollo 11 source code
Unrelated: How to break long code lines for PEP8, at exec()? is amusing to me, because if you're committed enough to quality standards that you're following PEP 8 to the letter, then you shouldn't be using exec to begin with.
 
Speaking of old tech, an hour or so ago I saw 2 questions in quick succession that used the simplejson module, the precursor to json before it was in the standard lib. Maybe they need to support really ancient systems.
 
They have access to json but it confused them, and they hoped that simplejson would be simpler.
 
xD
It does sound appealing
 
2:20 PM
Python devs, please implement the simple unary operator. It should make the code do what I mean instead of what I wrote.
import simpletkinter; simpletkinter.create_air_traffic_control_system_gui()
 
\o cbg
 
@Kevin That's been deprecated in favour of simplertkinter. Keep up!
 
Also it should be stackable, so you can do import simplesimplesimplemath as m; print(m.solve_the_goldbach_conjecture())
 
Actually you can now use the @simplify decorator, which of course is stackable
 
We also need the hope rightwards unary operator, which makes the expression preceding it 90% less likely to crash
 
2:30 PM
data = calculate_payroll() and_hope
sentiment_analysis = look_upon_my_works_ye_mighty() and_despair
Doesn't really make sense, but I went with it
 
perl has an idiom that looks like do_thing_that_might_fail() or die; so it's not entirely crazy :-P
 
That's the good thing about using the new simple operator, your code doesn't really have to make sense
 
TFW you ask a "Do you want to do X or Y?" question, and they reply, "Yes, you are correct". I'm sure I could help this OP if only they could explain the task clearly. I'm almost tempted to ask them to post a MCVE with typical input data & expected output, but I get the feeling it might not be easy to get them to post binary data in a foolproof way. stackoverflow.com/questions/47413640/…
I guess we should just close it as too broad / unclear...
 
Whoops, I made a factually incorrect comment on a ruby-and-python question because I made an assumption about a language I've never used.
I should know by now not to assume that << does the same thing in every language, considering how long I wrote code like std::cout << "hello, world"
@PM2Ring The charitable interpretation is that "Yes you are correct" is replying to your first sentence about the read/read() typo. But even so, it doesn't look like he gave a straightforward answer to your question.
 
2:54 PM
real quick, does anyone here know why I would call my program with sys.exit(main()) as opposed to just main() ?
 
I don't know why YOU would do anything :\ I'm not you....
 
looks like bad style to me. You want to have a main function that returns a numerical exit code? I don't.
 
it's actually code I wrote 4 years ago
 
if you are asking why call sys.exit(main()) over main(), that's another question
 
and I think i just forgot a "why would I want to do x" in there
Yeah, it looked kinda bash-y to me too. Better forget I ever did that
 
2:56 PM
hmm perhaps you wanted to raise to stderr if main() failed ?
 
I should just read up on the docu of exit()
 
And this is a classic example of why people need to comment,even the most basic things so future people can understand why things are done the way they are done.
 
It just looks so useless, especially as the last line in the file
 
@ArneRecknagel I would make sense in a language where main returns a non-zero error code. But in Python, main normally returns None, so it looks weird.
 
3:04 PM
Kevin and his gif :D so fancy
@AhmyOhlin elif sensor in fieldnames is sensor in data.items(): what do you think this line is suppose to do ?
 
could someone tell me pleae if this line is right elif sensor in fieldnames is sensor in data.items():
 
@AhmyOhlin Hi there. Please provide the contents of data, as I previously requested in a comment on your question on the main site.
 
@AhmyOhlin welcome, please read our room rules: sopython.com/chatroom. Don't ask about recent questions here.
 
@MooingRawr this line is supposed to compare and find the the position of string "sensor" in fieldnames csv file and in my entity
@Kevin can i provide it here ?
 
I think it would be best if you edited it into your original post.
 
3:12 PM
Still no news about AoC 2017 :\. When was 2016 announced last year? It seems my google-fu is lacking.
 
Hmm, can csv.DictReader parse an input file whose columns are separated only by a variable number of spaces? just doing delimiter = " " will give a lot of empty columns.
 
It's coming, the author is active on the subreddit and said it will be up a few days before December 1st.
 
\o/
 
\o/
 
@Kevin I expect that skipinitialspace=True will behave sensibly in that situation, but I haven't tested it.
 
3:16 PM
@AhmyOhlin what wasn't clear about "don't ask about your recent questions here" and "you should edit your original post"?
 
I'm sorry, but I don't think I can provide any assistance on compare values with fieldnames before writing it in csv file using python until it contains a proper MCVE. There are far too many unknowns right now.
 
I did enjoy that one this morning.
 
@PM2Ring Ah, that does appear to help. I assumed it would only skip the initial spaces at the beginning of each line, but it looks like it does it per-column.
 
Ion I found a previous draft of my thesis that's much further on than I thought, which has basically added in about 13% of the material I need today.
so \o/ for me
 
3:20 PM
Shame that it doesn't skip trailing spaces at the end of the line, but that's not what I asked for, innit.
 
@Kevin Well, they're easy enough to deal with. Instead of passing the file directly to DictReader, feed it from a genexp that does the stripping.
 
DSM
Morning cabbage for all.
 
Morning, DSM.
 
Cbg DSM
 
can someone help me
 
3:25 PM
@AhmyOhlin Yes, as soon as you provide an MCVE.
 
what is MCVE ?
 
I linked an explanation in my message where I said that I couldn't help you until you provided an MCVE.
8 mins ago, by Kevin
I'm sorry, but I don't think I can provide any assistance on compare values with fieldnames before writing it in csv file using python until it contains a proper MCVE. There are far too many unknowns right now.
 
You've been a SO member for 9 months and you don't know what a MCVE is? That's not a good sign.
 
to be fair PM, that tracker only trackers the date you've signed up not the time you've been on the site, does it not ?
I know a friend back in University who signed up to SO to ask one question in year one, and never touched SO again until year 3... :\
 
DSM
I'm so old I remember when it was SSCCE..
4
 
3:30 PM
I don't know if that's the active tracker or not nor do I know his profile to confirm :\
 
@PM2Ring im not very active here
sorry
 
It would be pretty tricky to accurately track total time spent on site, because the server doesn't inherently know how long you spend looking at each page it serves to you
I guess they could have javascript that pings a heartbeat at the server as long as the page is open, but that seems like it would be fairly bandwidth-intensive when multiplied by a million users.
Hmm, maybe a cookie-based solution with less frequent call-home events...
 
Is there a tracker for number of pages looked at ? maybe that would be a better indicator
 
I suspect that SO gathers pretty granular data about its users, going by the unique and diverse ways to get Winter Bash hats. But I think most of it is not visible via profile.
"Number of pages visited" falling in that category
 
@kevin
@Kevin can you tell me please which unknowns you mean?
 
3:38 PM
And I guess plenty of people who are members don't stay logged in all the time, but may perform quick searches while not logged in.
 
@Kevin please focus on the unknown unknowns
 
@AhmyOhlin Primarily, 1) the exact contents of the input file, 2) the complete source code of the Python script. It would be nice to have the exact contents of the file after the script finishes executing, but I don't consider that entirely necessary since I can make that myself if I have #1 and #2.
 
Kevin and PM, Stack uses Quantserve as one of its main analytics system. Time per page is one of their key metrics, and in some instances they can resolve a non-logged in user to a signed in user account without a login. /slightaside
 
Interesting!
 
@Kevin it might do? :p
 
3:41 PM
I am certain that you have not yet provided the complete source code, because when I run what is available in the question, I get NameError: name 'filename' is not defined, which is completely different from the problem you are describing
 
DSM
SO spying on us all. (smh)
 
And if I provide a filename myself, I get a NameError on csv, and if I import csv, I get a NameError on data... It's really quite tiresome
 
@DSM just you :)
 
Cabbage
 
"Compare binary files" guy posted 5 lines of hex in a comment. Why am I not surprised…
 
3:43 PM
Did you see the man Easter egg?
 
You can do much the same using Mixpanel (for free), and if you combine that with, e.g. CrazyEgg heatmap/scroll tracking, you can get a fair idea of what people are doing... how you manage that deluge of data is another game entirely.
 
315
Q: Why does man print "gimme gimme gimme" at 00:30?

Jaroslav KuceraWe've noticed that some of our automatic tests fail when they run at 00:30 but work fine the rest of the day. They fail with the message "gimme gimme gimme" in stderr, which wasn't expected. Why are we getting this output?

 
Man Friday's lesser-known cousin, Man Egg.
 
@DSM don't forget (cos I normally do) there's stackoverflow.com/users/prediction-data - which is useful to see what questions you've already looked at and how your tag viewing is spread...
@Code-Apprentice umm.... it's "[...] after midnight" so according to ABBA it should work...
 
@JonClements I was unfamiliar with that reference until today
 
3:46 PM
oh darn... just looked at the Q and seen the answer where that's said... knew I wouldn't be the first... sighs
 
Posted by the originator of the Easter egg
 
MGE
I have a problem checking if a POST value is empty
q = request.POST['selfdestroy']
		if q is not None and q != '':
			selfdestroy = request.POST['selfdestroy']
			if (selfdestroy.upper() == 'Y'):
				sd = True
			else:
				sd = False
		else:
			sd = False
MultiValueDictKeyError at /save
"'selfdestroy'"
 
It's a dict, so either check if the key is there first, or use get. Or use a Form.
 
@Code-Apprentice I love it.
 
I'm thinking something like
q = request.POST.get('selfdestroy')
sd = False if q in {None, ""} else selfdestroy.upper() == 'Y'
Or, hmm, maybe that second line is overstuffed...
Wait, why am I using a ternary here.
q = request.POST.get('selfdestroy')
sd = q not in {None, ""} and q.upper() == 'Y'
 
MGE
3:58 PM
q = request.POST.get('selfdestroy')
if q is not None and q != '':
sd = True
else:
sd = False
solved with this
 
DSM
@JonClements: wow, I'm pretty sure I didn't know that.
 
You know, there's not much point comparing against the empty string if you're rejecting anything that's not Y anyway.
q = request.POST.get('selfdestroy')
sd = q is not None and q.upper() == 'Y'
 
wim
What to do with users that ask the same question a couple of days later, when the first one didn't get answered and was downvoted ?
 
@wim if it's not significantly different and there's content on the first, then dupe close it to the first
 
I forget, is it possible to use a downvoted non-answered Q as a dupe target? If so, do that.
 
3:59 PM
(as long as it's the same user - the normal dupe rules of having an upvoted/accepted answer don't apply)
 
wim
Ah!! Didn't realise the normal rules don't count here. thanks
 
MGE
@Kevin awesome
cleaner, thanks.
 
Hmm, now that I think about it, you could provide a default for get so that you don't need to check for None... sd = request.POST.get('selfdestroy', 'N').upper() == "Y"
 
Hey guys :)
is there a good convention for naming class objects?
 
MGE
the value can b
y or None
 
wim
4:01 PM
Next question ... how to explain that accepting an answer does not mean reposting the answer on your own question?
 
MGE
is a checkbox
 
wim
I don't want to say "hey, accept my answer" but I took literally 6 times explaining to this guy how to patch the object and he didn't even leave an upvote
 
From the error message you were getting, I assume that if the value is None, the POST object simply doesn't have a key-value pair, rather than have an explicit selfdestroy: None pair. In which case providing a default via get should do the needful.
 
@Kevin i have edited my post with all script and inptut
could you take a look please and help me to fix it
https://stackoverflow.com/questions/47412324/compare-values-with-fieldnames-before-writing-it-in-csv-file-using-python
 
@AhmyOhlin Ooh, sorry, I don't have a homeassistant module on my computer. Could you pare down the program a little farther so that it only uses built-in modules?
That's the "M" in "MCVE": include as little code as possible, so readers have the best chance of being able to run the program on their own machines
 
wim
4:04 PM
ugh, and now some fool is upvoting the self-answer
 
@Punchki PEP 8 has some standards for class names. Beyond that, just pick the most descriptive-yet-concise name you can.
 
Aha. this why i was yondering how you could run my script on your machine because you need the sensors as yell @kevin
 
wim
That will teach me to be patient and try to explain it gently ... next time will just hammer the guy immediately
 
Well the problem is primarily about reading and writing CSV files, yes? So in principle it should be possible to write a smaller program that takes a ready-made CSV file, and produces the same problem you're having now. Without requiring the user to generate the CSV file themselves by accessing a password-protected network resource.
Whoops, it's the dictionary that is generated by the password-protected network resource. But you know what I mean.
 
@Kevin Thanks Kevin. I'm looking at it right now and pylint in Visual Studio Code keeps wanting me to name it as a constant :/
 
4:13 PM
Weird. I mean, most classes go their whole lives not being modified, so it kind of makes sense to consider them constant, if you squint real hard.
But I don't think any human would enforce a style like that.
 
@kevin i changed the code and i explained more the problem take a look please
 
@AhmyOhlin Ok. I'm running your code... Hmm, I got NameError: name 'time' is not defined on line 1.
That's the "C" in MCVE: you need to include all the code necessary for the reader to run the code, including import statements
imports here being necessary, but not sufficient; even if I add imports for time, datetime, and OrderedDict, I get NameError: name 'entities' is not defined
 
@AhmyOhlin open your MCVE in a new editor and check it breaks the same way that you're asking about. Why are you getting kevin to debug your MCVE?
 
What's the bet that this OP thinks he wants variable variables? Hopefully not, with a rep of 2885, but you never can tell. stackoverflow.com/questions/47417003/…
 
You may notice that it's difficult to satisfy both "minimal" and "complete" at the same time, because "minimal" compels you to remove code from your program, but "complete" compels you to leave everything in that is needed to demonstrate the problem. There's no straightforward automatic way to satisfy both at the same time; you've got to use human ingenuity beyond just removing lines piecemeal.
 
4:21 PM
@PM2Ring Georg is a name I know from somewhere...
 
You can't make s = get_value_from_sensors() minimal just by deleting the line entirely, you have to replace it with s = {"foo": 23, "bar": 42}, because s still needs to exist when it's used later.
 
@Kevin Yea, I'm looking at my code with the all uppercase naming and it just gives me the heebie jeebies.. I'm going to look if I can change pylint to maybe recognize a class instance for naming
 
DSM
@JonClements: Brandl, maybe?
 
I feel like something has gone wrong in a configuration setting somewhere, if pylint doesn't by default understand that class names should be styled to look like class names.
In general, I expect tools to not be broken straight out of the box
 
DSM
(I'm thinking of famous Python Georgs.)
 
4:24 PM
@DSM Yeah - that's the one - thanks :)
 
I just answered a bounty question. Can't remember the last time I did that.
 
The only Georg I know is Spiders Georg.
 
The new questions in Flask were just so boring. :-(
 
@Kevin Using it out of the box prettymuch. Here's what I'm trying to fix:

class CanLogging:
"""does stuff"""

my_can_logging = CanLogging()
 
@kevin did you write the text what i added on my post? the problem is related to home assistant
 
4:28 PM
Hmm, I don't suppose pylint does natural language processing on names to determine their likely purpose, and assumes that "CanLogging" actually means "is capable of doing logging", and deduces that booleans at the global scope that aren't reassigned at any point should be considered constants.
 
because i get everytime i got the Order of values
 
In which case the solution is to 1) lie down 2) cry 3) change the name to something not beginning with "Can"
 
i will write small programm and ask you again
 
haha, alright, I'll give it a try
thanks o7
 
This is a really out-there theory because I suspect the vast majority of linters don't do NLP
 
4:31 PM
Wait, someone just downvoted my answer and upvoted the one that misses the point of the question.
Did I miss something here? stackoverflow.com/q/47317722
 
I can confirm that your answer contains syntactically valid English and Python. I can't verify the truth content of your statements, as I am a rube.
The downvoter is a complete Melvin for not indicating the source of his displeasure via a comment.
 
@JonClements I was worrying needlessly. He seems to like my answer.
 
Ugh, I don't want to be that guy who asks what's wrong in a comment, but I really want to know what their thought process was there.
 
Perhaps "this problem is best solved by zooming out and changing the design of your project at a higher level" is not what OP wanted to hear
Not being able to fix a problem in one line is a bitter pill to swallow, for some
 
downvotes Davidism
 
4:36 PM
Will post on forums, maybe someone knows
 
I would suspect the other answerer who I wrote a comment to, except they got an upvote as I got a downvote.
 
@davidism Here, I'll be that guy instead :-P
 
Yeah I wonder if their downvote of you meant they went above you, and someone else upvoted
 
@Kevin <3
 
cbg
 
4:45 PM
My jimmies are rustled by how often the answer to "what should I do about the warning generated by this tool?" is "suppress/ignore the warning"
Why can't everything just work ;_;
 
:D because if everything just worked, we wouldn't have jobs.
 
Another upvote/downvote pair. Something suspicious is going on.
@JonClements is this something I should flag?
 
@kevin
 
1. Where are your jimmies?
2. Are you more concerned that predominate behavior is to ignore warnings and dismiss them as annoying?
3. Are you more concerned that developers let warnings that are no longer useful hang around to annoy people?
 
Well, that downvote was reversed to an upvote, so maybe that was a misclick.
 
4:52 PM
@Kevin i edited my post please check it out
 
@davidism No, I just did the opposite (before I read what you said about another pair)
 
No, I mean whoever did it reversed the downvote right as I said something.
 
DSM
@davidism: I once misclicked and had people insulting my idiocy in the comments. Later I wondered why my rep had decreased and felt like quite the fool. I never owned up to it. (In the comments, I mean. I've confessed it here before I think. :-)
 
@wim There's a class setters decorator question you might be able to shed some light on. I just find it confusing. ;) stackoverflow.com/questions/47417966/…
 
note to self: google is pretty bad at searching stackoverflow questions.
 
4:53 PM
I'm probably reading too much into it, I'm just annoyed at the votes.
 
@Punchki I think it depends how you use it. I find it better than the SO search engine.
 
@PM2Ring I tried googling for my question in about 100 different wordings on google, and like 2 seconds after posting it on SO, someone marked mine as a duplicate! Felt quite dumb haha
 
I got a downvote for that regex answer I just wrote. I guess it could be classed as too broad, since there's no code attempt, and I didn't prod the OP to post one. OTOH, nobody VTC'd as too broad, only as unclear. Oh well.
@Punchki There's no harm in posting dupe questions if you made a decent effort to find an existing one. The fact that you couldn't find one proves that your new question will be a useful signpost.
 
@AhmyOhlin OK, I'm looking at it... It's running on my machine, which is a good sign.
 
@Kevin that is really cool art of help
so can i point you out on the issue ?
 
4:59 PM
For starters, if sensor in data.items()==sensor in fieldnames: is not equivalent to "if the sensor in the data object is equal to the sensor in the CSV"
 
00:00 - 17:0017:00 - 00:00

« first day (2593 days earlier)      last day (2348 days later) »