Talk:Python (programming language)/Archive 11
![]() | This is an archive of past discussions. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Archive 5 | ← | Archive 9 | Archive 10 | Archive 11 |
More Python programming examples
Hello. My fellow classmates and I are interested in making some positive contributions to the Python article. We plan on adding in a few Python programming examples and possibly explanations that aim to illustrate core Python syntax for a brief introduction without requiring the readers to go the Python syntax page directly. However, we noticed a comment in the edit page, which is to quote, "Please don’t add more examples". We would like to ask why this is discouraged. We have looked at other pages on popular languages such as JavaScript, Haskell, Java, and observed that they each have a much richer example section, thus we believe we can and should move this page in such a direction. Mtran0842 (talk) 17:51, 15 March 2022 (UTC)
- @Akeosnhaoe: I believe you added the
Please don’t add more examples
comment. Perhaps you can explain further. - @Mtran0842: My supposition is that Wikipedia articles are not "how to" documentation. I think that is more the purpose of wikibooks:Python Programming & wikiversity:Python. If you wish to add examples that are not already covered, these may be the appropriate venues. Peaceray (talk) 18:03, 15 March 2022 (UTC)
- Thank you for your response. While I do wholeheartedly agree that Wikipedia articles are not meant to behave like a manual book, it is also not our intention to be exhaustive when it comes to adding more programming examples. Again I wish to emphasize that we aim to "illustrate core Python syntax for a brief introduction without requiring the readers to go the Python syntax page directly". To be more specific, adding two to three examples, or even only one, would suffice in our vision.
- Mtran0842 (talk) 18:21, 15 March 2022 (UTC)
- The 'Hello, world!' and the factorial example we already have are the traditional two samples used in this kind of situation and are plenty for this page. Please don't add more. I've seen example lists on similar articles grow out of control over time, so this list needs to be kept lean. Also, I took a look at some of the other programming language articles you mentioned, and (except for the javascript article, which is IMO awful) the number of examples on them seems to be in line with what we have here - even if you find counterexamples, consider that the proper action might be to trim those rather than grow this article. - MrOllie (talk) 18:42, 15 March 2022 (UTC)
- Considering this perspective, could it be appropriate to provide brief direction for where an interested reader can go next? Some other pages have a link near the top of the subsection such as see other features and examples(Haskell) or Language Syntax(Java at least) to have more examples without the bloat in the main page. Would adding a link to the Python Syntax and semantics page from the Examples subsection work at accomplishing this? Calvinroth1 (talk) 01:25, 16 March 2022 (UTC)
- There's a section called 'Syntax and semantics' where such links can be found - in fact it is the neighboring section to the examples. I think the readers who want to know more about syntax already know where to go. MrOllie (talk) 12:03, 16 March 2022 (UTC)
- Considering this perspective, could it be appropriate to provide brief direction for where an interested reader can go next? Some other pages have a link near the top of the subsection such as see other features and examples(Haskell) or Language Syntax(Java at least) to have more examples without the bloat in the main page. Would adding a link to the Python Syntax and semantics page from the Examples subsection work at accomplishing this? Calvinroth1 (talk) 01:25, 16 March 2022 (UTC)
- The 'Hello, world!' and the factorial example we already have are the traditional two samples used in this kind of situation and are plenty for this page. Please don't add more. I've seen example lists on similar articles grow out of control over time, so this list needs to be kept lean. Also, I took a look at some of the other programming language articles you mentioned, and (except for the javascript article, which is IMO awful) the number of examples on them seems to be in line with what we have here - even if you find counterexamples, consider that the proper action might be to trim those rather than grow this article. - MrOllie (talk) 18:42, 15 March 2022 (UTC)
- Thanks, but sorry, that's not going to work. Experience tells us that as soon as more examples start to appear, there is no end. People edit the examples to make them more "Pythonesque" with one-line-is-all-you-need tricks that are not appropriate here. We have (IMHO) let Hello World decay recently but it will be pruned eventually. Johnuniq (talk) 22:44, 15 March 2022 (UTC)
- Yea, this was also part of my reason for adding the comment. People see 5 examples and and think "hey, there's all this code but no example for <some specific concept I just learned about, like decorators or something>, I'll just add one more" and it just never stops and few people that want to delete examples but lots of people coming by that want to add one so eventually the article is looking like a Rosetta Code page. It's already a really long article. Akeosnhaoe (talk) 06:45, 16 March 2022 (UTC)
- The comment, is meant for people that were making drive-by edits of useless code, maybe just so that they could think to themselves "hah my code is literally the textbook example of Python code". It's not meant for people making high-effort contributions. It sounds like you want to actually improve the article and give some thought to the examples on the page, so feel free to disregard it. WP:BOLD and all that.
- But I will say that to me, when I read about a programming language, just a dozen lines or so, like what we have now gets me like 80% of what I want, just to get the gist of the syntax. If I then want to go and actually learn the language, that doesn't happen on Wikipedia. I don't think it would be helpful to have readers scroll through pages and pages of code, but more examples could be good. The current examples already demonstrate
- - significant whitespace
- - functions and their invocation
- - dynamic types (the fact that in Python you don't annotate variables with their type)
- - for loops and range()
- - input/output
- - math
- one obvious thing that I would say is missing is function definition syntax. Akeosnhaoe (talk) 06:39, 16 March 2022 (UTC)
- The edit that finally made me add the comment
- https://wiki.riteme.site/w/index.php?diff=968326272&oldid=968258780&diffmode=source
- was adding a Fibonacci sequence function as an example which doesn't illustrate anything meaningful the other two example don't already. Akeosnhaoe (talk) 10:19, 16 March 2022 (UTC)
- I think I agree that Fibonacci doesn't add enough that isn't already here if factorial is already present. In my mind if one wanted to add a new example it would include using Lists or some other default data structure in a basic way. Simply rewriting the factorial example as a function is something we could do as well. Calvinroth1 (talk) 13:46, 16 March 2022 (UTC)
- An attempt was made to do that, but it needlessly made the example more confusing, so I reverted it. MrOllie (talk) 17:27, 23 March 2022 (UTC)
- I am interested in why you find the reverted edit to be confusing. Can you perhaps elaborate further on your reason? I find adding a function definition and in turn a call to such defined function is quite helpful as the practice of doing so is one of the cornerstones not just to Python but also to most programming languages. Also I am confident that the majority of beginner programmers will have little to no difficulty in understanding the edit that I made. Mtran0842 (talk) 19:47, 23 March 2022 (UTC)
- You created a function definition that accomplished nothing and was unnecessary for the functioning or structure of the program - it served no purpose and thus its presence was misleading. You seem to still be laboring under the misunderstanding that this article should help beginner programmers - that is not the purpose of an encyclopedia article (WP:NOTTEXTBOOK). Perhaps the material you and your classmates seem to want to add would fit better at Wikiversity, where the mission is to produce learning materials. MrOllie (talk) 19:48, 23 March 2022 (UTC)
- Thank you for your elaboration and your suggestion regarding where to direct our effort. I want to clarify that we aim to make this page better as a general informative resource and not as a study material, but perhaps we were bad at demonstrating our intention and so we apologize for that. After all it is our first attempt. Anyway, I get where you are coming from regarding your explanation to the revision, but I want to ask this so I can better understand: would it not be better to have the program written in such a way that is more traditionally seen in actual coding practice compared to having it be presented in a bare-bones fashion? I would argue that by presenting the program in the way of the former, it is still in spirit of bettering this encyclopedic page. Mtran0842 (talk) 20:48, 23 March 2022 (UTC)
- First, I don't agree with the premise that your version was an example of something a typical python programmer would produce. And no, I don't think it would be better to make an example of 'actual coding practice' - that these are minimalist examples is a feature, not a bug. Python in particular tends to have a lot of clever, densely written code, which practitioners say is 'pythonic'. I don't think we should reproduce that kind of thing, and I don't think more complex example programs that are trying to demo additional language features is the direction this article should move in. MrOllie (talk) 12:21, 24 March 2022 (UTC)
- Thank you for your elaboration and your suggestion regarding where to direct our effort. I want to clarify that we aim to make this page better as a general informative resource and not as a study material, but perhaps we were bad at demonstrating our intention and so we apologize for that. After all it is our first attempt. Anyway, I get where you are coming from regarding your explanation to the revision, but I want to ask this so I can better understand: would it not be better to have the program written in such a way that is more traditionally seen in actual coding practice compared to having it be presented in a bare-bones fashion? I would argue that by presenting the program in the way of the former, it is still in spirit of bettering this encyclopedic page. Mtran0842 (talk) 20:48, 23 March 2022 (UTC)
- You created a function definition that accomplished nothing and was unnecessary for the functioning or structure of the program - it served no purpose and thus its presence was misleading. You seem to still be laboring under the misunderstanding that this article should help beginner programmers - that is not the purpose of an encyclopedia article (WP:NOTTEXTBOOK). Perhaps the material you and your classmates seem to want to add would fit better at Wikiversity, where the mission is to produce learning materials. MrOllie (talk) 19:48, 23 March 2022 (UTC)
- I am interested in why you find the reverted edit to be confusing. Can you perhaps elaborate further on your reason? I find adding a function definition and in turn a call to such defined function is quite helpful as the practice of doing so is one of the cornerstones not just to Python but also to most programming languages. Also I am confident that the majority of beginner programmers will have little to no difficulty in understanding the edit that I made. Mtran0842 (talk) 19:47, 23 March 2022 (UTC)
- An attempt was made to do that, but it needlessly made the example more confusing, so I reverted it. MrOllie (talk) 17:27, 23 March 2022 (UTC)
- I think I agree that Fibonacci doesn't add enough that isn't already here if factorial is already present. In my mind if one wanted to add a new example it would include using Lists or some other default data structure in a basic way. Simply rewriting the factorial example as a function is something we could do as well. Calvinroth1 (talk) 13:46, 16 March 2022 (UTC)
neural network
how does this work? 115.247.106.78 (talk) 11:38, 24 August 2022 (UTC)
Strings as a separate heading?
The discussion of Python strings appears in the list of expressions, which seems odd (if not fully wrong). I propose that a new section be started on Python's strings, starting with the current text and maybe expanding somewhat. Paulehoffman (talk) 01:30, 21 November 2022 (UTC)
Python and BASIC
Seems that nobody have noticed that Python is very similar to a very old language: BASIC. BASIC has a lot of versions and like Python has interpreter and compiler versions. 84.111.134.34 (talk) 13:16, 17 September 2022 (UTC)
- Python is very similar to many languages that existed before it was created. Listing them, and trying to parse which was most influential, could be revisionist history. Paulehoffman (talk) 01:31, 21 November 2022 (UTC)
External links
Maybe add some guides on how to use Python in the external links? GenZenny💖 (talk) 07:33, 21 November 2022 (UTC)
- There's a billion and one guides on how to learn/use Python, which anyone with the most basic working knowledge of how to use a search engine could find. Linking to any particular guide would not only show preference towards it (could be seen as spam, unwanted promotion etc.), but also is outside the scope of this article. — Jumbo T (talk) 20:15, 21 November 2022 (UTC)
Design philosophy and features is inaccurate
Suggest rewriting the Python (programming language)#Design philosophy and features section to reflect the actual language rather than PEP20. Specifically, commentators have criticised Python's additions for violating Python's design principles with unnecessary bloat and complexity. Would this be supported? BordenC (talk) 10:02, 22 December 2022 (UTC)
I would support this, as long as there was still a discussion of PEP20 along the lines of "the stated philosophy" (talk) 15:55, 22 December 2022 (UTC)
New resource for historical info about Python
For any editors updating this page, I just noticed today that in November 2022 Professor Lambert Meertens published an article on "The Origins of Python" in the journal Inference. It may be useful in that it covers a great amount of the history of ABC and Guido van Rossum's early development of python. (I unfortunately don't have the cycles myself to do any editing of this page right now.) - Dyork (talk) 13:07, 23 January 2023 (UTC)
Good article reassessment needed?
This article has been listed as possibly requiring a WP:Good article reassessment for quite a while now. We're trying to empty this category (and possible deprecate it). Do editors here believe it still meets the criteria? My impression is that it's close, but that a few improvements are needed:
- Most importantly, I think the lead needs to be simplified to comply with WP:make technical articles understandable. The most difficult words in the lead for me are garbage-collected, structured programming, standard library, and what type of language ABC was. I think more emphasis should be put on uses of the language (simple to learn, large community and therefore loads of specific libraries, but slow).
- Occasionally, the body also misses opportunities to explain things simply "Python uses duck typing and has typed objects but untyped variable names.". Duck typing is easy to explain, but will be unfamiliar to many.
- There are occasional (potentially) uncited statements like:
- When speed is important, a Python programmer can move time-critical functions to extension modules written in languages such as C; or use PyPy, a just-in-time compiler. Cython is also available, which translates a Python script into C and makes direct C-level API calls into the Python interpreter.
- Most of the text in "Development environments"
- Some of the text may be in need of updates, such as:
- Cython compiles (a superset of) Python 2.7 to C (while the resulting code is also usable with Python 3 and also e.g. C++). I assume Cython now works with python 3?
- Should we cover the current project of making python faster? [1].
If no progress is made towards these issues, I'll list the article at GAR in a few weeks. Pinging top contributors: @Abductive, Comp.arch, Thumperward, and Akeosnhaoe:. —Femke 🐦 (talk) 10:19, 29 January 2023 (UTC)
- I don't have anything to say about whether this needs reassessment, but I would strongly oppose removing the technical language you list from the lead. It's a well-established convention in articles about programming languages (see Rust, C, Perl) to describe their features using technical terms that may not be familiar to the general reader. Programming languages are a specialized subject; it is rather difficult to talk about them in a meaningful way without technical language. From the essay you linked:
For highly specialized topics where it is difficult to give an overview in terms with which a general audience will be familiar, it may be reasonable to assume some background knowledge in the lead while linking to the prerequisites required to understand it.
- That said, this doesn't mean we can't add content to the lead about the uses, history and appeal of the language (in the articles linked above, large parts of the leads consist of this sort of content, and this article is indeed lacking). In fact, I'd strongly support this. — Jumbo T (talk) 11:47, 29 January 2023 (UTC)
- I do not believe Python is a highly specialized topic. It's probably the most common programming language out there, and is often used by those just starting to program. Information such as " cycle-detecting garbage collection, reference counting," for python 2 is not really relevant to most readers, and it is highly technical. Not saying that we should remove all jargon of course. You can't understand what python is without saying it's high-level, dynamically typed and so forth. We can take the example of Rust, where jargon is either explained or contextualised (see second sentence). —Femke 🐦 (talk) 12:02, 29 January 2023 (UTC)
- I moved that Python 2 stuff out of the lead because I agree, it was relevant when Python 2 was the latest version but it doesn't make sense to have it in the lead anymore. Akeosnhaoe (talk) 12:50, 29 January 2023 (UTC)
- I do not believe Python is a highly specialized topic. It's probably the most common programming language out there, and is often used by those just starting to program. Information such as " cycle-detecting garbage collection, reference counting," for python 2 is not really relevant to most readers, and it is highly technical. Not saying that we should remove all jargon of course. You can't understand what python is without saying it's high-level, dynamically typed and so forth. We can take the example of Rust, where jargon is either explained or contextualised (see second sentence). —Femke 🐦 (talk) 12:02, 29 January 2023 (UTC)
- Without looking at the rubric, I support marking this down/re-assessing (whatever that means) because I can't call this article "good". It's written as an introduction to the language and it's a pretty complete high-level description of Python, which is hopefully helpful to beginners, but on the other hand it's just kind of an ugly article and repeats itself often. It's grown organically, with people adding small snippets and expanding/completing sections they care about with little to no regard for the entire article. It would be great for someone to sit down and systematically edit it, pare it down/reorganize stuff. And also remove more mentions of Python 2?
- > I think the lead needs to be simplified
- It would be nice but I don't think it can be in a useful way. You could make the edit and then we can discuss reverting the specific edit. For the audience that's familiar with programming languages, the list "significant whitespace, dynamic typing and garbage collection" is the first sentence you want to read. The stuff about "programming paradigms" is kind of fluff in my opinion, all modern languages are "structured, object-oriented and functional", and I would support just removing it completely, but other people like to talk about that kind of stuff.
- > simple to learn, large community and therefore loads of specific libraries, but slow
- I agree that this kind of summary of what Python is in practice is good and writing it as a more explicit list into the article is a great idea. This article is trying to say these things in different places.
- > what type of language ABC was
- I don't think anyone is expected to know that. It's a link if you care to know how Python is connected to the past.
- > I assume Cython now works with python 3?
- No, as per the Cython article, there's a preview version that does but formally the current version still doesn't. Cython isn't that widely used. Akeosnhaoe (talk) 14:33, 29 January 2023 (UTC)
no complaints from me: the areas highlighted are things that I've tried to tackle over the years, but any technical article on here tends to backslid towards trivia and pointless nitpicking if not strictly watched. In particular, all of the bulleted syntax stuff should be relegated to the syntax sub-article if not removed entirely. Chris Cunningham (user:thumperward) (talk) 06:46, 2 February 2023 (UTC)