Talk:Python (programming language)/Archive 11

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
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)
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://en.wikipedia.org/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)

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)