« first day (3279 days earlier)      last day (1894 days later) » 
00:00 - 19:0019:00 - 00:00

19:00
SyntaxError? :)
If your program is literally x = [415:10, 415:15, 415:20, 416:13, 416:10, 417:18, 417:20, 417:89, 417:82, 417:65], that would be called a "syntax error"
@biggi_ what language?
wim
wim
the ability to google a code snippet and get relevant results is actually really underrated
lemme check, i'll pop my data into a gist
sec
@AndrasDeak python XD
If you're going to say "no no no, I have [415:10 etc] in a file, and I'm using open and read to get the data", then it's a string, because that's what file.read returns
19:02
it's not in a file
@Aran-Fey mm, I can see your point. I sometimes wonder where that line should logically be drawn; I mean, would the people attempting to dig into your code like that really be unaware of quite common syntax but still actually be able to make some useful alteration elsewhere?
I look forward to the gist with great interest, then
It is definitely not technically a list
It's the string representation of data that isn't a valid data structure in Python then, I guess
Working with other's codes that labled incorrectly is hard when trying to learn XD
@Kevin unless it's a list of strings...
19:04
I'm just going to go ahead and assume that the code is roughly equivalent to x = "[415:10, 415:15, 415:20, 416:13, 416:10, 417:18, 417:20, 417:89, 417:82, 417:65]" and I'll go from there
^ that's my understanding
@biggi_ string like what? -----------^ you should be saying that
I'm re-factoring names to make it more understandable later :)
@biggi_ where does this string come from?
It's not too hard to collect the data and average it and put it into a list, if the string contains exactly and only one opening bracket, a series of colon-separated digit sequences themselves separated by a comma and a space, and a final closing bracket
19:05
If you create that string somewhere else then you should address the issue upstream if at all possible
I bet half a quatloo that the suggested solution to whatever the problem is will be "instead of ending up with that horrible string, use a list of 2-tuples"
If the data can contain other things, like "[foobar, 1.2.3, Albequerque New Mexico,,[[[][)][][]],]" then things get hard
No, it's always [number:number, number:number, number:number....number:number]
Ok, but my earlier question was what is generating that string?
Before it comes into Python
Or, even, is it being built in Python?
String is generated from some wonky def that this guy made to talk to some custom made sensor
19:07
@roganjosh tough question
It's a serial thing
But he had it labled as list, but it's a string, so that's part of where I got confused
How is that guy talking to a sensor? Modbus?
rs232
Ok, and is the function creating the string relatively simple and something you might be able to post?
are they a time traveller from 20/30 years ago? :p
19:10
Not easily without sanitizing it
^^ all the important questions :P
@JonClements the dude is 75. He works to stay away from his wife at home all day.
Ok, well my final question is; is that string being created for the sole purpose of feeding data back into Python?
Or does it go elsewhere?
Yes and no. It's going to be manipulated some more (doing some linear regression on the data) and then that linear regression is going to be spit out
@biggi_ here's approximately how I'd do it: dpaste.com/3HGHKJV
19:13
Oddly, he has a list that is [415, 415, 415, 416, 416, 417, 417, 417, 417, 417] and then antoher one that is the other portion of the data and then he zips them
Wow
@biggi_ Ok, from what I understand, you have some Python function that receives this serialized data and forms that data structure, which then gets passed on to you. If you have the ability to change the function receiving the data, the issue should be fixed there
this is weird....ima probably just re-write what he has....
good choice
he could've stopped at list(zip(...)), probably, perhaps with a function that converts this nice dataset to something "pretty" from:to for string reasons
Let me sanitize a bit and I can post a gist
When dealing with weirdly outputted data, first try changing the program that outputs the data; then visit the previous maintainer with a spiked baseball bat; and when all else fails, write custom parsing code
19:16
Gimme a few and I'll be able to post
he lives far away, it seems
@Kevin "the dude is 75"... c'mon now :P
I'm scared to ask what "he had it labled as list" means. If it means his variable names all end with the type of the object it holds, don't tell me.
@roganjosh Any programmer that lives to 75 has already built up a powerful immunity to spiked baseball bats.
kevin: he had the variable named final_list that was a string
Jimmies: rustled
19:19
@Kevin A Mr Miyagi character bursts forth?
totes_a_list = str([f'{fro}:{to}' for fro,to in zip(first_list, second_list)]).replace("'",'')
well that became even uglier than I expected
so here it is. I can't post how he gets data into the original lists, but that's how it is gist.github.com/biggidvs/e5cf8eef2610f8305eebd6ce6d73ab7b
if only we had literal variable names I could've used \from:\to :'(
That's what he has, now I'm trying to get in and average what would be the keys of a dict.
Leave it to my boss to leave me with the wonky stuff XD
@biggi_ Oh good, that means you can skip all the cumbersome parsing bits and skip straight to the defaultdict. dpaste.com/3GBPD5R
19:23
Sounds good. I think my main thing is the jargon and labeling he has. I see what he means...it is a "list" of the data, but it's not a technical list.
You could use itertools.groupby instead, if zed_list is guaranteed to be in order
And where I'm at learning all this fun stuff, I need things to be correct for me to see what I don't know.
Kevin: it doesn't need to be in order thankfully
@biggi_ it isn't a list. It's presumably to try get round the limitation of duplicate keys in a dict
Confusion about types is one of the biggest quagmires that new users fall into
Yup, which by averaging them now, that will fix that.
19:24
I have no idea whether that can be deserialized in another language into a list, but it isn't a list in Python
I think it helps to be really militant about what is and isn't a particular type. "[1,2,3]" is not technically a list, it's not sort of a list, it's not a list if you squint at it from the right direction, it's straight up not a list in any capacity
Who knows. This guy is making oodles to come here and contract to stay away from his wife and he pumps stuff like that out and then we get to "maintain" it and add to it when they want changes.
^ living the dream
Best part: I'm a sparkey
I'm super more hardware oriented. Op amps/circuit design/filters/etc I gotchu bro. This stuff....it's clear as mud.
Either way, I appreciate the help. I'll be sure next time to have a gist ready before asking anything
Back to my squares
19:29
I knew I shoudl have just done this in wpf XD
If it makes you feel better, my current role is in the Electrician's dept. and electricity is one of the fundamental things in life that I've never been able to intuit. It seems your role is changing (in industry) :)
I have seen some... interesting... approaches to programming HMIs
I don't really do PLCs too much. I can, just not what I enjoy.
Well, that's some common ground :P
I just let them do their "ladder programs" or whatever it is, and then just hijack the data registers and never have to think about them again
Now embedded software I can easily do. I'm really half tempted to make a battlebot at home with my kiddo.
Seems like a pretty awesome project
19:35
Oops, a {4,4} polyhedron would have two more vertices than faces, since V-E+F = 2 for convex polyhedra and E == 2*F for quad-faced polyhedra. So my proof from two hours ago is bunk.
Wow....Kevin is working on intense stuff.
Meanwhile I'm just trying to understand the difference between "more" and "increased" in Path of Exile XD
There's a very good chance that this problem was solved 300 years ago and I'm trying to jam a square peg into a round hole
Real geometers all like "pfft, this kid doesn't know Steve's Lemma, which disproves the existence of the superDuperCube"
Kevin: are you in physics?
if it makes you feel any better, I'm trying to shove a spaghetti shaped peg into a round hole.
I exist within a universe governed by physics, but beyond that, no
19:39
You remind me of like Sheldon Cooper sitting around a white board...that's almost how I picture you.
Bizango
I think he did it on purpose
Bazin[this message has been removed due to a copyright claim by CBS Corporation]
19:42
Do... do people still watch that show?
Coincidentally, I was just talking about Python in the physics chat room. :)
@roganjosh it's ended
and yeah, we watched it
it somehow unjumped the shark after a while
Yeah, after a few seasons it became somewhat irritating. At the start is was kinda fun
@roganjosh nope, it's over
oh...Kevin'd by Andras
20:05
any know a hash function for an object in python
For what purpose? hash() exists.
for knowing how shit works
this is important
how does hashing things help you understand them?
... That's clarified absolutely nothing for me
What are you wanting to know how it works?
20:06
i think its important to deeply understand how these things work
wim
wim
oh nuts, a project I started out on flit needs to change to setuptools because a feature I need is missing in flit :(
oh? what's that feature?
wim
wim
scripts
<- totally not looking for excuses to avoid installing/learning flit
@Permian So presumably you found the hash() function and researched that? I mean, it's a builtin
20:08
@roganjosh yes but how does it work?
under the hood
@Permian please avoid that expletive going forward
All of the code is opensource
@AndrasDeak i forgot
my 30-second google search tells me that setuptools scripts are basically just files that'll be copied into your project directory, is that right?
Not just hash functions, but the entirety of Python. Your answer wasn't helpful to my question so it's an exercise for you to find where it's implemented. It's a good idea to understand your way around the source code anyway
wim
wim
20:10
@Aran-Fey yep
setup(
    name='myproj',
    scripts=['bash_scripts/do-the-thing.sh'],
)
^ not supported by flit
its not copied into project directory, it goes into bin dir
that's certainly rather disappointing
wim
wim
yeah
i.e. in the sysconfig.get_paths()['scripts'] dir
almost always you can use entry points instead, which flit does support
but if you need to munge the environment, it's already too late to do that by the time you're in a python entry point, so you want "real" scripts feature.
fortunately you can do setup.py-less packaging with setuptools too these days, so I'm not too bummed
20:42
@piRSquared Did part of question 10 in your pivot canonical accidentally get edited out on July 31?
@Permian It's not a great hash function, but it is very fast, and it works well enough for the hash tables underlying Python dicts and sets. See python.org/dev/peps/pep-0456
@Code-Apprentice I'm not following the "salting"
I don't see why __hash__ implements salting at all
@roganjosh which part are you not following?
It's not a cryptographic hash
I just found that snippet from the docs. If you read further down, it has to do with preventing a DOS attack against dictionaries.
> This is intended to provide protection against a denial-of-service caused by carefully-chosen inputs that exploit the worst case performance of a dict insertion, O(n^2) complexity. See ocert.org/advisories/ocert-2011-003.html for details.
20:54
The link for salting doesn't mention salting
It looks like, at least to me, a mismatch of terms, and they're conflating a random seed with "salting"
"Although they remain constant within an individual Python process, they are not predictable between repeated invocations of Python." Mmm, well a salt isn't consistent between any values in a session
So, I think PYTHONHASHSEED should be enough to get consistent behaviour. If not, I find the docs pretty confusing on this point
@ALollz hmm. I don't see you in the history. I need to review it. I'll do it soon.
hi guys can you help me with a regex? I need to match any of the following, basically any series of single char separated by whitespace

2
2 r 3
2 H 0

I have this so far, but return more matches that it should

.\s?(.\s)?.
@Code-Apprentice or, on re-reading, that wasn't the point you were even making :P It's me that has pre-conceived ideas about what salting means here. Apologies.
@erotavlas '2' includes '2 r 3' and '2 H 0'
or is it "any series of single char seperated by whitespace"? You were unclear
I mean it can be a single char (no space around it).
21:04
ah
or any series of chars with spaces between it, but the end has no space
i mean it may or maynot have a space, i don't know
how about .(\s.)*
\S(?:\s\S)*
. vs \S differs in subtle things like newlines, right?
pat = r'^\s?(\w\s)*\w\s?$'
21:06
@piRSquared \s$ is not allowed
@Aran-Fey that's works...I forgot about ?: thanks
@AndrasDeak more importantly, . could match a whitespace character and make the regex match something it's not supposed to
>>> re.match(r'.(\s.)*', '\t\t\t')
<re.Match object; span=(0, 3), match='\t\t\t'>
ah, thanks
also forgot that . matches whitespace, doh
@Code-Apprentice in any case it's answered here "... but you can set it to a fixed positive integer value, with 0 disabling the feature altogether."
21:15
@roganjosh I think "salting" here means what you think it means. A random number is added to a string's hash value. This random number is chosen once when the process starts and used for all string hashing.
at last that's my understanding from what I've read
ultimately this means that the OP's question is either answered by "you can't do that" or is ill-formed. The only reproducibility is if the OP chooses a particular seed (including 0).
They never answered me on why they wanted this in the first place so I'm not even sure where we could go from here. IMO I'd just put PYTHONHASHSEED in your answer, and the possibility of setting it to 0 to get rid of the seed, and that's probably as close as you can reasonably get to making it transferable unless there's a real use-case
A regular python hash() isn't secure so I can't see it being used for some kind of verification if they have a Go server taking requests and conferring with some backend in Python. I can't see a use for this
wim
wim
+3 upvote wtf ?
Upvote and downvote?
I remember this coming up earlier, ugh, what was it
wim
wim
its an answer not a q
ah...
Rep capped with an unupvote or downvotes or something?
wim
wim
only 191 today
21:40
still, +3 sounds like truncated +10
wim
wim
@Kevin share markdown not working again (the monkeypatched textbox does appear, but the "Copy Link" button only copies the vanilla link)
I know some events can mess with the rep cap
wim
wim
sorry to be your most annoying user
just downvote and it'll be roomba'd
21:49
do you have the forecaster?
I'm a bit wary of doing exactly that. Then again the question isn't exactly up to par, and the asker was last seen in 2017
if you don't downvote unformatted, poorly tagged stuff like that then I'm not sure what you're using your downvotes on
It's more about me focussing on retagging a'la meta.stackoverflow.com/questions/389988/…. If the question seemed worth saving I could've easily formatted it myself, which is why I didn't default to downvoting it.
if I'm reading this correctly it should already be roomba'ed, now that it's at 0
> If the question is more than 365 days old, and ...

has a score of 0 or less, or a score of 1 or less in case the owner's account is deleted
has no answers
is not locked
has view count <= the age of the question in days times 1.5
has 1 or 0 comments
isn't on a meta site
yeah
21:53
roomba must be sleepy
takes 3 days to wake up :)
perhaps they changed something after meta.stackoverflow.com/questions/307009/…
at least back then I think the deletion triggered instantaneously
oh well, thanks
In light of recent social media videos of what happens when roombas stumble over dog poop, I do wonder about the analogy
depends on the circumstances I think. According to the forecaster, most stuff I come across is deleted weekly or monthly
@roganjosh As I read the original question, it is "How do I recreate the same hash of a string that Python does in Go?" This by itself is ill-formed because the string hash isn't consistent between invocations. So yah, the first step is to define how to make them consistent but after that I don't know how to duplicate the behavior in Go.
21:56
@Aran-Fey I guess it would be reasonable for 365-day rules to be checked only weekly (or rarer)
wim
wim
off-topic but has to be shared
@Code-Apprentice trying to recreate implementation details always sounds like an XY problem to me
@Code-Apprentice I think we're converging on "this isn't worth the effort to go further" at this point :) I'd probably be curious about whether I could unpick it if the OP showed any interest in the problem at all
@roganjosh and I'm interested in the OP's motivation for wanting this.
I don't think I've ever called hash() directly on anything.
I already asked them, though. And they haven't answered
22:00
exactly
but then the OP hasn't contributed to any of the conversation since first posting. So now we just wait.
It's also suspiciously similar to another user asking not long before, but that's by the by I guess
I didn't see that one
"""Does anyone write multi-line
docstrings like this?
"""
wim
wim
yeah
i dont
22:06
I've never seen it done like that
looks grotesque
I've done that before but I don't count
wim
wim
hmm actually I think I write them like """this for single line """ and

"""
this for
multiline
"""
@Aran-Fey that's how pep whatever says to do them though
I think I write a short summary of what the function does on the first line, then an empty one, then exposition
yeah, that's why I'm asking
it's 257 IIRC
also mentioned in PEP8 though
wim
wim
I kind of wish that the compiler lstripped or dedented whitespace from the __doc__ automatically
if you look at e.g. print(Counter.__doc__) you will see the problem
22:13
Not exactly a high-priority issue, but yeah, that'd be nice
22:28
@Aran-Fey yup, and it seems to say what I've been doing \o/
(among other things)
Should've been rejected >:I
I can actually date my functions in my package based on the docstrings. The old ones have single quotes and newline right after the opening triple, whereas the newer ones have triple quotes and continue on the opening line
 
1 hour later…
23:57
I'm on WSL Debian
I have pygame installed
"pygame.error: No available video device"
It works in Windows 10 regularly, it just doesn't do it for my Debian... VM? (What is the name of the kind of program that I'm running with WSL?)
Obviously the error comes from using display
Traceback (most recent call last):
File "moveSquare.py", line 19, in <module>
screen = pygame.display.set_mode((400, 400))
pygame.error: No available video device
Do I need to install some sort of driver or something?
00:00 - 19:0019:00 - 00:00

« first day (3279 days earlier)      last day (1894 days later) »