« first day (4028 days earlier)      last day (906 days later) » 

12:42 AM
Lottery method search. Pick one at random and hope for the best.
O(1) complexity
Hello @python_user
 
that was a surprise, but considering your name I shouldn't be ;)
cbg guys
what is $n-1$? is that a measure of complexity?
 
1:08 AM
I never used PyGame. I wonder if I should have used it when I wasted a week writing this nonsense: github.com/SurpriseDog/Mesa-Predator-Prey-Model
easier than tkinter?
 
 
6 hours later…
6:55 AM
Think this may be duplicate stackoverflow.com/questions/69718598/…
 
7:14 AM
It's just a bad question. No need to throw any more effort at it than the asker did.
 
fair ^^ trying to put more effort into the questions on main atm. both editing and answering if I can (Tend to do more of the former than latter as nervous to give wrong advice)
 
@Joe Unity has some awesome learning resources and pretty good explorative workflow due to its inspector. If you have even a minuscule experience of OOP, I'd say dive in with Unity directly.
You will end up throwing away the first few projects – much better if these help you get familiar with the entire Unity toolchain instead of just the few parts you could transfer from PyGame.
 
7:35 AM
hey guys, what is the good practice when I want to use one requests.session object with multiple functions?
I have attached auth and mounted an adapter, having to create a new session in every function and doing the same seems to be DRY
 
@python_user make a class and store the info to the class attributes
 
that seems like good, but my functions are not related to group under a class, even if I did, how can I use session as a context manager?
I would do something like self.my_session = requests.session(), idk how I can use this as a context manager now
 
You don't have to use it as a context manager. Just call session.close() when you're done
 
if I use the session across 5 methods now, where do I close? __del__?
 
If the session belongs to an object, the object should have a close() method and/or be a context manager. If you have a global session, close it in an atexit hook
 
7:45 AM
so basically I do all operations and just call .close() in the last line?
 
@python_user If the session is global or attached to another object, then no. If you have a session that you pass as an argument to all your functions, then yes
 
melon
@Kwsswart you can start answering in tags you feel confident, then move to other tags
if you are wrong the downvotes would follow and you will know its wrong advice :p
 
Haha fair might do on some if i feel fairly confident ^^ otherwise will be put focus on editing the questions to improve overall feel while reading the answers and gaining confidence ^^
 
if you wondering, what tags I started and if I have moved on to other tags, then no :D I still mostly try to answer pure python tags
 
8:02 AM
Haha right now I am sticking wiht python and mostly related to flask or webscraping related questions
 
8:31 AM
hey
 
hello
 
hello
 
cbg
 
 
2 hours later…
11:08 AM
its surprizing how some people don't accept the answer on a question even after thanking you for it xD
 
welcome to main :D, there are also people who ask your comment to be an answer and then not even upvote
I didnt want an upvote so I commented, if you ask me to answer I will expect an upvote :/
 
haha
 
11:47 AM
Is that really so weird? "Thanks for the answer" doesn't mean "Your answer solved my problem", and "Your comment should be an answer" doesn't mean "Your answer is good"
 
well, if the comment is as simple as move line 5 to line 3 then it will work, which is the solution
 
does list(queue) copy the queue or reference?
 
shallow copy I guess
 
@Hakaishin define "copy the queue"
 
I have 2 threads no surprise, one adds images to a queue, the other gets a timestamp and tries to find the closest image to that time. I do for image in list(queue) and then find the smallest timestamp difference. But it's consistently off, I wonder if I find the correct one, but it moves underneath me because the other thread is adding images
 
11:53 AM
What's the "queue" and what are its contents?
 
queue has objects which have just two attributes, timestamp and image
 
list(iterable) should give you a new list that contains a reference to the original contents of the iterable, at the time of issuing this call (give or take thread safety)
Why are you doing for image in list(queue)? You either want for image in queue or for image in queue.copy(), don't you?
 
Do you actually clear the queue after fetching items to process?
Just copying the queue usually isn't enough for these kinds of algorithms.
 
¿Queue?
 
I don't completely trust my threads to play nicely with queues unless:
- thread A pushes items onto the queue, and does not interact with it in any other way
- thread B pops items off the queue, and does not interact with it in any other way
Your thread B interacts with the queue by iterating over it, so it does not meet this criteria
Which is not to say that a program is doomed to fail if it doesn't meet the criteria. More explicitly, a program that meets the criteria is almost always safe. A program that does not meet the criteria may or may not be safe.
(For certain definitions of "safe")
 
12:08 PM
TLDR: Use queues as queues.
 
Sorry, got interrupted, will come back in a bit
 
Maybe I'm misunderstanding what is meant by "queue" here. I am thinking of it in a rather narrow sense of "a collection object that serves only to pass messages from a producer to a consumer", but of course the queue.Queue type can have other purposes.
 
queue.Queue isn't iterable, so it's probably something else.
 
"probably" :P
 
If queue's type is unknown to us, then my thinking is actually two layers of narrowness too deep
 
12:16 PM
@Aran-Fey Just accounting for my lag in adopting new Python versions. :P
Don't crush my dreams of all the cruft being gone next year... ;_;
 
I mean I did ask what the queue was but got no answer
 
If only Python had a way to add type information... :(
 
Hungarian notation would help here, just saying
 
Systems Hungarian or Apps Hungarian?
 
as long as I can read it without google translate
 
12:27 PM
Just looked at EN => HU for "queue". I don't think google translate would help the rest of us.
 
My crystal ball says "try pushing items onto the other end of the queue". I think I've expended its last charge until I can refuel it with more project requirements
 
Have you tried turning it off and on again?
 
A panel on the base slides open, revealing the homunculus that lives inside . He shrugs and says, "I don't know what you want from me, boss". He has a New York accent despite being from Asphodel.
 
Have you tried burning it off and on again?
 
Asphodel is a suburb of Hades, so the homunculus is unperturbed by mundane flame. He uses it to light a big New York stogie.
 
12:35 PM
@AndrasDeak Sorry I misunderstood you ask what the queue contains. The queue is a nromal queue.Queue()
@MisterMiyagi that's why list(queue) ;)
 
Are you sure that list(queue) gives you a list with the contents of the queue...?
 
>>> list(queue.Queue())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'Queue' object is not iterable
 
ah, right, no failure mode of "list with a queue inside"
 
list(queue.Queue().queue)
wow, that looks wrong writing it out like that
 
Queues have a queue attr...?
@Hakaishin I asked both. The "and" between the two was a dead giveaway.
 
12:39 PM
I'm pretty sure it's the first google result when searching for how to iterate over queue: stackoverflow.com/questions/21157739/… then second answer, because first one has too much code :D
"queue has objects which have just two attributes, timestamp and image"
 
@Hakaishin Yeah, that .queue attribute isn't a documented part of the interface. I would advise not to touch it
 
wow the comment under the answer even warns about thread safety issues, I nicely ignored that comment
don't private things start with _? I thought if it doesn't have _ it's fair game
 
I assume it's not _queue for fun times
@Hakaishin "fair game" is what's written at docs.python.org/3/library/queue.html
anything else is by definition undocumented, and as such an implementation detail
 
"private" is more of a gradient than a boolean
4
 
uff, so if pycharm gives me certain things, I don't even know if they are usable.
 
12:42 PM
IIRC the queue.Queue's queue is a deque, so that should not be an issue in practice.
 
then tbf ctrl+click shows queue # undocumented
 
Reject modernity, install an IDE with no autocomplete
 
oh I need a dequeue because I want a ring buffer
@Kevin I want to antistar this :D
 
@Kevin go further beyond, install an ide with auto incomplete.
your code vanishes randomly. what code? ... exactly.
 
I think you mean a different language
 
12:44 PM
@Hakaishin Valid
 
@AndrasDeak This exists.... why does this exist?
 
I don't do ontology
 
ooh, new word
 
@AndrasDeak terrifying, also something which gives for a nice party conversation
back when I wrote this queue thingy I just cared that it worked and not for ms timings, now that I care about ms I have to rethink my approach again
or I just do .copy() and see how far I get :D
 
12:50 PM
Miyagi RdC
 
iterating over a ring buffer without either locking it or copying it seems like a bad thing. So I guess copy is not even a hack
 
1:03 PM
morning cabbages, folks!
 
A simple lock would surely work, but it may be undesirable for thread B to lock the entire buffer at once, even if A only wants to mutate the part of the buffer that B isn't currently looking at. Maybe if you create a lock for each slot...
 
A deque is guaranteed to be thread-safe for append/pop in CPython.
All hail the GIL!
 
The design I'm imagining is free from race conditions, if you don't consider "thread B iterates over the buffer more slowly than thread A adds to it, so the loop never ends" to be a race condition
Perhaps thread B could take note of the current time when the request comes in, and break out of the loop if any image exceeds that time
 
2:00 PM
ahahaha, finally:
  File "/usr/lib/python3.8/copy.py", line 286, in _reconstruct
    for item in listiter:
RuntimeError: deque mutated during iteration
My suspicion has been correct, the images were sliding away beneath me. I can't even deepcopy without a lock
man, but I don't want to lock my queue...
 
Proposal: rather than iterating through the buffer, use binary search
You'd still need to lock the buffer, but only for O(log(N)) time rather than O(N)
 
@Kevin meh, it's not a big N, so the difference wont matter
 
Oh good, that means that locking the queue isn't a big deal either way
 
I feel like my problem would be easier to solve in C++ just using arrays
 
I mean, an implicit part of my binsearch proposal is "write your own implementation from scratch, perhaps using arrays"
 
2:10 PM
What can an array do that a list can't?
 
Nothing really, I just like the idea of using a collection with a fixed size in order to implement a collection with a fixed size
 
1. maintain type homogeneity
2. maintain fixed size
3. increase my headache
-- oh what the heck! --
4. Be included in the exclusive, members only numpy library
 
I feel like the first two have easy workarounds... which can be summed up as "just don't mess it up"
 
"Have you tried not making any errors today?"
 
2:25 PM
yes, got to 10ms accuracy. Well that's weird. I thought locking would make everything way slower, this is awesome :)
 
anyone know why str.casefold exists? Seems like one of str.uppper, str.lower, str.casefold is redundant, and str.casefold seems like the redundant one to me
 
IIRC, Unicode has some weird corner cases
 
casefolding does some normalisation that better matches case-insensitive comparisons.
 
ahh, much sense making. Thanks
 
E.g. German ß is lower-cased to itself but case-folded to ss.
 
2:31 PM
ß should be abolished, Switzerland actually did
 
We all should use ẞ instead!
 
we need one standard language that hits all use cases and corner cases
 
English seems to work pretty well in terms of expectation management. :P
 
@inspectorG4dget sounds like esperanto2.0
 
oh I'll make the effort to learn this new language, as long as it solves the problem
 
2:37 PM
I'm still baffeled that this worked, gotta go out and test it
 
I'm a little confused by what "accuracy" means in your problem, myself. If your buffer contains [1, 2, 5, 6, 11] and you ask it for the number closest to 7, and it gives you 9, then that problem is not caused by race conditions.
 
If you to learn an artificial language, which one would you pick? Esperanto? Ido? Novial? Something else?
 
python wait, I kinda know that one. C++
 
I salute the artificial language community but I can't bring myself to be interested in it
 
@Kevin I have a clock which I constantly film, I press a button and I get a timestamp, I want the button time press to be as close as possible to the clock timestamp
@Aran-Fey go, rust, haskel, lisp,
 
2:49 PM
I was thinking of languages that let you communicate with other humans, not computers
 
Hmm, if button presses are guaranteed to be processed in the order that they occur, then maybe you don't need iteration after all.
Suppose that pressing the button causes thread B to destructively pop images out of the queue until it finds a match. We're fine with all of the popped images vanishing forever, because none of them could possibly be the best match for any future button presses.
This may give you the opportunity to write a "half-lock". If the buffer is not full, thread A can add a new element, whether or not thread B has acquired the lock. If the buffer is full, A may only erase the oldest element if the lock is free.
 
@Aran-Fey humans eh :D
@Kevin That's what I had in mind with C++. But this works and you know what they say
@Aran-Fey jokes aside, If I'd had to pick, French and Russian would be high up on the list. French because they are quite big in ESA and Russia because my grandmother was a russian teacher and because ROSCOSMOS
what about you?
@Aran-Fey oh wait artificial and talking to humans, hmm. I only heard of Esperanto didn't know there were many others. But that doesn't tickle me at all
 
I figured I'd rather learn a well-designed language than learn how to correctly pronounce english words, but then I couldn't decide which one
I already taught myself a new keyboard layout, so surely a new language can't be all that difficult, right? Right?
 
dworak?
 
colemak
 
3:06 PM
If I have a child it will learn something better than qwerty
 
dvorak
 
After 10.9 months, I'm 53% of the way through these Japanese flash cards, which will purportedly give me N5 proficiency ("understands short conversations spoken slowly").
It's not all that difficult. Just time consuming.
 
Never liked flash cards. Nowadays I just work through the book and translate words I don't know and add them to my list.
Then I hope to see them again.
I also like watching youtube videos with the subtitles on
@Hakaishin When I was a child, they tried to teach me qwerty in school. A month later I went home and learned about the dvorak keyboard on the internet so I taught my self that instead
I was 12 or so
Now I struggle when I have to type qwerty
 
@SurpriseDog lucky you, I learned qwerty and I don't feel the urge to switch
 
Looking up words you don't know is a very good way to learn new words, but first I need to get to the level of "can look at a sentence and identify which groups of symbols represents a word". It's a little tricky for languages where spaces are optional.
 
3:15 PM
The struggle with forgetting qwerty is real. Luckily I know the admin password to the PCs at work, so I just installed colemak on those that I regularly use...
Wait, there are languages that don't put spaces between words? What kind of madman came up with that concept
 
99% of the time the invisible spaces go anywhere that hiragana precedes kanji, but god help you if you put a space in between kanji that precedes hiragana
 
 
1 hour later…
4:22 PM
Hi all, I'm trying to use regular expression to find exact substring in a sentence re.search(r"sunny day",today is sunny day with a slight chance of rain). right now the string i want to find "sunny day" is hardcoded, but how do i pass a variable to it . looks like it needs to be within double quotes
for the test
 
@ozil why use a regex for a single exact substring?
 
@ozil You might want to take a step back from regex and look into the fundamentals of Python again. Arguments passed to functions just carry their value/identity. It doesn't matter whether an argument comes from evaluating a literal, a name, or some more complex expression.
 
^ That is to say, the concept of "a variable within double quotes" doesn't make any sense
 
@ozil Try reading a tutorial on regex: realpython.com/regex-python
 
4:42 PM
thanks all. I basically wanted to know , if i declare a variable substring = "sunny day", how do i pass it to the test (r"...", sentence) test
learning python, will look in more depth, but i needed to test if words/phrases exist in a sentence
 
Just replace the entire part that said r"..." with the name substring.
 
What's the meaning of this code translated into c# syntax?
hm = hmac.new(str.encode(input), b'', hashlib.sha256)
    hm.update(salt.encode("utf-8"))
    h = hm.hexdigest()
    if (int(h, 16) % 33 == 0):
        return 1
    h = int(h[:13], 16)
    e = 2**52
 
@MisterMiyagi - thanks
 
As in re.search(substring, "today is sunny day with a slight chance of rain")
@Castiel If it's translated properly, it will have the same meaning.
 
I want to write it in c# syntax, but i'm not familiar with this typo in c#
 
4:45 PM
A C# chat room seems appropriate, then.
Supplying complete code will probably help them, by the way.
 
@MisterMiyagi - while on this, do you know any other way in python where i could search for phrases within a sentence. i could break up a sentence into a list of words like ["today", "is", "sunny", "day"... ] and do something like "today" in ["today", "is" ...]
but how to check if more than one works like "sunny day" is present in a sentence without using regex
 
@ozil Strings directly support substring searches, so you can also just test "sunny day" in "today is sunny day with a slight chance of rain".
I assume the Python tutorial covers that, by the way.
 
@MisterMiyagi - is this looking at words "sunny" and "day " separately or is it looking for exact pharase "sunny day
"
 
It's looking for the substring "sunny day".
 
@MisterMiyagi - great thanks
 
4:53 PM
@MisterMiyagi Did you guys ever read line by line through one of these longass tutorials when you learned python? I feel like I'm too adhd for that.
 
@SurpriseDog The parts relevant for whatever problem I was trying to solve – yes.
I find the Library Reference and Language Reference to be more on-point, but it's not what I would recommend as initial reading material.
 
@Aran-Fey aren't artificial languages the haskells of spoken languages?
 
I feel like half the time I end up spending hours on a function just to find that it's already been implemented in a module I never heard of
like textwrap
 
Sheesh, where are all these upvotes coming from? Just saw a gibberish "please write Hello World for me" question that someone found worthy of a positive score...
 
5:06 PM
@MisterMiyagi sock puppets and idiots, I think
 
I hope you're right...
 
@AndrasDeak I have no idea what this means. If you're saying that they're more functional than the languages I'm used to, I probably have to agree
 
Sound perfect and pure but nobody actually uses them
@MisterMiyagi there's also the occasional special kind of idiot who upvotes everything on the front page for a badge
 
@Aran-Fey Those are the languages we deserve, but not the ones we need right now.
 
5:43 PM
hey guys how's it going?
any django developers here?
 
5:57 PM
i never used python but
does it has good api for banking information?
 
python has all the apis
 
trying to build stock platform website or app... where i can get banking depsoit api... trading api.. etc. I am not sure if i should use python or not
i did research and its fix feeling on it on google
 
6:19 PM
I don't think there's any reason that you shouldn't use python to make a banking system. But I'm quite sure that python isn't the only thing you'll need
 
As Andras said, Python has lots of API connectivity. Finding the API that will give you the information you need is not a python question, and is probably a lot more difficult than finding the python bindings to that API
 
out of curiosity, which banking API are you trying to connect to with python?
 
I've found them myself in the past, but I can't remember their names off the top of my head (much less, which were free). Sentdex (although people are not big fans of his code) as youtube tutorials that can access similar things (hopefully not just blockchain) so it might give you some clues on how you might structure such an app in terms of services
 
6:58 PM
recbg
@user1924249 python is rather good start, as opposed to say JavaScript that doesn't even have decimal numbers built in. As others said, the choice of programming language is least of your problems otherwise, but among all Python is probably the best one.
 
until we have typethon
 
7:49 PM
is there a one liner I can use to get the index of the first non-False element in an array? Sometimes the array is all False and sometimes its entirely non-False
 
When you say array, what do you mean?
 
next((i for i,e in enumerate(myArray) if e), None)
 
@inspectorG4dget "sometimes the array is all False"
 
I just mean a list [False, False, False]
Really it could be any iterable
 
then what the inspector said, with a second argument to next for the "all False" case
although "non False" is interpreted as "truthy" (as it should be)
 
7:52 PM
@AndrasDeak yeah, thanks. Updated
 
@inspectorG4dget None is not type consistent
 
oh sweet, that's exactly what I was wondering! Like a .get() request for lists
Thank you inspector gadget!
 
@duhaime cheers!
@AndrasDeak but if we're talking about indices in an iterable, how would I use a type-consistent value? Would type-consisten values be integers and therefore... possibly indices of the iterable? The only way I can see to do that then would be to use an index that'll cause an IndexError... What am I missing here?
 
you're missing that we don't know what duhaime expects to happen with an all-falsey iterable
It might be None, it might be -1, it might be an exception, or something from javascript
 
oh we good fam
 
8:13 PM
Hi
Could someon please explain this line of code:
x = Bidirectional(LSTM(128, return_sequences=True))(in_seq)
As you can see here in the documentation, Bidirectional takes a bunch of parameters
but I don't understand why they randomly added (in_seq) at the end
 
Bidirectional(...) returns a function (or more likely: class instance that has a __call__ method) and then you call it with in_seq as an argument
 
hmm, ok lemme re-read the documentation. I may have missed that...
@ThiefMaster I re-read the documentation and didn't find anything about return values with arguments... How the heck am I supposed to guess that?
 
> Call arguments
 
@AndrasDeak so this is what they mean by "call arguments". I initially googled "call arguments" and only found an explanation about what arguments are when calling a function
 
There are examples on that page. They don't explicitly call the object, but presumably if you're using that library you should be aware of what it does, especially that model.add expects a callable
 
8:20 PM
didn t know you could do such sorcery in Python...
 
@LandonZeKepitelOfGreytBritn yes, that is exactly what they probably mean
 
There shouldn't be any guessing required. Just unwrap the line a little bit and it becomes more clear. Execute just LSTM(128, return_sequences=True) and then check that object out. Then pass that object to Bidirectional() and check out the value that's returned. You'll see it's a function
 
@LandonZeKepitelOfGreytBritn there is zero sorcery. You call a function.
Whether it's a function or a callable class is a minor detail. The syntax would be the same.
 
yes sure, but it is a bit like a anonymous function. Didnt expect that
i didnt even find anything about return values for that call. So did not expect this either
 
>>> def f():
...     return f
>>> f()()()()()()()()
<function __main__.f()>
exploding head emoji
 
8:22 PM
you don't have to find the documentation. Just check out what's actually returned. Use type() and dir() to check out the objects you get
or help()
 
@AndrasDeak you must be a lot of fun to work with
@duhaime thanks
 
I'm also not sure why you would want to define __call__ on the class instead of making a method of def run_something(self, in_seq) since it looks like they'd do the same thing, but one would at least potentially specify what the call was doing? What's the difference here?
 
@LandonZeKepitelOfGreytBritn that's very understandable. Google interpreted "call" in "call arguments" to be a verb, when you meant it to be a noun in this case. As you identified it, this /is/ more of an advanced topic that isn't the first thing people normally google
 
I've sort of been passingly aware of making instances callable, but my research isn't giving me a compelling reason to do it
 
@inspectorG4dget Is it?
@roganjosh yes, it's purely an API design question. __call__ is just a method so it can do exactly what any method can, with a little syntactical sugar.
 
8:25 PM
functions returning functions that you can then call using the outer_function()(inner_func_arg) is not something I learned in my first python-year. But maybe I was just slow with the uptake
 
I've encountered callable classes in the wild with scipy interpolators. First you construct an interpolator, then you pass that inputs to get interpolated outputs.
Since what you have is an interpolating function, it both makes sense and looks nice to do y = interpolator(x).
 
You seem to be such an expert and a pleasant guy
amazed head emoji
 
interpolator.interpolate(x) is too close to Java
 
(FYI, Thanks for your replies but I have some difficulties dealing with arrogant people)
 
@LandonZeKepitelOfGreytBritn oh poor thing :(
Our door is always open for you to leave.
 
8:28 PM
@AndrasDeak you re compensating a lot
sweet summer child...
 
WTH is your problem?
 
@LandonZeKepitelOfGreytBritn And you're a known troll so you can leave now. We've helped you more than what I'm comfortable with anyway.
I consider this session closed.
 
@AndrasDeak similar to dask. I wasn't sure if there was something more behind it but I get the interpolator.interpolate(x) example
 
Yeah, I think there's no functional difference. There can't really be.
Hmm, and I may have used a callable class to make a "pickleable lambda". But that's just a workaround anyway.
less "design" and more "duck tape"
 
8:35 PM
@ThiefMaster oh hey... long time no see again... how goes things?
 
everything fine :)
 
@AndrasDeak Umm, are you sure about that troll thing? As far as I can tell, the last time they were here was in 2017. (But of the course the chat search isn't super reliable...)
 
@Aran-Fey indeed I am
 
It is known
 
Alright then
 
8:37 PM
# TODO: see if functools.partial would work instead; clearer
hmm, I guess I should revisit that TODO 5 years later, now that I know how I'd want to use it
(this is right above my callable class workaround for pickling lambdas)
 
That was impressive speed. >18 months and I'd have to fumble around for 15 mins trying to remember where on Earth I did X, and 5-year-ago-me probably wasn't too handy with TODOs
 
I mean I have about two actual python Projects with capital P, both with a couple of thousand lines of code, and this is the one place where I'm using multiprocessing
I didn't even have to look for it
 
Heh. I'd have to remember which reboot of some hobby project name I was thinking about, then whether it was deigned to be transferred to a later laptop
 
but I have, uh, 6466 .py files in my current-ish work directory (with appropriate directory trees, of course) :D
Ah, hold on, that includes some venvs. It was suspiciously large.
phew, OK, only 439 of my own
 
I mean, that's less than your tab count, so there's some more restraint being shown there :P
 
8:49 PM
Ah, good call. I have 474 of those right now.
 
In the same statement, you've just announced the death of ~400 tabs IIRC from the last count. That was quite an event!
 
yeah, I culled them down to something like 150 a few months ago
 
Sorry for bringing it up again, but I want to take this opportunity to say something. Sometimes when people come here for help, some of us give off a pretty noticeable atmosphere of annoyance or disinterest or some other kind of negative emotion. It's understandable, and I'm guilty of it myself, but I do understand that some people feel unwelcome/provoked because of this.
And usually they're the one who get the short end of the stick, even though they didn't really do anything wrong. All they did was ask for help with something we find trivial and they were immediately met with (minor) hostility. I know it's easier said than done, but in those situations we should try to just... not engage. It'll only result in a sort of downwards spiral
 
@Aran-Fey yeah, you have a very good point, and I absolutely agree. I always start with helpful friendliness, and go down from there based on what the other party does. Being a noob is never a problem.
In this case, however, we have a known troll who was a troll back in the day, and who trolled here just a few weeks ago. Then they dare show their face here asking for help. Frankly I'm willing to give such a person very little leeway.
 
I think that the transcript could leave an unwelcoming mark here. People won't necessarily know what was behind your grumpiness, but they didn't overtly provoke anything
 
8:56 PM
When you see me be unreasonably hostile to users it's usually due to prior history. Either a lack of improvement which makes them an effort drain for the room which I want to tone down to prevent experts from being driven away, or bad-faith behaviour such as trolling or just having a bad attitude for no reason.
 
Yeah, I usually don't say anything because I always assume "oh, there must've been a history here". But it's been happening a lot lately, so I thought I should bring it up
 
There are indeed times when I can tell I'm in a yammy mood and I suspect I'd be unreasonably harsh to ignorant askers. And then I say nothing, or even leave the room.
@Aran-Fey yeah, you should, thanks
 
9:43 PM
I can't find a good dupe for this and I don't know whether I want to take it on myself and potentially give inaccurate info. Any ideas? It's really nothing about numpy but lambda functions
 
ugh
found a target
 
Thing is, I don't think that's going to explain properly why their code is failing. There's quite a bit of distance between them
 
Needs a comment?
I don't think OP thinks that the first lambda x: applies to the whole thing... otherwise what they'd have is a lambda with a tuple inside
 
I'm amazed you even understand the question
 
This is not functioning code, but I assumed they expected something like this:
images = [np.random.randint(100, size=(120, 120)) for _ in range(10)]

def get_my_list(x):
    return [x, np.rot90, np.rot90(x,k=2)]

my_list = get_my_list(5)
 
9:53 PM
nope
they want a randomly chosen function to act on an image
for which they need, well, a bunch of functions to choose from
 
In which case, maybe it's me that's not fully understanding why x is not defined in the np.rot90(x, 90) call in my_list = [lambda x: x,np.rot90, np.rot90(x,k=2)]
 
The lambda ends at the comma
 
Oh poop, I've just wasted your time, sorry
 
you have distracted me from, uh, explaining to the asker how the duplicate is exactly what they need
 
9:58 PM
I've managed to conflate a typo into a "hmmm.... what is going on here?" in my tiredness. I don't know whether my distraction for you is considered a good or a bad thing :P Yam, I thought I was better at spotting these things
 
10:08 PM
to be fair it's more than a typo
at least the comment section is as helpful as ever
 
 
2 hours later…
11:48 PM
Something about this election's results leaves a poor taste in my mouth
 

« first day (4028 days earlier)      last day (906 days later) »