bot icon indicating copy to clipboard operation
bot copied to clipboard

New generators-iterators tag

Open Okimii opened this issue 3 years ago • 10 comments

Would love all the feedback!

Okimii avatar Aug 05 '22 05:08 Okimii

This tag feels like it's trying to compare generators and iterators, which I don't think makes sense. Since a generator (function) returns an iterator, this feels a bit like comparing e.g. a BMW to a Car. Would two separate tags on the topics make more sense?

wookie184 avatar Aug 05 '22 10:08 wookie184

Tags should be concise and answer a common question. If someone wants to know what a generator is, at a high-enough level that it can be answered concisely, I don't think many of the details here are relevant.

I would rather see a tag that gives an example of a generator created through a function, and an explanation of how the generator maintains its own state between yields (but preferably without the word "state").

swfarnsworth avatar Aug 05 '22 12:08 swfarnsworth

This tag feels like it's trying to compare generators and iterators, which I don't think makes sense. Since a generator (function) returns an iterator, this feels a bit like comparing e.g. a BMW to a Car. Would two separate tags on the topics make more sense?

Well, maybe the wording in the file may lead you to think that its trying to compare an iterator and a generator, im not aiming to, im aiming to explain both concepts, if you have any suggestions especially about the wording, please let me know!

ghost avatar Aug 05 '22 18:08 ghost

Your understanding of Python's internals is impressive, but I feel that this tag focuses on the wrong details, and tags of this length are not likely to be read in their entirety. Consider the target audience (novice Python developers) and the context in which this is intended to be read (likely during a help session where said novice is focused mainly on solving a specific problem). As insightful as it is, I would like to see all discussion of classes and dunder methods removed.

Perhaps you could instead demonstrate how a function that returns a list of X could be refactored to generate X. Remember: for a novice Python developer, what's remarkable about generators is that they "go to sleep" between iterations and "keep all variables", or some phrasing along those lines.

swfarnsworth avatar Aug 06 '22 20:08 swfarnsworth

@ionite34 well done especially on the implementation of examples!

ghost avatar Aug 06 '22 21:08 ghost

For an additional note, the \ marks on lines 14, 26, 32, 37 need to be removed for the markdown to be valid.

ionite34 avatar Aug 06 '22 21:08 ionite34

We discussed during today's staff meeting, we would like to see this tag revamped/pivoted to a narrower scope, which also leverages and links to the Real Python article on generators.

Please let us know if you'd be interested in doing that @Okimii.

We will also work on better defining what criteria we feel a tag should meet to best serve as a teaching tool for a real-time communication platform such as Discord, and also make it a bit clearer that a PR for a tag should not be opened without further discussion on a meta issue first.

minalike avatar Aug 07 '22 20:08 minalike

@minalike I wouldn't mind revamping the tag, I would love for the staff of pydis to make it better and more defined in the context of details for a better tag for beginners, I can also help with the structure of the tag but im not quite good with wording so I would really need help on that part, either way there's allot of talented people in pydis staff, e.g @ionite34 which has helped allot especially wording wise and the tags structure, so even if my wording isn't the best it can also be corrected which I do appreciate as it does help me.

ghost avatar Aug 07 '22 20:08 ghost

I'd like to see this shortened down dramatically.

  • I don't think we should explain iterators and generators in the same tag. Let's make this one solely about generators.
  • Tags should not be articles, and generators is a big topic which will not be sufficiently explained in a tag. In this case, it would be better to explain (in only a handful of words) what it is, how it's commonly used, and then link to a good resource for learning about it.
  • The RealPython article is a fantastic resource, and right now, I see no reason why I would use this tag instead of just linking that article directly. Let's instead make this tag a companion to that article, rather than trying to compete with it.

lemonsaurus avatar Aug 07 '22 21:08 lemonsaurus

I love that idea.

ghost avatar Aug 07 '22 21:08 ghost