« first day (3633 days earlier)      last day (1531 days later) » 

01:58
Does this chat rooms not use salad anymore?
@roganjosh Cheers, why did somebody call you "sorry"?
@AndrasDeak Thankyou
@Kevin I need them to allow foreign zip codes for former addresses/jobs in application forms.
 
4 hours later…
06:07
@toonarmycaptain I was so ready with the "ahaa, that joke might work if I hadn't used a comma, but there's egg all over your face" and then I clicked the link and indeed there is no comma. <grumble grumble>
Some may call it.... a dad joke, though :D
@CupOfJava very little, beyond "cbg"
06:58
Has Science Direct always had hyperlinks on key words, similar to Wikipedia? I'm looking at my old paper and I feel relatively sure that every mention of "biomass" wasn't a hyperlink before
I suspect I've just become aware of it but now it's really bugging me. It conflicts with links to figures and references within the paper and the link results are dumb. "just in case you wanted a random collection of recent papers that mention 'mangosteen' - click here!". Surely that's not useful.
08:01
I'm writing some automated tests for an app. I'm working on a test case for account creation where the user has to confirm an account via an email link. I want to avoid adding special cases into the production code.

Any suggestions on how to verify the email as part of a test case (e.g. I want to verify the token)?
Sounds like you want to mock the part of the code that sends the email
The part that sends the email is either Flask-Mail or just using the built-in smtplib.
(Have been playing around with both, sending to localhost, etc..)
Ack. I didn't know about pytest-mock, even though I'm using pytest for my test cases :v
Thanks for the reminder to check on that.
 
5 hours later…
13:05
Cabbage
select([workarea]).where(workarea.fk_mission_id == mission_id). \
where(workarea.status== 4)
I want work area 4 or work area 5
Formatting not working for some reason
Or condition in the where query is not working
Workarea.status == 4 or workarea.status == 5 throws error
How do I achieve this
We should use sort() of lists only when the elements are of same datatype. Why is this rule here???
That's just a beginner-friendly way of saying that you should only call sort() on lists if you're sure that all list elements implement appropriate comparison methods
Mine is sql alchemy , so I found out there are two ways one can write sql alchemy
13:45
You should be using in_
I'm on my phone so my code would be awful, but pass a collection and use in_.
14:42
@Anarach Back at my laptop. I don't think I understand the syntax/approach you're using. My best guess is:
res = (session.query(workarea)
              .filter(and_(workarea.fk_mission_id == mission_id,
                           workarea.status.in_(4, 5)))
              .all())
Where and_ is from from sqlalchemy import and_
I'm also confused about workarea since that looks like it's a model you have made. That would be a class, so it should start with a capital letter because of PEP8
15:11
@roganjosh Yes , I just figured it out , came to type in case anyone was wondering
@roganjosh I was on mobile, apologies
15:40
I still think I'm confused about the chained use of where in your case but that's probably something for me to research
Actually, I'm struggling to pin it down. I can find it used once here but I can't figure out in the docs what it does differently to filter and get
@inspectorG4dget is there supposed to be a hangout today? I thought there were 2 on the starboard and I know other people got confused and thought it was this Sat, but now that post doesn't seem to exist
@roganjosh negative. The next hangout is on Oct 3
Ok. I think there's been some confusion along the way because I had it in my head there was one today and people missed the other thinking it was this weekend. We're definitely set with that one and the meeting link is valid (before I pin it)?
I'm looking at:
Sep 1 at 2:22, by inspectorG4dget
Here's the calendar invite for the Oct 3 hangout. 9am in Seattle, 12pm in Toronto/NYC, 21.30 in India, 17.00 in London
hello :)
@roganjosh that's the one. That's all set for Oct 3. Sorry I couldn't pull up the link earlier (running around midst housework)
@inspectorG4dget ok, and the link for the room is good? Sorry for being pedantic but I think people got confused when things were switching around
I've pinned it
@roganjosh yup. Just so I'm not mixing words: This is the cal invite for the room that should work
much thanks
 
2 hours later…
18:38
ok seriously, I see 6 screenfuls of this help session and it seems like it is not getting anywhere.
@KokHyvv @NIKHILCHANDRAROY this is starting to sound more and more confusing each minute. I'll move the discussion here: chat.stackoverflow.com/rooms/222129/room-for-kok-and-nikhil
perhaps you should create another room for this.
please continue in that chatroom
@AnttiHaapala great minds :P
think alike.
Anyone keep track of how many times the same screenshot got posted? Was it 3 times?
18:39
yes great idea thanks
@NIKHILCHANDRAROY come to room
 
1 hour later…
19:52
Hi everybody
I was reading this question
https://stackoverflow.com/questions/231767/what-does-the-yield-keyword-do/231855#231855
I'm concerned of an idea I didn't understand in the accepted answer, so I thought to discuss it with someone.
I don't know if there is a better mechanism to do this in SO.
@YoussefDir hello. No, there isn't :) Ask away.
I was hoping to see a separate discussion on every question, as in Wikipedia articles
too bad this isn't available
It would generate a lot of noise...
true...
Longer comment discussions can be automatically moved to chat, but that rarely has information that benefits future readers. Ideally everything needed is in the post itself.
19:55
sure...
chat is the right medium to flesh out unclear things
usually answers are quite understandable
Is this room always on ?
I mean do always people get around here
or could it be that it might close forever one day
?
What do you mean by "get around here"?
@YoussefDir in principle it could. But as long as there's a message within any 2-week window it will stay.
I think it won't close then
and even when if it were frozen, the transcript would be public eternally*

(*eternity not guaranteed)
19:57
ok
so the question I referenced is a bit tricky
I'm quoting this from the accepted answer
`But in your code, it gets a generator, which is good because:

You don't need to read the values twice.
You may have a lot of children and you don't want them all stored in memory.
`
@YoussefDir you can edit/delete messages for 2 minutes in chat
Quotes work with >, just like on main. But formatting here (especially code) is weird, so it's not your fault if you can't immediately get it right.
ok
I was checking
Anyway, what's your issue?
he said
>>You don't need to read the values twice.
you also can't mix formatting in a single message :)
20:03
ok :)
post the quote in a separate message, and add a space after the single >
choose one: formatting, or multiple lines of text
ok I will try
there's also the sandbox room if you want to practice
bear with me, then I will be a pro
20:04
Anyway, let's get to the question?
@roganjosh enjoy the ride
You've told us twice what he said. Go on.
but it would be read once even if a non-generator was used !
it's not clear, his sentence
@YoussefDir yes. The first point of his seems to say "so you can use a generator". The second point seems to say "so you should use a generator"
If OP needed to iterate more than once ("twice" is a confusing way to put it), a generator would not be practical. Since their objects are many, a generator is practical.
I'm inclined to agree that it's a confusing point
20:08
How I read it:
> You don't need to read the values more than once, so you have the opportunity to use a generator.
You may have a lot of children and you don't want them all stored in memory, so you absolutely should take that opportunity and use a generator.
But even the second point, it's not so clear to me
the children are already in memory
that's a different issue then
yes, maybe I have a problem with the generator itself
Before we go further - are we talking totally about the context of that question, or your own code based on it?
No, I agree that there's probably an underlying tree so all those objects already exist. But, if you have 100k children already, do you want to also create a 50k-element list to store a list of children?
So the "reduced memory" argument is with respect to using a list or other sequence in the exact same scenario.
using a generator won't magically reduce your program's unrelated memory need, naturally
20:14
@AndrasDeak can't we in Python just point to the same list ?
i.e. without creating a new one ?
@roganjosh Actually I edited the answer and tried to put this idea
@YoussefDir edited an answer in that thread? That doesn't sound like a good idea
the answer said
It is just the same except you used () instead of []. BUT, you cannot perform for i in mygenerator a second time since generators can only be used once: they calculate 0, then forget about it and calculate 1, and end calculating 4, one by one.
I then added below
While iterating, since it forgets the already iterated value, this enhances memory efficiency in case of very large number of iterations; at the first iteration, no memory efficiency, since we had all the values of range(3) in memory, but later it gets better.
@YoussefDir there's no "same list" if you have a tree
I don't mind the edit to be rejected. I was just making a best effort practice before I though to chat
You have 100k nodes in a tree, everyone only knows about their children and maybe parent.
20:18
so a pointer to the tree isn't actually duplicating the tree
in a non-generator iterator
@YoussefDir I'm 99.9% sure I'm going to reject it but I'm reviewing it now. It doesn't seem you have a grip on the subject matter, so I don't think you should be editing answers like that
@YoussefDir A "pointer" to the tree isn't duplicating the tree. But we're talking about a list that contains a bunch of references to various nodes. This is a new list.
@roganjosh I made more than an edit. One paragraph can be useful for a first reader.
@roganjosh agreed, rejected
Such ancient and robust answers rarely need edits, and cosmetic edits are needless. This wasn't good enough of a change to merit touching it.
ok, no prob
20:21
We could try clarifying the confusing bits, but I'm not even sure what the answerer meant, so it would be safer to ask them in a comment.
I care just about me better understanding
In concept, do you agree on the paragraph I added ?
While iterating, since it forgets the already iterated value, this enhances memory efficiency in case of very large number of iterations; at the first iteration, no memory efficiency, since we had all the values of range(3) in memory, but later it gets better.
well "I care just about me better understanding", taken out of context, says a lot. It's not just about your understanding
@roganjosh easy on me
I was reading the thread for 3 hours now
@YoussefDir you asked me for my opinion
:)
of course I care about your opinion
you are the experts
20:24
I'm not. But I'll definitely give you my opinion :P
@YoussefDir the "forgets" bit was a bit weird to me, because it doesn't exactly fit my mental model. The second sentence starting with "at the first iteration" was outright confusing, I don't know what you're trying to say there. Especially with "no memory efficiency". You don't get memory efficiency in a given iteration. You get it for an algorithm and an implementation.
at the first iteration, all the "list" is actually seen by the iterator
I know I'm confused
the answer used the idea of "forget"
as if there is some sort of memory optimization maybe ?
Yeah, no. If you use a generator that iterates a list then it won't be any more efficient than just iterating the list.
The point of generators that you always create one object at a time rather than having a full collection.
But the tree was already created in memory
no ?
you are conflating things
20:29
in the caller, it's fully there
# use a generator:
def good_generator():
    for _ in range(1000_000):
        yield function_that_returns_large_object()

# don't use a generator
def bad_generator():
    yield from long_list_of_large_objects
in the generator, only one node is accessed
@YoussefDir so why are you talking about "lists" being seen by the iterator?
18 mins ago, by Andras Deak
So the "reduced memory" argument is with respect to using a list or other sequence in the exact same scenario.
when we say range(1000000) isn't this a huge amount in memory ?
and reserved by the generator
@YoussefDir no, range is an optimized object in python 3
When we're talking about "memory optimization" you have to compare two implementations: one which uses the generator, and another that constructs a full list in the same place (effectively list(that_generator()).
I can't say it in any more ways.
20:33
I have to read more about optimized objects
I'll be checking
that's not an actual thing (I mean "optimized object" is not jargon)
it's just that range has a type of its own and it isn't just a list of integers
it's "smart"
ok
that makes more sense to me now.
@YoussefDir I have a choice. I could paper my entire room with numbers from 0 to 1000000. If you ask me what's after 99876, I could search around the whole room to first find the number and find the one next to it. Or I could just add the increment to the one you gave me
ok
it's not redoing what can be omitted
thanks
all
so it's about accessing memory
not using memory
it's a processing optimizer
it relieves the cpu e.g.
No. What does this have to do with the CPU? I mean, expanding out a list probably would take up CPU time but that's subsidiary to memory
20:40
Iterating the list would take less CPU than iterating the generator.
comparably, a huge tree and a huge list are the same, in terms of memory usage. No ?
I mean they both consume space
RAM space
maybe
You keep mentioning a tree. Maybe I've been negligent; I best re-read the transcript
@roganjosh the question to the answer being discussed
I don't want to be heavy on experts like you
@YoussefDir the two choices are not "large tree" or "large list". It's "large tree and one item at a time with a generator" or "large tree and a large list containing all the nodes"
20:43
aha
This is what I've tried saying in 2 ways and said I can't say it in any more ways.
starting to be a bit repetitive...
@AndrasDeak it's really lovely to add this sentence in the answer
like in the place of my added paragraph
No, this is just your confusion and I don't think we can phrase it in a way that helps random readers.
ok
thanks everybody
a lot
It might help to separate yourself from that specific question, and look for other uses of generators and play around with code
your confusion might just stem from the specific use case in the question
20:47
yes, probable
anyway, you're welcome
Is it ok to ask random question in this chat room ? I mean not related to SO questions ?
Given the confusion you've generated with the last question, I think it would be unwise
@roganjosh this is due to my style in understanding ?
I mean specific to me ?
We have room rules that cover the essential criteria. Of course we're happy to be social but the fact you're asking if it's ok makes me a little concerned
Just ask. I'm here anyway, so I'll move if it's not appropriate
20:52
why would you be a little concerned ?
I'm interested in improving myself
So I want to understand your opinion
As I said, just ask
Thanks...
TC all
bye
@YoussefDir I think I've just been a bit grumpy today; my apologies. I don't want you to feel bad, it's my grump. Feel free to ask your question :)

« first day (3633 days earlier)      last day (1531 days later) »