« first day (3945 days earlier)      last day (986 days later) » 

4:04 AM
from concurrent.futures import ThreadPoolExecutor, as_completed
import requests

def google(n):
    response = requests.get(f'https://jsonplaceholder.typicode.com/todos/{n}')
    return response.elapsed.total_seconds()

with ThreadPoolExecutor(8) as pool:
    futures = {pool.submit(google, n): n for n in range(500)}
    for future in as_completed(futures):
        print(future.result())
cbg all, can anyone tell me why I seem to get more elapsed time in the following code? it must not take 0.5 seconds per request, in actual use case, I am using this in an internal API, but for MCVE using a public one
I only seem to get an increased time when it is threaded
 
 
3 hours later…
6:38 AM
cbg
 
6:57 AM
@python_user What kind of timings are you seeing? I get something like 1.5x to 2x total_seconds when using threads. Still a good speedup overall.
 
the first few results are in the range 0.124896 then I start to get in the 0.549974 range
 
Are you sure they aren't throttling you?
 
idk the case with jsonholder, but the internal API is dev access, so there isnt any, but them again this is not consistent, I sometimes get ok results, but this does happen
 
Cranking up the numbers a bit, it looks like the total response time stays the same.
 
7:16 AM
ok thanks for confirming, maybe it is my internet then, I was just wondering whether there is time were the thread was started and "paused" and requests started counting from that time
 
In principle there is, but it should be negligible even compared to the "fast" response time.
 
I still have to understand this more, might as well async this and see how it goes
 
Make sure to also try a different endpoint, though. Just to rule that out.
 
that is a good suggestion, melon
 
 
1 hour later…
8:35 AM
@Kevin looong shot, but I don't suppose you kept a copy of that recursive CTE code somewhere on your system? I can't find the script and it was a nice toy example to send to one of my colleagues for BOM generation
 
Hi, not sure if this is a valid question to ask here, but I will give it a try: I am teaching an introductory course to ML for engineers, and I am looking for a simple example where a LSTM model is implemented for time series prediction (not necessarily seq2seq, just predicting the next time step). Ideally, this should be in the Keras framework, and use a real-world dataset to demonstrate simple, basic LSTM functionalities.
 
 
4 hours later…
user16280768
12:44 PM
    from PyQt5 import QtSvg
ValueError: PyCapsule_GetPointer called with incorrect name
 
If that's all the code that threw that error then this sounds like a broken PyQt5 installation
comments say things can break though
there might be some info at duckduckgo.com/… but without a public issue tracker of pyqt5 this won't be easy to dig up
 
 
1 hour later…
1:59 PM
@roganjosh Sorry, I didn't keep a copy
Bamboozled once more by pastebin-like services that don't keep copies around forever
 
No worries, I didn't expect you would. It was just an off-chance you might have some giant SO folder :)
I think for stuff like that I'm just going to default to gist. It's a few extra clicks and a change of login but dpaste doesn't buy me much at all in the long run
 
I have some truly old scripts lying around but there's not much rhyme or reason to what I keep
 
In all truth, I probably still have it somewhere in a delete_me.py file buried in whatever repo I was working on at the time. My mental indexing system requires an upgrade
 
2:15 PM
pastebin does have the keep forever option right
 
pastebin is also full of junk ads and is blocked by some companies. Or at least it was; I know a few people here haven't been able to open the examples in the past
 
fair enough
 
2:33 PM
you name a code paste site, and i probably can't open it. cbg :)
 
3:24 PM
there is a nice rhyming proverb in german saying trying is better than thinking
 
4:06 PM
Has anyone familiar with Flask/Django had some decent experience of Streamlit? I'm pushing for webapp deployments in Python to be supported at work but a lot of DS don't want to go further than dashboarding so I'm curious about any shortcomings you might have faced. Ultimately, I guess I'll have to learn a tech that I don't really want to use, to support my argument
 
 
3 hours later…
6:49 PM
So, having some name related bike sheding. So I have C++ code paths for List[SomeClass] and SomeClass, but not sure how to call the two cases. Thinking of calling the former the "Iterator" case and the later the "Singleton" case but somehow Singleton has a name alias with an unfortunate C++ design pattern. Any thought on what to call the single object case?
 
This is a Python room!
 
@αԋɱҽԃαмєяιcαη It looks to me that this is down to typing so I'm not sure your protestation is correct here
 
@roganjosh Ah okay, then i got it wrong. thought it's C++ question then.
 
@Mikhail Actually, is this about Type Hints? You've slipped them in to make it python-related, but then I think it might be about C++ at its core
 
its about what to call the code paths when you have List[Item] and Item
so its kinda python, but mostly English
A lot of what I'm doing these days is Python/C++ interoperability
 
6:59 PM
It really isn't, though, is it? It's naming C++ classes. And why should the object have a different name when it's either an object on its own or a list of that object?
 
Not classes, just what to refer to the two code paths when talking with coworkers
We have "one code path for the Iterator case and one code path for the {} case "
 
Well, I wouldn't say to my coworkers that I have an singleton_int and a list_int, for example
 
I came here to bikeshed about something else !!! :-)
So "singleton" is the right word?
 
No
 
no
"scalar" perhaps
 
7:02 PM
oh whats the right word?
 
but that's somewhat niche in numerical programming
scalar vs array-valued
 
yeah scalar would be a number
 
The antonym of iterable is "not iterable"
Note that "iterator" would even be wrong for a list, in python.
 
@Mikhail when you say "case" are these two separate functions with those signatures?
or like a conditional in the code
 
Yeah, when you do C++ interop you need to eventually cast the PyObject* into whatever type it contains
So if your API supports both List[Item] and Item you gotta write code to get the objects out of the List
I'm just kinda lacking a standard vocabulary to describe the process
 
7:06 PM
unpacking
 
Depends. You might want to add the single value to a list before you pass it on. Do you have context?
 
yep thats what I'm calling the process, but not sure what to call the individual cases :-)
 
@Mikhail list case and unpacked case?
only if there's no "non-list but not unpacked" case
 
7:24 PM
pretty clearly List[SomeClass] is @ and SomeClass is $.
 
 
3 hours later…
10:07 PM
don't quiet understand what the "@" and "$" symbols mean
 

« first day (3945 days earlier)      last day (986 days later) »