« first day (3074 days earlier)      last day (2099 days later) » 
01:00 - 20:0020:00 - 22:00

01:42
too broad/unclear/no MCVE/take your pick stackoverflow.com/questions/54305689/…
01:52
@MisterMiyagi , Kevin, Andras Deak: totally. Many pandas questions have a) no data or b) no code. Or people post a text dump of their dataframe, or an image (/Jupyter screenshot/ etc.), with no datatypes, which you can't copy-and-paste into a shell. Let's try to change this? How should we go about it? Should we start a question on Meta identifying say "What are the main ways in which pandas questions lack an MCVE, covering both code and data?" ...
Because it's not communicating clearly enough to new-users just to keep posting "Questions require an [MCVE link]". We need to spell out to them all the specific reasons "Here is why your question does not have an MCVE and this is why it's getting downvoted/closed".
Oh and by the way, version-specific issues with pandas itself, numpy/scipy, sklearn, Python, Jupyter, plotting packages or any other packages require specific version numbers. So instead of "Why does pandas do X?", should be "Why does pandas V do X?", have they tested it on any other pandas version(s), Python versions, OSes etc.
wim
wim
02:19
Perhaps just ignore tag . It seems to attract the worst kind of beginners that want spoonfeeding every step of the way.
02:52
amen
@Kevin Just curious, are you aware of the existence of pandas.read_clipboard?
Ah, I see piR already pointed that out.
@wim Well, a lot of them are entry-level/wannabe data scientists copy-and-pasting code from Jupyter notebooks or Kaggle kernels or other ML tutorials or friends/classmates. Many do not have any experience in any programming language. This is actually good for the propagation of Python - it's just one particular manifestation of "How welcoming...?". We just need to be a) very clear and explicit and b) pretty strict about our rules for what constitutes a legitimate question with an MCVE....
I totally get that most of you do not want to janitorial on this. What do you think of question on Meta identifying say "What are the main ways in which pandas questions lack an MCVE, covering both code and data?" ... as a vehicle for formulating our standards, and making it clear to users why their pandas questions get closed?
Also, data science questions often fall between the three stools of SO, CrossValidated and the no-go area of DataScience.SE. So we're getting tons of basic and duplicate questions from people who lack the vocabulary or literacy to phrase the right question on the right site. (Again, "how welcoming?" is right/too much?)
As long as the question clearly indicates input and output (code is usually optional because it seldom helps in the context of the question) and isn't too broad (i.e., require too many operations or concepts to address) then I consider it on topic. Now this doesn't necessarily make the question answerable, beause roughly 30-40% of questions fitting this criteria are duplicates.
@coldspeed Sorry, but no. We need to know what's a categorical, what's integer, what's string, what's float, what's date. Should say "clearly indicates input dtypes and values, and output dtypes and values".
There are improvements on our side, answerers are usually responsive to prodding when you advise them against answering duplicates and crap. But the bad questions are out of our control.
@smci I did mention that the input should be clearly indicated, that includes specifying dtypes. Most of the time, though, you can figure out the dtypes just by eyeballing the data.
The easiest way IMO to deal with the unsalvageable stuff is to dv/cv, not answer, and hopefully roomba will do the needful. This is in a perfect world where users do not answer such questions.
03:12
@coldspeed No, this is my point, we gotta be explicit. Many of these users aren't even aware what a dtype is, let alone which command they should use to post a snippet of data with dtypes. From several years experience answering pandas questions, users are often vague or clueless about dtypes. Many of them just use whatever pd.read_csv() defaults to/infers, i.e. often string, which is almost always the wrong dtype, and almost always wastes huge amounts of memory...
As one piece of corroboration, look at the daily tsunami of users who don't know what groupby, merge/join are/do, and even when you explain to them it's what they're looking for and point them to the doc, are unable to successfully do it on their data.
Ah, well. The best we can do is either modify the tag usage guidance (which post people don't read anyway), or direct OPs to How to make good reproducible pandas examples at the very least so they get the hint their question needs work.
@smci I know what you mean. You need some degree of competence in programming to work with pandas. If at some point it becomes clear the OP doesn't have it, I just bail.
@coldspeed Ok but that post was closed and locked last year! (users said it needs to be on Meta, which sounds correct by me). Also, "How to make good reproducible pandas examples" sounds like some voluntary, aspirational, applepie thing. The title needs to be something much more prescriptive like "What are specific reasons many pandas questions are closed for lacking an MCVE?" or even "Why was my pandas question closed for lacking an MCVE?"
Stage two, we reach consensus on what constitutes an MCVE in pandas and how to produce one, then start including that Meta "pandas MCVE" link in comments on low-quality pandas questions, before they get closed. So the OPs actually learn what they're doing wrong and how to do it right(!)
03:29
hey guys, is there a fast way to multiple values to a dict without doing a loop, ive already got a really big loop running so i'd like to not have to run a loop
@Skyler "to what multiple values to a dict". insert? remove? append? get? map? Do you care about the dictionary order? etc.
replace the values, im iterating over some REALLY big jsons to then convert them into a sqlite3 db
@smci What difference does it make what the title is and where the question resides? The content is still really useful; especially the accepted answer. I've seen users who were very receptive to editing their questions after taking a look at that post.
For the record, I disagree in general with the closure of that question.
I don't think the question fits into meta very well because it is wrt guidance for a particular tag, not about the site in general. But that's just me.
@coldspeed I just explained why in graphic detail, with multiple examples. Many new pandas users lack the basic coding literacy or vocabulary to understand why their questions are appallingly low quality/ irreproducible/ etc. They need to be told clearly that it's their question that lacked MCVE/ did not need minimum standards for an MCVE. Doing anything other than that is like the coding equivalent of saying "You should eat vegetables and exercise". Whereas they need to be (repeatedly) told:
... "You need to include X,Y,Z when asking a pandas question on SO. Otherwise it does not contain an MCVE and is likely to get closed."
@coldspeed It's clearly Meta material because it's a question-about-asking-questions-on-SO. (or indeed, how-not-to-ask-a-pandas-question-on-SO)
03:42
@smci I think we're sweating the small stuff a bit too much. Sure, specific guidance in a comment is always good, but that MCVE HOWTO post still has some really good examples and perspectives from seasoned pandas contributors
Why not do both! (general guidance on good reproducible pandas questions + specific guidance on what OP lacks)
@coldspeed a) Almost noone was aware of it until you posted it. b) It's closed, locked and on the wrong site, hence cannot be maintained/improved. It needs to me migrated to Meta pronto. c) New users never see it or become aware of it, because noone ever posts it as a comment link on a VLQ pandas question. d) New pandas users wouldn't understand it, read it or follow it anyway - it's phrased aspirationally (like I said), not prescriptively "If your pandas question doesn't include X,Y,Z, ...
...it does not meet our standards for an MCVE, and is likely to be closed/downvoted"
@coldspeed If you meant posting individual specific guidance on what each OP lacks on each question, many people like me have been doing it for nearly a decade and are fully aware it's not scaleable and not dealing with the daily tsunami. Look: new users don't use the search engine, and they rarely read the FAQ. We need to push the (very large) pain point back to them: "read the FAQ and follow it, else your questions will keep getting closed"
The scaleable way to post guidance to new pandas users is one or more Meta question(s) with a very clear simple specific prescriptive directions "What are specific reasons many pandas questions are closed for lacking an MCVE?" or even "Why was my pandas question closed for lacking an MCVE?"
@smci a) it had over a hundred upvotes and thousands of views at the time it was locked, b) true, true, and possibly true (arguable) but I don't really think maintainability matters. Everything we need to tell users is already there. c) perhaps. It is at the top of the tag wiki (I put it there to improve visibility) but I agree that people won't find it unless they actively go looking for it d) two sides of the same coin, IMO. Most perceptive OPs will get it. The hopeless ones will not.
@smci I actually think this is a decent idea; a CW may be in order (do the honours?). You can borrow heavily from the HOWTO since in the essence the content is the same.
03:57
@coldspeed a) I for one never saw it or was aware of it, and I've been active in pandas on SO since at least 2013. b) Needs to be migrated to Meta, pronto. Also, we need the prescriptive version ("Why was my pandas question closed...") far more urgently than the aspirational version c) see a)...
... By the way, the pandas tag definition sucks too. "pandas is a Python library for data science. It supports data manipulation and analysis. In particular, it offers data structures like dataframes, series, tables" No economics/socsci-centric jargon like "panel data". And not all series are "time series", in fact almost all of them aren't.
... d) again, we need both, but we need the prescriptive version so much more badly and urgently. The aspirational one can come later.
I have a class like this ```class Employee:
raiseAmount = 1.06
def __init__(self, firstName, lastName, pay):
self.firstName = firstName
self.lastName = lastName
self.pay = pay

def apply_raise(self):
self.pay = self.pay * self.raiseAmount

@classmethod
def setRaiseAmount(cls, amount):
cls.raiseAmount = amount

@staticmethod
def isWorkDay():
return True```
just wanted to know if apply_raise is defined on the instance or on a class?
@coldspeed Great, we agree. Next, the dilemma about whether to make CW, now or later. I would hold off it making it CW, because I want to heavily incentivize users to write good answers and deincentivize them from writing crap/offtopic ones, at least until the ball is rolling and we've established to all non-pandas users (i.e most of Meta) that there really is a big f****ing problem here.
... Remember, CW on Meta is a whole different ballgame than CW on SO, because high-rep/loud users with zero clue about pandas (or Python, or data science) will shove their oar in and write long off-topic answers that only obfuscate and beat us to death with irrelevant generalities about how they think Q&A sites should function. But their buddies will upvote them, while actual real answers get neglected.
Most users seem to be aware that is a dumpster fire (are there stats to see how many people are currently ignoring a tag?) so we will not have a hard time convincing anyone. What I'm really looking forward to seeing as an outcome for this project is the decrease in the FGITWing from some of the usual suspects.
@Gagan What do you mean? Methods are defined on the class, and since an instance is an object of type Employee, also on each instance.
downvoting/closing questions is still not as much a thing in pandas as it is in the main tag. I think this is a bigger problem than the questions itself.
04:08
@smci then the only difference between setRaiseAmount and apply_Raise method is the first variable that python will pass to that method ? In former's case , it is the instance that is passed, while in the later's case it is the class that is passed, correct ?
@coldspeed No, on Meta most users can't spell 'pandas'. Again, Meta != the python/pandas tag community on SO (where there's a rep barrier preventing users doing destructive things to CWs). We have some work to do to justify to Meta in general (with supporting stats) that the pandas new-user community has specific issues/shortcomings that others don't. One salient example I keep hammering on: why "But I posted my dataframe (as text/image, without dtypes)?" doesn't cut it as an MCVE.
@smci Perhaps. But to address your specific example, the "don't post your code/data as images" is a universal advisory, not specific to this tag.
@coldspeed I said "posting as text, without dtypes, is also not acceptable". It's not just about images. It's about missing dtypes. Ok so we need to break don't-post-text-dump-without-dtypes and don't-post-image into two separate guidelines.
@coldspeed "What I'm really looking forward to seeing as an outcome for this project is the decrease in the FGITWing from some of the usual suspects." I wish. But I don't believe this will put much dent in that. Only SO explicitly incentivizing close-as-dupe, and actively punishing FGITW will.
04:39
Punishment seems a little harsh and is usually counterproductive IMO. I would suggest the route of education, or determent if the former does not work
 
3 hours later…
07:58
@coldspeed After a decade we know that FGITW is a big problem and getting worse, and that SO knowingly incentivizes it and doesn't care to disincentivize it. By 'punishment' (or 'disincentivizing') I mean simply "SO maintains a list of agreed canonicals for a specific tag, and if a question is closed-as-dupe as any of those, and a respondent with rep > [threshold] in that tag knowingly posted an answer, ...
...then when the question is closed-as-dupe, the respondent loses however much rep they gained from answering the dupe, and a small rep penalty, perhaps -10 or -25. That's all we need to kill FGITW.And it would be productive, not counterproductive, on the subset of questions and answers that each tag's community declares to be canonical. That all seems pretty straightforward to me (other than the missing SO functionality to nominate, vote on, maintain, publish a list of canonicals for a tag).
08:45
Morning cabbage
The dupe menu on mobile site and app is a complete mess
Borderline unusuable
I just fought a solid 5 minutes with the interface to agree on that dupe
Somehow there are 0 duplicate votes on the question... did you accidentally retract your vote after you cast it? :D
@Aran-Fey needs 2 more votes
oops, I CV-d as too broad
Na, I think closing as too broad was better anyway since OP didn't give much (although your link might be a blessing for him & others to come)
dupe/no mcve/too broad are all reasonable choices IMO
yep
Sunday cbg :)
@Aran-Fey might very well be, but i'll claim to have no way to check that before i get home
08:56
Here's another pandas question that tests the limits of "How welcoming...?". Do finance people really refer to "n-month-lagged percentage gain" as "a simple momentum signal"? stackoverflow.com/questions/55203292/…
 
2 hours later…
10:48
Hello, I am having a strange issue with the json module, i used python to dump a dictionary to a local file as json, but when I attempt to read the same file back via json, I keep getting the following error, when I attempt to use json.load or json.loads on the json file I am reading:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
I also tried
with open("data.json", "r", encoding="utf-8") as f:
     data = json.load(f)
but no luck :(
how did you dump to json?
HOME_DIR = os.path.expanduser("~")
json.dump(x, open(os.path.join(HOME_DIR, "Config", "data.json"), "w"), indent=4)
sorry just added the encoding to try*, originally it was not there for both
the file is empty, isn't it
Did you close and reopen it?
"Expecting value: line 1 column 1 (char 0)" == "I couldn't find anything to parse"
10:55
no when i do print(f.read()) above, i see the json data
Hmm, with open in the dump call you probably did
i also tried the following to save the data:
with open(os.path.join(HOME_DIR, "Config", "data.json"), "w") as f:
    f.write(json.dump(data));
regardless of which dump method I use, i can see the json data on the file, and when I read the json data its reading
but json.loads, still shows that error :(
What's the output of this?
with open("data.json", "r", encoding="utf-8") as f:
    text = f.read()
    print(text)
    data = json.loads(text)
same error @Aran-Fey, i tried that :(
let me try again though
kill kernel and stuff too, if you're using that
11:00
@Aran-Fey, I take it back, it worked, now :D
weird it breaks when i do data = json.loads(text.read())
sorry by break i mean it shows the error*
You mean f.read()?
yeah f.read() sorry
see if it still breaks. for science
I think your interpreter is haunted
@ParitoshSingh it does :(
I am using sublime text 3
let me close and reopen it i guess
lol yeah, it still breaks if i pass f.read() as a parameter to json.loads()
but if i do @Aran-Fey's method, it works, where I store the f.read() on a variable, then load that :(
just tried the same code in idle, and same issue, I am using python 3.7.1
only works if i store the json file data to a variable first :D
Oh well thanks all :)
Sorry to bother again, I used the os.path.expanduser("~") call for the first time today
I actually wanted to access the file within Documents folder, not the user folder, however when I tried:

os.path.expanduser("~/Documents")
It points to C:/Users/User/Documents even though I have changed the Documents location folder to D:/Moved Users/User/Documents instead
Which lead to access errors, any idea on how I can make it look at the actual location for the document folder regardless of where I run the code from
11:23
for a computer, a path is just a path. there is nothing special to the computer about the D:/moved Users path. How does it understand its supposed to be the documents folder? You may perhaps want to bruteforce search all drives until a certain depth for "Documents", but whatever solution you come up with will probably be hacky.
Unless,is there a place that you can use to reference where the documents folder resides?
11:36
Oh okay, I guess your right, I was just checking to see if there is no os call I am missing which can easilly navigate to Documents, Desktop, etc.. doing all the bruteforce checks for me :)
@ParitoshSingh to change the location of the folder, I just used the properties (i.e. right-click > properties) on the documents folder, so maybe that defined new location path maybe stored somewhere, but currently havent looked at it
That could be something, potentially in registry or user properties with how windows stores things. But i dont know much about it im afraid
Thats ok, was actually just seeing if I missed something more easier to use from the os module :)
For now just storing it in the User folder it self, would be good enough
Thank you very much :)
12:12
Nice to see you @SShah :)
Been a while'
Heya @Simon i know very long :)
@MartijnPieters That dupe. What gives you the idea it's a csv?
you ok?
Yea fine thanks
Still working on some new projects
haha nice :)
12:14
I updated my image reader
ohh cool
I am learning the Flask module atm
HAvn't updated it on github yet
Nice
oh
I wanted to, but never was able to run it on a server
haha i see, I havent got that far yet with it
12:16
Still working mainly with Js?
just locally running the server for now, and learning
Yes, if you don't run your own server it shouldn't be a problem. It's just that I do
Yeah, JS is my life right now, but alot of Python on the side, coz I love it more :D
Python is easier but suited to different tasks
ohh a server at home or a host?
12:17
local home one
Wow thats cool
@Simon the alternative is 'unclear', now they have some information.
it's a testing one, but it works on the home network only
@MartijnPieters It just seems to be a bit of an assumption to say a csv, I personnally think they want to write what it prints into a file.
Thats really good
I am really liking Flask though, it feels much easier to use, then PHP so far
@Simon so space separated; csv.writer(..., delimiter=' ').
12:20
It is. PHP can be such a hassle
Ok I see
Yeah, I am happy the only place I used PHP was uni. After uni, I did try use it once, but it drove me crazy so I just abandoned the project
You don't need csv for that though
How is your website going? Still left?
@MartijnPieters Ok you were right, new comment in a separated format
 
2 hours later…
14:06
My CS uni prof got immense amounts of backlash for dropping PHP and teaching Python that year.
@Simon Notably, arbitrary tasks, being a general purpose language. Not a CGI-based C-language template engine. E.g. managing the n-body physics of curled hair strands (hair in Brave), rendering 3D such as Brave (Blender), Karplus-Strong string synthesis in Logic for guitar (and other stringed instrument) simulation, realtime MIDI event filtering+mutation to simulate multi-stringed fretted instruments (calculating finger velocity movements to add accent details like scratch harmonics), …
/me feeds Python another cookie.
@amcgregor your CS professor was using php for CS?
For part of it, aye.
but it's such a terrible language. why not C++ instead
14:21
Had been for a few years at that point. Also covered C, a fundamental basis in Pascal, and machine code (learning computation) for three architectures. S'what scared me off x86. XD
i mean, he dropped PHP for python
@Rick For all of the reasons one avoids C++ and uses literally anything else. ;^P
(While I agree, everyone should learn about pointer safety, there are… gentler introductions to [arguably pointless] dangerous memory management techniques, if you'll pardon the unintentional pun.)
user6564029
is C++ really this bad? never really tried it, stuck with C by accident and kind of didn't care about C++ additions to try it.
@Michail It provides ammunition and firearms of unique and interesting design that encourage you to want to play with them.
For example, one flaw a few years back, now, in Apple's OSX was that of failing to validate SSL certificate revocation. Due entirely to the accidental placement of a second identical case statement after the first. Which visually ought to have happily cascaded down through, but… poof goes your revocation check.
@amcgregor so it's bad because it allows for unique and interesting designs. That makes sense.
but in a weird way, so we don't want unique and interesting designs
14:35
@Rick Up until you try implementing plugin architectures, then you run face first into the "pointers to members cannot be subsumed under the type of their receiver" limitation. I've had greater success writing object systems in C than using C++'s. XP
@amcgregor concept seems a little vague, so what's an example of this
user6564029
@amcgregor and I thought haskellers' jargon is sometimes hard to understand
14:49
C++ just tries to give you a little too much. You can control memory down to pointer arithmetic, but, with every new update to the language, it also provides every major paradigm that other languages came up with. They should just call it C++++ at this point.
@Arne but that's a good thing, right?
you can get down and dirty, or stay high and clean.
As a direct result, and fwiw my personal biggest gripe with the language, you may write C++ code for 5 years, switch to another company that also writes in C++, but with such a different subset from the language itself and such different design principles that it pretty much feels like learning a new language
@Rick s.webcore.io/001cdfbe2bed/MarkThomas--Y-Windows.pdf is an example of an alternative protocol to X-Windows that "flips the script" (given the already confusing client/server terminology used in X11). This went for a message passing approach (similar to Objective-C) to avoid some of the C++ limitations in dispatching generic callbacks object-orientedly.
@Rick It theory, yes, but in practice, if everything is allowed and there is little to no vision to how the language should be used, things just go wrong
i have a hard time putting it into more objectively meaningful words
as soon as i collaborated with more people, i just had a hard time with the language
Adding more features sounds good in theory, but before you know it your language ends up like this, is what I believe Arne is saying
14:56
exactly
eyyy bulk rename
its a good tool though. haha
Perfection is achieved not when nothing more can be added, but when nothing else can be taken away. Related: Feature lists should not be the goal of any project, solving a problem should.
3
15:22
@Rick Imagine living in an apartment complex where every day you'd need to go to a different door on your floor to catch the elevator. And when you pressed a floor, some complex mathematical formulae was used to calculate the actual floor of selection. That's also dependent on the day of the week. People want to be able to reason about the behaviour their software; predictability and reliability trumps uniqueness in every single practical case, period.
@Rick For example, here are my notes on the recently deployed Destination Dispatch elevator upgrade at work. The violations from expected elevator behaviour are… surprising.
And in one case physically dangerous.
15:37
I get the bizarre sensation that the people who wrote the DD upgrade had never actually utilized an elevator personally, themselves.
@amcgregor That statement seems ambiguous. However, people should have the same domain knowledge specializing in a particular field.
@Rick Do I need the same domain knowledge as flight crew or a pilot to take a flight? While I find the domain fascinating, clearly, no. (Cross-check dem explosive bolts!) I'm fully willing to not specialize myself in something I'm hiring someone else to do for me. That lets me more greatly specialize in what I do contribute to the project.
Libraries are that "hiring someone else to do for me" scenario.
hey guys, Has anyone used gmail api?
cbg all
I don't know if its possible to do what the OP asks for in this question: stackoverflow.com/questions/55203298/…
But if this is hackable, then could be very useful
16:10
what should it say instead of 0x80?
The point is it can't be decoded
Maybe a custom function that can get the character at that position
what character?
the character that cannot be decoded(e.g at position 1678 in this question)
So whenever a UnicodeDecodeError is raised, a custom function is invoked that attempts to get that character.
If it were a character it could be decoded. It's a byte that can't be decoded. That is 0x80.
Do you know how encodings work?
user6564029
the line number is probably possible to get (are there encoding where \n is not the usual thing?)
16:16
I don't think OP's question makes sense.
yeah that makes sense, but line number seems possible, isn't it?
Yes
You can take the first 1677 bytes though
user6564029
@AndrasDeak "yes" - yes there are, or yes it's possible?
"Yes there are" what?
Ah, \n
the issue is, it will still be a non readable blob of byte string, or a wrongly decoded character because this encoding failed to decode the byte.
16:20
I use directed replies unless it's unambiguous (last relevant message)
as far as i understand, you can, at best, only guess the encodings if its in bytes, but can't know the actual encoding for sure.
And the first 1677 bytes can be wrong too
@Michail hopefully everything is backwards compat with ASCII
i think we should reserve first 64 characters of every byte string to tell its encoding :P
16:32
:argues in favour of Pascal strings for the added security and ease of network transportability benefits:
Oh, also, a PNG-like header to detect 7-bit (unsafe) transport and endianness swapping.
16:53
0
Q: Procedure is not working in the way it should?

Adam GI've been told to write a procedure to find the last position of a substring in a string. It seems to be outputing false information and I'm not sure where I've gone wrong. Can anyone help? def find_last(s, c): last_position = -1 while s.find(c) != -1: last_position = s.find(c)...

@AdamG hi, Adam?
Welcome to the room, Adam
Weird how you'd just drop a link to your question to the room without saying a word, Adam
Hi, guys I'm the new one to this chat room.
17:14
Your definition of weird is weird.
Oh. I meant it as "on the impolite side"
17:47
hi
anyone can help me with my script?
we won't know until you tell us what the script does and what's wrong with it
its a requests script, only had the problem with the threading
how do i making a threading with While True: ?
that doesn't make sense, an endless loop runs in one thread and presumably the rest of your script would run in another, what it does in that thread is unrelated to threading (except the parts where you explicitly communicate between threads)
an actual question might look like "here it the code I have, here's what I want it to do, but it doesn't" but nontrivial amounts of code are not very suitable for chat
if im using def main(): it just request one email and exited, how to make it work without the loop
i mean , yes i want the multi thread but if not email: break stop me
18:06
why would you use threading for that?
to make it requests faster
im using t=threading.Thread(target=main)
t.start()
only execute one requst then exited
wait, are you talking about scraping web sites with the requests library or someting about email? sending or receiving? what's a "request" in this context?
test = s.post("https://appleid.apple.com/account/validation/appleid", data=data, headers=head2).json()
im making a validator script, if the email registered on apple it will send me feedback
this does not sound at all like something a legitimate program should need to do, especially rapidly
yeep, but i have done it on bash, work perfectly
18:12
and anyway threading won't help much on a task which is inherently I/O bound, the latency completely dominates over any possible CPU-bound inefficiencies
even if im using vps?
There's a couple of guys that have me second guessing an answer I wrote...
@CahyaDarmaWijaya That sounds like abusive repeated or rapid polling of a non-public API, likely in violation of the terms of use for the site in question. My 2¢.
yea, i dont know man, im just using some post shit, hopefully i dont get arrested by this
this is just like pulling a string on some website
@AaronHall i'll bite. what's it about?
18:19
In Python 3, __ne__ by default checks if the result of self.__eq__(other) is NotImplemented (if so, returns it) and then (otherwise) returns not the_result.
I think the right way to implement __ne__ if you must do so yourself (and you must in Python 2) is to return not self == other - invoking __eq__ at a high level.
Which should handle NotImplemented for you.
They are arguing that one should handle NotImplemented in the Python, but they haven't yet persuaded me that it is correct. I have example code that demonstrates my assertion works in the examples I give. They do not seem to do the same, further they do not disprove me.
@ParitoshSingh yo man u bite the bait, answer these, i dont understand anything
""(Specific example, using malloc/free/printf correctly, new[]/delete[], not using for i in range(len(foo)). Simple stuff like that.)"""
what is wrong with for i in range(len(foo)) ?????
I do this all the time
@Permian What even is that?
18:29
sorry a quote from a forum online
yea man Xd cant understand
@Permian help me with my python script
@CahyaDarmaWijaya we ask users not to use crude language, by the way
@CahyaDarmaWijaya and we also ask users not to ping (@username) users unsolicited
i have literally no idea what is going on here
anyway
18:31
think i had to read the rules again
what is wrong with for loop like that?
@AaronHall Sounds reasonable to me. As far as I can tell, neither one is inherently wrong, but __eq__ makes it easier to do something wrong (like forget to handle NotImplemented)
sorry i found this later in the forum
@Permian that statement doesn't make sense. "malloc/free/printf correctly, new[]/delete[]," aren't from Python
And there's no context
18:32
@vaultah not using for i in range(len(foo)). Simple stuff like that.)
..
This is definitely beyond me, but i suspect the best bet is to just dig through the actual implementation in source code
Only a "noob" wouldn't know about enumerate(), right? Why is enumerate better than a for loop?
i have to go its 2.32 am now in indonesia tomorrow i had meeting with someone, cya guys
@Aran-Fey I would like to prove myself correct. I have reviewed my critics' work and have not picked out a test case that would serve to prove that my preference is wrong.
@Permian enumerate isn't better than a for loop. enumerate can be used in a for loop
18:35
they are saying it is, something to do with iterables
certainlyfor item in list: do thing with item is better than for i in range(len(list)): do thing with list[i]
> Aaron Hall’s implementation not self == other of the __ne__ method is incorrect as it can never return NotImplemented (not NotImplemented is False) and therefore the __ne__ method that has priority can never fall back on the __ne__ method that does not have priority.
right, instead we rely on the __eq__ method that has priority, no?
for i, x in enumerate(foo): # <--- a for loop
for i in range(len(foo)): # <--- also a for loop
for item in list: # <--- also a for loop
there are of course situations where you want to know the numeric index (in which case, enumerate()) but people with a C programming background (or other similar handicap) often think you need to use the index to loop over the list
ib = iter(list); while (i := next(ib)): … # ← also a for loop (if I recall the syntax addition correctly ;)
18:47
oh gosh, i would not want to see iterations done that way
:= for fun and profit! (And job security!) :D
i := next(ib) needs a default, I think
i := next(ib, None)
be back in an hour or so...
(so if anyone wants to respond further to my thoughts, please do so)
I think any case that could be constructed where not == gives a unexpected answer for != would have to be pathological...
@AaronHall Yeah, I don't see a reason why your __ne__ would ever have to return NotImplemented. Assuming the class on the right-hand side has a correctly implemented __eq__, everything should work fine. If it doesn't, then of course some silly things can happen.
class A:
    def __eq__(self, other):
        return NotImplemented

    def __ne__(self, other):
        return not self == other

class B:
    def __ne__(self, other):
        return False

print(A() != B(), B() != A())  # output: True False
19:03
Premise 1: `self == other` is implemented correctly.
Premise 2: For any 2 variables `a` and `b`, `a != b` should return the opposite of `a == b`, i.e. `not a == b`.
Conclusion: `return not self == other` is trivially and obviously a correct implementation of `__ne__`.
*shakes fist at chat formatting*
hi.. I am trying to find real roots of a polynomial using numpy like this bpaste.net/show/b8d27ccc46d0 . But it's very slow. Is there a better way?
01:00 - 20:0020:00 - 22:00

« first day (3074 days earlier)      last day (2099 days later) »