« first day (3521 days earlier)      last day (1410 days later) » 

1:34 AM
@AndrasDeak Just realized I don't have to do continue here. He just wants to continue for N times but we can do a code where we just set i to a new variable:
for i in range(len(myContainer)):
    if myCondition:
        i = myNewVar
 
 
1 hour later…
2:57 AM
Hello guys :)
 
3:15 AM
hi
 
 
2 hours later…
4:55 AM
Hi! Question on design.. I have a set of values I want to find (numbers) and two possible identifiers for each value. So what's the best data structure/method to arrange the two 'keys' and then get the singular value no matter which one I use?
 
5:38 AM
Regex to catch 'String' or 'string'?
Find a set of numbers and two keys for each number.

Get either value using a dictionary.
 
6:09 AM
Hey, ok I thought I had understood the yield keyword yesterday but now I have another question.
def gen():
    x = {}
    for i in range(2):
        x['a'] = i
        yield x

list(gen())
>>>[{'a': 1}, {'a': 1}]
Why is the output not: [{'a': 0}, {'a': 1}] since x['a'] is being set to i, and i is first 0 and then 1.
 
All keys named 'a' are set to value 1 at the end of the loop
Try range(3) and you should get 'a': 2 three times
 
6:28 AM
But then why do we get 2 dictionaries in the list? Why not [{'a': 1}] instead of [{'a': 1}, {'a': 1}]?

Here's how it plays out in my head:
1st iteration: i is 0, x['a'] is set to 0, x is yielded. x right now: {'a': 0}
2nd iteration: i is 1, x['a'] is UPDATED to 1, x is yielded. x right now: {'a': 1}

I can't figure out what I'm getting wrong
 
you yield x twice. x is a dictionary.
so you get two dictionaries
 
I yield it twice, so how can the FIRST yield be 1 instead 0...
 
6:46 AM
Because it's the same dictionary object in memory. If you change one of them in your resulting list, they will all change
 
>>> for i in mygen:
...     print(i)
...
{'a': 0}
{'a': 1}
{'a': 2}
:49568021
mygen == gen() by the way
 
@JossieCalderon Yes, if we iterate over the generator then it prints out what I expect, but if we do list(gen()) then it seems to only get {'a': 1}s, this is what confuses me.
@roganjosh This is starting to make some sense
So you're telling me that the two dictionaries in the output:

[{'a': 1}, {'a': 1}] are both x.

If {'a': 0} is yielded first, the second time when x['a'] = i where i = 1, is called it updates the previously yielded result too and yields a new {'a': 1} object?
 
Yes. And you really will need to get a grip on that behaviour if you're applying for jobs as a developer because it's pretty fundamental to how python works
Take some time to go through facts and myths about names
 
7:02 AM
@roganjosh Yeah... you're right. Any specific terms I should google to understand this? This reminds me of that time I tried to delete a list's elements in place while iterating over it (the indexes were messed up lol).
@roganjosh Oh thank you, reading it rn.
 
@roganjosh He wants to know why the list is storing those dictionaries.
:49568227
When you run gen() you are iterating over the dictionary, x. At the end, you call a list of these x's as in [x for i in range(2)]. And because your last command was x['a'] = 1 you get [{'a': 1}, {'a': 1}].
 
I know exactly what they are asking because I answered part 1 yesterday. They are not iterating over a dictionary at all.
 
@roganjosh "Because it's the same dictionary object in memory. If you change one of them in your resulting list, they will all change". Perhaps I meant to say, "You are iterating the dictionaries". After all, [gen()] yields [{'a': 0}] over the first iteration, [{'a': 1}, {'a': 1}] on the second, ...[{'a': n - 1}, ..., {'a': n - 1}] on the nth iteration.
Hence, for i in gen() would yield the correct output. You are iterating the last element of the list (which isn't in memory) @AbdurRehmanKhan
 
7:28 AM
@JossieCalderon Thanks, you've pinpointed my exact confusion, [gen()] yields [{'a': 0}] over the first iteration. EXACTLY. But I see what you guys mean now... the x['a'] = 1 line has changed all the dictionaries in place somehow. And both objects in the resultant list are pointing to the same dictionary x, so they all get updated.
 
You're welcome
 
That "somehow" is the worrying part. It's the same object, nothing magical has happened
You're mutating the global x
 
@roganjosh Btw, was this a tricky question or is it just me? Do you think any good python dev would be able to answer this easily?

I ask because I'm already working as a python dev lmao (1.5 year+ experience), but I'm embarrassed to be struggling with this so much.
 
roganjosh: eliminating mysticism one line at a time
Here to represent you against any and all bugs.
@AbdurRehmanKhan It's a potential interview question. And because of your ability to inquire into the language you'll ace the interview without breaking a sweat.
 
@JossieCalderon It actually is! I was asked this in an interview yesterday and I answered: [{'a': 0}, {'a': 1}], it's been eating me ever since lmao
 
7:35 AM
@AbdurRehmanKhan not being familiar with yield is fine but I suspect that playing with globals could trip you up in future. Anyway, everyone is constantly finding stuff they didn't know and this is a decent signpost to prompt you to look into it. Gotta head out, rbrb
 
@roganjosh Thanks man, you're right.
 
8:33 AM
hello, I need help for my code. How do you find the index of a number in a list then use that index to a find a number in another list?
 
@roganjosh Just read the whole thing. Logical.
Sounds like a lawyer representing Python
 
@Rietty find where? What decides which value to use? You probably need a dict where the keys are the numbers, but it's hard to say more without a more exact question.
@Acee please don't ask for help here with fresh questions on the main site as per our rules
And the question sounds straightforward if you read a tutorial
 
cbg Andras
I'm learning regex today
 
8:49 AM
Great
pre-emptive request: please don't suggest it as a solution to everything
 
@JossieCalderon maybe. But if you're trying to solve Rietty's problem you should wait until clarification
 
Hello all! I've been trying to manage a data stream and was curious if there are any recommendations on which data stream management system is a good one to start using?
 
@newkid hello. Data stream as in?
 
No. I am trying to catch words in a post by users on a forum. And sometimes I need to catch variations on the case.
 
8:54 AM
@AndrasDeak: Sensor data.
*real-time measurements
 
@JossieCalderon then maybe, yeah. But if anything goes you might check 'string' in to_match.lower(). But this will also match 'sTrINg' and 'Astringo'. And if you want grammar you might need NLP :P
 
@AndrasDeak Or convert the items in the list to lowercase!
6
A: Match string in python regardless of upper and lower case differences

Andrew_CSmy_list = ['webcam', 'home', 'Space', 'Maybe later', 'Webcamnew'] for item in my_list: if 'webcam' == item.lower() print item.lower() Note: Strings are immutable in Python - it doesn't modify the string in the list.

That last statement is hand-wavy, though. List indices are mutable.
 
9:09 AM
@newkid Ok then you should say 'which sensor data stream management system...?' Anyway I don't know, that's not a Python question, there's lots of commercial and open-source options out there, you have to figure out what your criteria are.
@JumbleGee Sorry I don't know OpenCV. Suggest you go ahead and post as a question on SO with code attempt.
 
@JossieCalderon the ladt statement is exact and true
The asker says nothing about mutation
 
@thefourtheye hey man, you alive :]?
 
@AndrasDeak "if there is a way to do it without converting to lower/uppercase that would be useful as when you convert back you loose the correct case" - OP implies that the list indices are mutated.
 
9:36 AM
@JossieCalderon that's not in the question, it's in a comment. And OP is confused. The answer is correct. Nothing about that answer suggests mutation of the list, so it's just that the answer has no idea what's going on, and didn't even try the code.
So no, the answer is not "hand-wavy". It's correct.
If you don't see that you might just be as confused as the asker.
 
Yep
The bane of helping others is not considering their problem
 
SO is not about helping others.
 
Sam
I asked a while back how to "unpack" a dictionary a, b = {'foo': 'bar'} in here and I cannot find it for the life of me.... There was a good answer but I can't remember whom from. So apologies but I'm going to ask it again :P
 
May 18 at 14:21, by Sam
Not sure if i'm being stupid here.. is there a clean way to unwrap a key value from a dictionary which only contains one item? I thought I could do something like key, value = mydictionary
 
Sam
How did you find this?! I tried using the search.. thanks man
 
9:42 AM
I used the search
 
Sam
And went through 8 pages that fast? I used the search too
Was your search term just "unpack"
 
@Sam Hover over your name. Note your user ID. Type "Dictionary" when said by "yourUserID". Done
 
@Sam I searched your messages for "dict" then "dictionary"
you can easily search a user's messages from their profile, no need to mess with user IDs manually
 
Sam
ahhhh I wasn't properly filtering by my profile. I went into my profile
Yeah I initially searched for dictionary and had to go through 8 pages... and it wasn't there :P
Noted though. Thanks guys
 
no worries
 
9:46 AM
Just thinking like a web scraper. :p
 
 
2 hours later…
11:41 AM
@JossieCalderon case-insensitive comparison should use .casefold, not .lower or .upper.
 
Sam
11:52 AM
We can overload class methods such as addition with def __add__ ... is it possible to add your own custom operator characters. I.e. A -> B and have some functionality for -> ?
 
I just played by the ear using winsound. Have you?
 
@Sam nope
 
Sam
@AndrasDeak OK. I feel like it is probably stupid anyway
 
Sam
Thanks
 
11:58 AM
@Sam I've seen << overloaded to mutate custom objects and it's confusing and C++
 
Sam
The more i think of it the more it seems confusing to others
 
Overloading >> and << can be quite pleasant for chaining/linking things. It helps to have a firm grasp of operator precedence and the like before writing your own DSL.
Unless of course you just want to fool around and learn, then go ahead and build some throwaway mini-language. There's a lot to learn from making your own mistakes. ;)
 
 
2 hours later…
2:26 PM
@MisterMiyagi Didn't know this existed. Thanks
 
So I made a subclass of inspect.Parameter and I'm tempted to make the kind default to POSITIONAL_OR_KEYWORD. Good or bad idea?
(inb4 someone says subclassing inspect.Parameter is a bad idea)
 
@AndrasDeak If you want grammar and synonyms you will need NLP you mean :P ;)
@JumbleGee too many variables and ways to do this: make a question on SO with your example (attempt) and it will be more answerable (trying to answer it in chat will turn into a page of back-and-forth and is not what chat was made for)
 
2:51 PM
@newkid I recommend you watch the intro to data streams from PyCon 2016 (I love PyCon) then research into the options given here - my opinion on best tends to be "whichever the business says I have to use" in this case so shrug on best
 
Sam
3:02 PM
Just tried using yield for the first time in a recursive function which walks an arbitrary depthed dict tree... it seems i'm not yielding any nested elements at all and I'm unsure as to why. I've made a minimal example repl.it/repls/TomatoLowestLinuxkernel are there some side effects with using yield in recursion? Or have a fluffed something
 
@LinkBerest thanks for the recommendation! PyCon is a good conference indeed :)
 
3:25 PM
@Sam you probably have to yield from traversal(...)
And it's better form to use isinstance for type checking, allowing subclasses
 
Sam
3:53 PM
@AndrasDeak Yeah good point
 
@Aran-Fey good idea. positional + keyword is the default for signature syntax, so it makes sense to choose the same for its representation.
 
done, that's all the support I needed
 
@Sam this is the classical "recursion without return" problem, just for generators. Might want to have a look at this question for the regular return case, might help understanding the problem.
 
Sam
4:23 PM
@MisterMiyagi Thanks. Will take a look now :) Will probably need to solidify my understanding of yield too. The first time I've found a potential use for it
 
4:39 PM
Python keeps bumping into different windows, until it bumps into this specific window.
It tells the programmer, Micheal: "Micheal, soft windows are my favorite!"
 
4:51 PM
Is there any way to solve pytest error of github actions flow?
It returns exit code 5 even though everything is present.
 
How to check for the existence of an element in a nested list, for example I want to search whether 3 exists in [[3,4], [2], [[222]]]?
 
@kauray use any() function
 
would that work for any level of nesting?
 
I need help with pyparsing... essentially, I want to parse a simplified version of type annotations - things like foo, foo[bar], foo[bar, baz], foo[bar[baz]], foo[bar][baz], etc. I can't figure out how to write the rule for subscripts. I've got name = pp.Word(pp.alphas) and no clue where to go from there
 
@Aran-Fey might want to check out the stenotype parser
 
5:06 PM
@kauray It should AFAIK.
 
@MisterMiyagi Thanks. I see you implemented identifiers with delimitedList, which is definitely smarter than how I did it...
I take that back, it allows whitespace unless you set combine=True, wtf
Hmm, seems like you only allow subscripts of identifiers?
#: a subscribed reference, such as `List[...]`
GENERIC = (
    (IDENTIFIER + Suppress("[") + delimitedList(Group(TYPE)) + Suppress("]"))
That's a reasonable limitation, I guess
 
5:29 PM
I used if x in itertools.chain(*list) @AshwinPhadke , it seems to work
 
Hello everyone! Does anyone know of any website or forum or community where I can tell people about my Python projects so that they check it out and also the code? I think Stack Overflow is not a place for that.
 
@ArafatKhan indeed it isn't.
 
@AndrasDeak Do you know any place which might be suitable for that?
 
Well there are things like reddit, but I have no idea what the culture of various subreddits is like, and whether any would be appropriate for this. I'm not good with social media.
 
Oh that's okay. Thanks
 
5:39 PM
@Aran-Fey typing doesn't allow anything else. you can't get a static type from a call, and there are no double-subscriptions.
 
Well, typing allows you to define your own custom generics though
 
Taking only identifiers as the first argument also simplifies this entire left-recursion thingy, which always messes up my brain otherwise
@Aran-Fey yeah, but I can't think of a way to construct a double-subscription.
A class Foo(Generic[...]): will always appear as Foo[...] in annotations
@ArafatKhan you may want to consider CodeReview
unless you are looking for promoting your projects, in which case... no idea
 
Also, is there a simple way to groupby python list according to a column which is also a list?
 
oh, right, typing handles all the subscription magic. I thought there was a way to customize that behavior
 
I think typing is only Foo, Foo[...], and Callable[[Foo, Bar], Raz].
as far as annotation grammar is concerned, at least
 
5:46 PM
@kauray python lists don't have "columns". Are you talking about itertools.groupby or pandas groupby? Your terminology makes this ambiguous.
 
Wish there were some means to add more custom syntax, then stenotype would be a lot simpler.
 
@kauray hmm I wonder if that is better than any(), but anyways if it worked for you then no problem.
 
@MisterMiyagi Thing is, I'd rather make my parser too lax than too strict - that way it's more future-proof, and if something's not allowed, it'll crash when I evaluate it anyway.
ok, if I can't get this parser to work within the next 10 minutes I'm writing my own parsing module
 
@AndrasDeak I would like to post a question that hasn't yet been solved and is post 48hr now ?
 
@AndrasDeak itertools
Maybe I'm mistaken
 
5:53 PM
@AshwinPhadke then do it, no need to ask. The rules are clear and simple in this regard.
 
Great.
I have this query that hasn't yet been solved, it works for images however it does not work for video, the link to the question is : stackoverflow.com/questions/62179517/…
 
@AshwinPhadke Consider to read up on "minimal, reproducible example". People are much more likely to help if the code is free of syntax errors, fits one screen, and can be run without guessing.
 
@MisterMiyagi Yeah understood.
That small part has been bugging for a while so had to add everrything regarding it for making it clear.
 
The very first line of your question is invalid syntax!
 
@MisterMiyagi you mean the func_name() part?
 
6:02 PM
yes. func_name(loc, id , mn): is not valid (it misses the def).
 
6:17 PM
Any clue why this grammar doesn't work?
 
What do you hear???? What do you see??? It me!
 
@Aran-Fey pp.Forward() is fileld using <<, not =. You need expr << subscript_value | simple_value.
Got it now. Use expr << (subscript_value | simple_value)
 
omg, thanks. I wasted way too much time on that
also, that's why I prefer <<=
 
Operator precedence strikes a gain! NaNaNaNa LSHIFT!
you're right, expr <<= subscript_value | simple_value works as well
 
@PaulMcG Feature request: pyparsing.Forward should throw a warning/error if it's not initialized
 
6:37 PM
@ExoticBirdsMerchant please cut that out
 
Should comments that links to a YouTube python tutorial be flagged?
 
Why do you think they should?
 
Just curious.
 
@AnnZen only if it's spam, as spam, or if the only information in the answer is a link, as "not an answer"
 
I've definitely linked to videos in comments before. It's a different matter if it's in answers
 
6:46 PM
So it's totally alright?
 
I'm also aware that you have your own channel, so linking to that could also be seen differently as a type of self-promotion. If that is the reason that you're asking, you'll need to be sure that your videos are completely pertinent to the problem
 
That's what I was thinking. It shouldn't matter where the video is coming from, as long as it's completely pertinent to the problem.
 
In some cases, people are the authors of libraries that are also designed to solve particular problems. They normally (should) come with a disclaimer that they are the author. I would suggest the same if you're linking to your own videos, even if it's just a comment
re: the deleted comment (which I think is relevant to your second); it's not a case of preference, it's a case of being disingenuous if you were to suggest you just "discovered" a video that you actually created. You can link to your videos in comments, I'm just not giving you any guarantee about how that will play out, and I'm recommending that you be up-front that you're the creator
It's not?
 
That's right.
 
7:01 PM
Deleting comments here is not particularly helpful. Anyone else not immediately in this discussion will have no idea what I'm responding to
 
haha, sorry
 
Umm.. Can the execution time for the same code and same input vary by 10ms?
 
Anyway "I made a video <something something> here:" is enough disclosure (not disclaimer) for me to put the pitchfork back in the shed
@d4rk4ng31 easily
Ugh, it was me that used "disclaimer" first :/ I'll have a word with myself
 
bad me, bad!
I always think of this as the same as self-referencing: it doesn't always make sense but do it to avoid the inevitable comments from reviewers (the last time I got this, I forgot I wrote the earlier paper)
 
think of what as self-referencing?
 
7:11 PM
@AndrasDeak just fyi (as a reddit mod): nope. We have subs for ideas for projects (even a whole "beginner project with starting points" style subs) but no "oh! look at my cool code" and we try and avoid that (its really a github/personal website thing over reddit)
The whole "pointing to my own code repository/youtube video/blog article" in a comment or answers thing
 
7:28 PM
@LinkBerest noted!
@AnnZen if we're talking about your videos: they can be alright but don't go overboard. If it starts to lool like self-promotion (spam) your posts might end up being deleted.
And content should be in the answer. "Here's a tutorial video by the way" is rarely helpful.
When a question needs a tutorial as an answer it should be closed, not answered
 
@AndrasDeak is also right. Too broad
 
Did I really need to be pinged for that? You can use my name without pinging me
 
Typing "roganjosh"?
 
I'm done with you
 
7:36 PM
same
 
sigh as an educator: it was hard to realize I shouldn't answer the "tutorial"-requiring style questions but it definitely leads to the whole "students only learn to copy&paste code over learning to actually correctly research/search" problems
 
That's a false dichotomy. SO is not the place to teach newbies to code without them having to read an actual tutorial.
 
I agree and have had the interns/junior devs this leads to so super agree (didn't make it much easier to swallow)
 
unless I've been interviewing people for a week - then I'm just a monster ;) >:0
online interviews are fun when people forget to change their settings so I can tell their looking at answers on SO (or when I search for their direct quotes and find the answers).....I really should build an extension for this
 
7:49 PM
what kind of settings?
 
That's what I wanted to know
 
oh, sometimes they screenshare without switching to single window (sharing their whole desktop instead)
 
Ah. Amateur hour :P
If I were the interviewer I'd be offended not because of the cheating but because of the dumbness
 
pretty much
 
Do you call them out on it? Like finish their sentences for them or something?
 
7:51 PM
And you sit through the whole time with them not knowing you can see it?
 
(but things like MS teams don't support single-window sharing on linux)
 
nah, the IT manager does that usually - I just hang up
 
@AndrasDeak what I meant was what's the easiest way to group a list according to the values of another list where each element is a list itself
 
ugh....I've commented on that, bugged my contacts at MS, and really just been a bit of pest - but yeah, MS doesn't want to add the single window option (I just tell people to use Chrome to connect in those cases - still works in browser...most of the time)
 
@kauray I see
 
7:57 PM
having Linux = +5 in an interview with me anyway (and I've never seen someone on Linux have to, at least not obviously, reference an SO answer so been a non-issue to this point)
 
@LinkBerest also no audio sharing. So I now know how to create audio loopback and null sink devices in pulseaudio... never though I'd have to learn that.
 
generally made a bit of a pest on myself = I'm trying alright!? ;)
seriously though; my contacts said they are working on the audio part but just don't want non-desktop (too much to invest it seems)....that was before all the corvid stuff though so priorities might not be the same
 
This is linux desktop. Unless I misunderstood.
on the other hand I should be touched that there is linux desktop
 
its kinda both; Teams was suppose to have audio when they made the marketing announcement but stuff didn't work and something was better than nothing
 
I thought that teams has been around for many years
 
8:01 PM
@LinkBerest Which reddit group do you mod?
 
a few, mostly Java
 
How about python?
 
@AndrasDeak around for a while, official support for Linux only since 2019 (or 18...)
yeah, 2019
 
ah, didn't know that
 
@AnnZen nope, I could I guess but I only have finite time :)
 
8:07 PM
@Aran-Fey Good timing! I was just about to push out the next 3.0.0 pre-release. I have added a number of __diag__ switches to enable troubleshooting warnings while running pyparsing parsers, so my inclination would be to add a switch for warning when trying to parse with an empty Forward.
 
oh, that's neat! Debugging my parsers is probably my biggest time sink after figuring out the grammar :D
 
pyparsing.__diag__.enable_all_warnings() - there is already a warning if you write fwd_exr << expr_a | expr_b.
 
About yesterday's indentation edit, you do know that the editor changed the indentation method so the message "edits have to be a least 15 characters" wouldn't interfere, right?
 
Since << has precedence over |, you end up just getting expr_a inserted into the Forward.
 
If you're planning a version bump to 3.0, you could consider deprecating/removing << altogether
 
8:18 PM
@AnnZen no, and that's a good sign that they shouldn't have edited
 
@AndrasDeak so any pointers to that?
 
@kauray no, I don't think I've ever used groupby. Where are you stuck?
 
@kauray Note that other people in the room won't be able to follow the trail of this discussion. It's more helpful if you use directed replies that point to specific comments (as I did here, note the little arrow on the left that gives a link to the specific comment I'm replying to). I saw groupby earlier and I may be able to help, but I don't know the problem
 
@Aran-Fey I considered that at one time, but I do use it on occasion (probably in a lambda) (I'm pretty sure there is a mention in the CHANGES file)
 
and yeah, what he said
 
8:27 PM
@roganjosh it doesn't allow me to refer to my own question
Anyway my question was 'what I meant was what's the easiest way to group a list according to the values of another list where each element is a list itself'
 
Hmm, is there a way to return None from a parseAction? Doing the obvious thing gives me the input text as a string:
>>> none = pp.Keyword('None').setParseAction(lambda: None)
>>> none.parseString('None')[0]
'None'
 
@kauray Sure it does. Hover over my last message and a new arrow will appear on the left. Clicking on that will give you an option for "reply to this message"
 
@roganjosh not with your own messages
you can still hack it, but not legally
 
If you really want to reply to your own messages, you can grab the ID and use that with : in front of it
 
Oh thanks, but I'm on mobile
 
8:30 PM
Returning None from a parse action leaves the current tokens intact (or as modified in-place by the parse action). Try returning [], or do pp.Keyword('None').suppress() instead of a parse action.
 
@AndrasDeak I got the impression, from the bits I've seen, that you've had some discussion, though. They could be using directed replies to your responses? Or am I missing something?
 
No, you're not :P
 
@PaulMcG Ah, I forgot parseActions are supposed to return a list of tokens. lambda: [None] does what I want, thanks
 
pandas groupby? sqlalchemy group_by? SQL group by? (granted all of these are similar)
 
8:35 PM
technically: you can do that with SQLAlchemy (you can build a graph with it) but I would think that was overkill
 
Eh? That seems so elaborate, it's genius! :P It looks like an itertools jobbie
 
either way, what have you tried? were you able to do this with a standard for loop? would be my next questions
personally, at a guess, the second list should be a generator (which here could mean a set) and the "groups" (i.e. dictionary) would be built from it (i.e. keys) but that's a complete guess based on no minimum example
also, based on the fact that I do that alot - and then feed those dicts into graphs
which feed into databases (RDB, RDD, NoSQL, Graph, or otherwise) or DataFrames (Spark or pandas)
 
@AndrasDeak That's true, but even in wim's It's time to reward the duplicate finders there's no incentive to point people to am (offsite, third-party) tutorial, and incentivizing that would be impossible to police, so won't ever get adequately rewarded. (I didn'y say that was the intent of your comment, jus saying)
 
8:54 PM
sigh on that same note, I've seen one too many here's my input, here's my desired output, I have no code: how do I do this? questions for today: adios all
 
rbrb
 
 
1 hour later…
9:56 PM
I am just going to ignore those from now on
 
I'm trying to trap an erroneous use of Forwards in pyparsing. It is a common error to create a Forward object (base = pp.Forward) but then mess up the actual assignment by using '=' instead of '<<=' or '<<' (base = pp.Word(pp.alphas)[...] | '(' + base + ')') I tried to hook into Forward.__del__, hoping that the second assignment would cause __del__ to get called immediately - I know __del__ isn't guaranteed to run, but since '=' is not an operator, couldn't think of anything else.
Nm, looks like I can hook into __del__ after all, though the results might not be super helpful.
 
10:12 PM
and it might not be triggered, especially in a fancy interactive shell
 

« first day (3521 days earlier)      last day (1410 days later) »