« first day (3990 days earlier)      last day (941 days later) » 

6:24 AM
cbg guys
 
 
2 hours later…
8:19 AM
Looking at Google OR-Tools, they've absolutely hammered vehicle routing problems recently so I've started building a backend for my solver with it. They even have "soft" time windows (which is my holy grail!!)... and then I find out they have a broken implementation for driver lunch breaks since 2018 :'(
I don't understand why you'd pile so many resources into something like this when it's totally unusable. Breaks are a legal requirement, both in Working Time Regulations and with tachographs... so it basically can't see the light of day unless you hack things in post-processing. Ugh.
 
Google's ways are incomprehensible to us mere mortals
 
I got so excited going through their API ("Holy yam, they have that but it's just undocumented on their website? I need to get building!") only for it all to crash down on something as fundamental as a lunch break. Worse is that it's a monolithic C++ library so the prospects of trying to fix it with a PR are... low
 
9:01 AM
Hi everyone, its considered a bad practice to pass more than 3 arguments to a python function. However, when it comes to methods, we usually pass 'self' as the first argument. In this case if we pass 3 more arguments would it be considered bad?
 
What, only 3 arguments? Who the heck came up with that ridiculous idea?
 
At that rate, I think I might as well just burn all my code and start again. I have failed :'(
 
:D
I think I read it in a medium article. Since they are written by juniors and seniors alike, it could be wrong. What would be the best practices according to you all when it comes to passing arguments for functions and methods?
 
well, first up - it's flat-out wrong. A function takes as many arguments as it needs to, err, function. Having a lot of arguments could be a symptom of the function trying to do too many things, but there's loads of stuff that is "atomic" but needs a lot of specification. If you want to plot a graph, you'll need the colour of the line, the x-tick spacing, y-tick spacing and... oops you're out of arguments
 
There are a few scenarios where having too many arguments can make the code worse, but those are pretty rare, so don't worry about it until you have to
Lame example, but if you have 5 different functions that all take the same 7 arguments, you should probably make a class that stores those 7 values and turn your 5 functions into methods of that class
 
9:29 AM
thanks for clearing my misconception!@Aran-Fey@roganjosh
 
@RaphX no, they are written by every random person and their dog
Stop believing any bullyam you read online
Especially clearly opinionated ones
 
@AndrasDeak haha, is there any other sites similar to medium though but by genuine authors ?
 
I bet the folks at medium went from "hooray, we're getting popular" to "yam, we're being associated with low-quality content" real quick
 
also, how do you keep abreast of the latest developments in python or in topics related to software engineering in general (apart from books)?
 
probably wasn't part of the plan
 
9:34 AM
There's no good way of knowing the veracity of articles that I've found. I both love and hate Medium and similar sites; it sometimes shows me some library I didn't know about. At the same time, I never take their recommendations on face value
 
@RaphX if anyone can post, it's always a gamble
Use your judgement rather than relying on the platform itself
 
Welcome to the misinformation age, we hope you enjoy your stay
 
Not only that, but you can see that the articles are written by a single person. You can see the author. I could quite happily tell you why all your pandas indentation is wrong, and why you should never use black with pandas. I actually genuinely feel that way, but it's my opinion and it'd probably make you very unpopular
That doesn't mean I haven't cobbled together some nice tool chain. But you're still getting my opinion layered on top. You need to make the distinction
 
10:07 AM
thanks everyone!
 
10:29 AM
@Aran-Fey also Dunning–Kruger
 
10:49 AM
@roganjosh Tell me about this compulsion to avoid a canonical form. Do I gather you feel it impedes readabiliity?
Oh, and cbg, everyone. Sorry I've not been much in evidence. Work, the Nutshell and the death of my brother have all made deep scars in my online social life.
 
Firstly, I'm really sorry to hear that :'( Maybe a catchup over a beer is in order? I hope you're ok?
 
Current obsession: function calls. Matching arguments to parameters is significantly difficult to describe in simple terms.
 
@holdenweb I'm so sorry :(
 
@roganjosh Thanks. August was a really rough month. Fortunately I work for an enlightened employer who immediately told me to take off all the time I need. David dies in the first week of August, which I'd already booked as vacation. I didn't get back to work "properly" (though my attention span is still not it was) until two weeks ago.
Beer catch-up dfefinitely in order, if only on time grounds!
It's been far too long.
@AndrasDeak Many thanks.
 
I don't remember where you're based but I actually booked a week off from the 4th Oct so I'll try catch up with people. We might be able to do it in-person vs just on Hangouts
 
10:57 AM
Also fighting The Machine to get Macs approved as development machines. Currently I cn buy what I like but the equipment budget is moving to Finance and Legal in 22, and a "PCs only" policy looms if I don't head it off at the pass. I'm keeping my powder dry at present.
Since attack is the best form of defence, however, I'm preparing a business case to demonstrate that if monetary considerations were all that mattered everyone should be using Macs. See how they like that.
It seems wherever I end up my principal role becomes "buffer against corporate bullshit for the engineering staff." What am I doing wrong?
 
if you ever find out, be sure to let me know
 
I asked for this. I spent the best part of thirty-five years as an independent consultant to avoid it, but even purchasing departments of large companies made that difficult, so they paid premium rates.
But then I got tired of administering a small business, and just getting paid a wage seemed attractive, so I joined LittleCorp to lead a small engineering team and wind down to retirement. Now LittleCorp is becoming BigCorp, and I have to design ways to interface with The Machine and yet keep life relatively painless for engineers. An interesting new set of problems.
What, only one star-worthy post in six days? You lot have been slacking!
@roganjosh I'll be in Valencia to see our new European Engineering Centre and take part in Product Week - I'll be meeting about forty of my colleagues for the first time in person!
 
11:15 AM
We've had quite a bit of "fun" on the starboard in recent days.
@holdenweb Ah, it'll have to wait, then. I mean, I'm kinda a big deal when it comes to meeting delegations but I might fall short of that in importance :P
 
Hey, we can meet in London some time, I'd have thought.
 
For sure. I still have another 3 weeks of annual leave to take.... :P
 
But let's do the online beer thing anyway. We can just pick a time and see who wants to join in. We already know we can handle just us!
I'm well overdrawn on standard vacation: thank the stars for our unlimited vacation policy.
 
Sounds good to me. Do you want to organise it or me?
@holdenweb to answer this specifically; I hate what it does with chained operations in e.g. pandas or sqlalchemy. It's "uncompromising" but so am I, and I take it on a case-by-case basis to help me understand what the code does. I don't expect that it'll gel with everyone, but I set the indentation of my own libraries myself
 
11:53 AM
hey guys, quick question, can I use any object that is of type "type" for type hinting? I am asking this because I remember one had to use typing.List in older versions now its not needed
so basically, can I type something with the return value of type(something)
if context is needed, I want to type annotate a list that stores Future objects that I create using ThreadPoolExecutor.submit
 
Yes, any object of type type can be used as an annotation, because being of type type means it's a class. typing.List was only necessary for generics, like typing.List[int], and starting with 3.9 you can use list[int] instead.
 
got it, thanks
I noticed possible online room 6 hangout, hopefully I could attend it this time if it happens :D
 
 
4 hours later…
4:07 PM
Absolutely no reason why not, once we sort a date and time out.
 
Hello sorry to interrupt the conversation, I need some guidance on how to code an online converter application REST python backend. The frontend can be an android app where users select files to upload via HTTPRequest. Also what if multiple Users are using this, how can the process be queued? Please I have no physical contacts with a knowledge about this topic. Searching gives me only results on how to use existing services.
 
@Aran-Fey But I don't believe there's any requirement that in list[x], x must be of type type. The interpreter's quite happy to accept list[33], though clearly that won't have any meaning for mypy and friends.
@McMidas One way would be to run each conversion in a separate process. There may be some tricks needed to hand the connection off to the separate process, allowing the server to accept a new one, ut I'm pretty sre that's a solved problem.
 
The interpreter even accepts list[33, int, ()], so that's a pretty pointless measurement *shrug*
But no, it doesn't have to be a type. It can also be something like typing.Union or typing.Any, or a forward reference (i.e. a string)
 
@Aran-Fey Is any advice available as to how classes should implement __getitem__?
 
4:22 PM
Don't, just subclass typing.Generic
 
4:37 PM
@McMidas That's a very very vague question. Find a framework that handles HTTP requests, and start coding. If you have something to queue, throw it in a list or a deque or whatever.
 
@McMidas What is the demand likely to be like? Depending on the type of the conversion (and I'm just covering my rear with this because I can't think of really heavy conversions) you might just be safe with the fact that web servers are threaded and therefore not need a queue
 
5:21 PM
I'm running a Python script which uses seleniumwire. Does anyone here have any experience with the same CSS selector working when running a script on macOS or Windows, but apparently not working when using Linux (Debian on Google Cloud compute instance)?
 
Nope, but that could have plenty of reasons... different browser, different selenium version, server sending you different HTML depending on your OS
 
Tried it with both chromium and chrome so far, same result.
I saved the page_source, i.e. webdriver.page_source.encode("utf-8"), and it seems to contain the desired element as expected.
Hm, installed the same versions of selenium and seleniumwire on both my local macOS machine and the remote Debian machine. Behavior remains unchanged so far.
 
6:01 PM
Could you upload the HTML and your selector somewhere so I can take a look?
 
Sure, one moment.
I'm just trying to get the translated text on the right side on deepl.com. It's working fine on macOS (Catalina 10.15.3) and Windows (10 Home).
But not on Linux in a Google Cloud compute instance (version 4.19.0-17-cloud-amd64, debian-kernel@lists.debian.org, gcc version 8.3.0, Debian 8.3.0-6, #1 SMP Debian 4.19.194-3, 2021-07-18).
The same code worked fine on other computer instances I set up in the past.
 
6:17 PM
Ok, no idea why that doesn't work. But isn't the :nth-child(1) redundant there?
 
Ah, good observation, I got that right by accident. I assumed that 1 would get the second element, not the first - but it turns out the the first one actually is the one containing the translation.
But all 3 of the selectors in pastebin.com/SRCD8d88 should work. So maybe I'm getting a TimeoutException due to some other reason.
 
@SphericalCowboy I'm sorry if I'm missing something, but why do you think it's the css selector that is the problem? Reading the script in question, and keeping in mind that I am not familiar with some of the libreries therein, I feel like there are many different things that could screw up between such wildly different execution contexts
 
6:33 PM
Just my first guess, because I had problems with it in the past (because the website's HTML was updated every now and then, unsurprisingly). But I suspect that may not be the problem here after all.
 
@SphericalCowboy What's the exception say?
 
Traceback (most recent call last):
File "/home/.../.../translation.py", line 340, in translator
element = WebDriverWait(driver, wait).until(cond)
File "/home/.../.local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
 
dayum, so close, I'm convinced the lines just after Message: are like the holy grail
 
Those empty lines are quite pleasing to look at due to the calming nature of their emptiness.
 
6:50 PM
I shall bask in that light and drink this beer in support of your quest
 
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "csv_translator.py", line 278, in translator_thread
title_tr = translator([title], driver, prefix)
File "/home/.../.../translation.py", line 346, in translator
raise TimeoutException
selenium.common.exceptions.TimeoutException: Message: None
"None" is also rather insightful.
 
Thou shalt.
 
what if you'd remove the code from the try block and let it fail on its own, wouldn't python extract the error message more easily? I'm not extremely versed in python exception handling but I've come to generally see manual exception building as a very nice hiding spot for weird bugs
like underneath that couch where I never broom
fun fact, I have developped a previleged relation with the spiders living in my house
 
Uncommenting the bits of code for manual exception handling at the moment, let's see.
They let you use the whirlpool when they're on vacation?
 
6:59 PM
heh
I just wish they'd pay rent with something else than spidersilk
I meant something like :
args = (By.CSS_SELECTOR, output_css)
cond = ec.visibility_of_element_located(args)
wait = RootConfig.DELAY_WEB_DRIVER_WAIT
element = WebDriverWait(driver, wait).until(cond)
(clarifying because I'm not sure on what "uncommenting" means in your previous sentence, please ignore me if it was obvious)
 
I'm equally unsure what "uncommenting" means in my previous sentence. I suppose I am "uncoding" them by, ahem, commenting them.
 
So why don't you found Spider Silk Road and sell it there?
 
that sounds suspiciously like work
 
Some of it might even involve the horrors of manual labor.
Hm, this whole uncommenting business did not provide more information, either.
 
7:14 PM
I'm not sure whether this is relevant, but "uncommenting" to me means removing the # in front of blocks of code so that it actually runs
ctrl + / on highlighted blocks of code in VSCode, for example, will prepend every line with # and it won't run, it's now just a comment
 
I believe there was some artistic leeway in the use of the word, namely we can't english
 
Eh, I think you English just fine :) I wasn't sure whether it was a language thing or something hyper-specific to this problem
 
I was just commenting out code here rather than actually uncommenting it.
 
 
4 hours later…
10:56 PM
Hi everyone. Can i get some help with writing a function in Python?
 

« first day (3990 days earlier)      last day (941 days later) »