Talk:Python (programming language): Difference between revisions

Content deleted Content added
No edit summary
Reverted 1 edit by 2001:4455:344:CE00:7D79:6CA7:6885:4151 (talk): Off topic
 
Line 1:
{{Talk header|search=yes}}
Python is described in "it transparently supports bignum
{{ArticleHistory
arithmetic". "bignum" is defined as encompasing both arbitrarily
|action1=GAN
large integers and rational numbers. Python does not yet provide
|action1date=10:51, 7 March 2007
for rational number arithmetic.
|action1result=listed
|action1oldid=113288869
 
|action2=PR
I don't believe Python supports [[:Functional programming|Functional programming]], as in [[:Prolog|Prolog]] or somesuch. It supports function-based programming... meaning that your program is just composed of functions not organized into classes and objects. I have gotten the two confused in the past, and I suspect that this is what happened here.
|action2date=07:13, 17 February 2009
|action2link=Wikipedia:Peer review/Python (programming language)/archive1
|action2result=reviewed
|action2oldid=270962314
 
|action3=GAR
Or does Python really support functional programming? Is there some add-on package that allows this? I wasn't aware of one. -- [[talk:Ansible|ansible]]
|action3date=15:25, 3 March 2009 (UTC)
|action3link=Talk:Python (programming language)/GA1
|action3result=kept
|action3oldid=274694631
 
|action4 = GAR
Yes, Python really does have some built-in functional programming features such as "map()", "filter()", "reduce()" and a somewhat limited "lambda", although I've read that Guido van Rossum now regrets including these features in the language. As a more readable and "Pythonic" alternative, "list comprehensions" were more recently introduced into the language and can often be used instead of the older functional programming constructs.
|action4date = 13:16, 9 February 2023 (UTC)
|action4link = Wikipedia:Good article reassessment/Python (programming language)/1
|action4result = delisted
|action4oldid = 1136880732
 
|topic=Engtech
:I for one do not believe very much in language purity, and I say that as someone who admires Scheme. Fiddly distinctions such as "object-oriented" vs. "object-based", or "functional" vs. "function-based" vs. "pure-functional" are, simply put, religious disputes. As such, they may merit being mentioned in Wikipedia (as do ''real'' religious disputes) but should not be taken too seriously.
|currentstatus = DGA
}}
{{WikiProject banner shell|class=B|vital=yes|1=
{{WikiProject Computing |importance=High |science=y |science-importance=Mid |software=y |software-importance=High |free-software=y |free-software-importance=High}}
{{WikiProject Computer science|importance=High}}
}}
{{User:MiszaBot/config
|archiveheader = {{talkarchivenav}}
|maxarchivesize = 31K
|counter = 11
|algo = old(90d)
|archive = Talk:Python (programming language)/Archive %(counter)d
}}
{{American English}}
 
== GA reassessment ==
:I consider functional programming, like object-oriented programming, to be chiefly a style of programming -- i.e. something that programmers do, not something that languages do. A language can ''allow'' a style of programming, or can even attempt to ''mandate'' its use (e.g. Scheme; Java), but it is the program which has a style not the language. It is in this light which I wrote in the subject article that "Object orientation and structured programming are supported, as well as functional programming."
{{Wikipedia:Good article reassessment/Python (programming language)/1}}
 
== "[[:Pyston]]" listed at [[Wikipedia:Redirects for discussion|Redirects for discussion]] ==
:(It is possible to write an imperative-style program in the "functional language" Scheme using <tt>begin</tt> and <tt>do</tt>, or an object-oriented program in the "structured language" ANSI C. It isn't possible to write a functional program in Pascal, though, since you can't pass around functions.)
[[File:Information.svg|30px]]
The redirect <span class="plainlinks">[//en.wikipedia.org/w/index.php?title=Pyston&redirect=no Pyston]</span> has been listed at [[Wikipedia:Redirects for discussion|redirects for discussion]] to determine whether its use and function meets the [[Wikipedia:Redirect|redirect guidelines]]. Readers of this page are welcome to comment on this redirect at '''{{section link|1=Wikipedia:Redirects for discussion/Log/2025 February 6#Pyston}}''' until a consensus is reached. <!-- Template:RFDNote --> [[User:Duckmather|Duckmather]] ([[User talk:Duckmather|talk]]) 02:32, 6 February 2025 (UTC)
 
== Plan for Future Edits ==
:Of course Python does not attempt to be a "pure-functional language" i.e. a language which requires programmers to use functional constructs. Nevertheless, it still permits the style in the large, by (for instance) permitting functions as values, generators, [http://www.ps.uni-sb.de/~duchier/python/continuations.html continuations], etc. --[[User:Fubar Obfusco|FOo]]
-------
I do not think Python is 'strongly influenced' by Perl. In fact the design philosophy is diametrically opposite in some senses.[[talk:pasokan|pasokan]]
:Let's see -- Python's an interpreted/bytecode-compiled language, with mixed type arrays, garbage collection, hashes/dicts as a basic type, a big standard library with support for Unix calls ... it has a lot in common with Perl. A large portion of the Python user base are "converts" from Perl. Python also ''self-consciously eschews'' Perl-like syntax, which is a different way of being "influenced" by Perl! --[[User:Fubar Obfusco|FOo]]
--------
I'm not sure if we should say that Python is strongly typed. It provides a lot of implicit conversions (eg, between numeric types, between string types) and makes common use of functions accepting any one of a group of related types (any sequence, or any 'file-like object'). It doesn't make it easy to derive a new type from an old one without making it compatible (eg, you can't easily make a new integer type which isn't comparable with the standard Integer). [[User:Matthew Woodcraft|Matthew Woodcraft]]
:This is true. Python has a large number of distinct types (integers, floats, long integers, bignums, complex, e.g.) but converts implicitly among them all. I suppose you could say that Python has a complicated system of types, but isn't "strongly typed" ... especially since a lot of folks read "strongly" as "statically". --[[User:Fubar Obfusco|FOo]]
-----
[[User:Hfastedge|Hfastedge]] -- ''Please'' take more care when editing this article. Your point that Python is dynamically typed has already been integrated with the article and does not need to be repeated. A few of your other points were erroneous or misleading, which is why they were removed. Please take the time to understand this and do not simply add them again.
 
# Adding more examples showcasing different paradigms
Your statement that Python programs are "interpreted, not compiled" is simply false. Python -- like Java and Perl -- is a bytecode-compiled language. Compilation is implicit before execution of uncompiled scripts, which is why a new Python user might not have noticed its existence. However, it's there; it's how Python works; and yes, compiler errors are distinct from runtime errors. Compiled Python files have the extension <tt>.pyc</tt>, or <tt>.pyo</tt> if optimized. If you've never seen one, you haven't used Python for very long.
 
We could provide Python examples of list comprehensions, lambda functions, map, filter, reduce in a functional programming context.
Python is a dynamically typed language, because that is how it is ''designed.'' It is neither a mistake nor an accident. Talking about this as if it is something suitable to "change" with a "paradigm shift" is not talking about Python, it is talking about your opinion of dynamic vs. static typing.
 
# Show graph or data of Python popularity in relation to other languages
Your claims regarding "massive projects" vs. "rapid prototyping" are ill-advised in the light of the many massive projects that have been written quite successfully in dynamically typed languages (including Python). If you would like to discuss advantages and disadvantages that critics perceive in static and dynamic type-systems, you might want to do so on the pages for those subjects.
# Show examples of using performance optimization tools with Python like Numba, Cython, and PyPy
# Running experimental support for running in a free-threaded mode
 
[[User:MadHanSolo|MadHanSolo]] ([[User talk:MadHanSolo|talk]]) 18:23, 26 March 2025 (UTC)
In addition, I suggest strongly that you study the writing style of other Wikipedia articles, as it will help you to integrate your work more fully with an article. You might particularly want to watch your use of links -- introducing a link with "here is:" is rough ''anywhere'' on the Web. Namespaces are not created lightly. Also, needless indentation turning a Wiki document into a piece of flat text are not desirable. --[[User:Fubar Obfusco|FOo]]
: Hi {{ping|MadHanSolo}}. Please feel free to add if you think that makes sense. However, keep in mind that Wikipedia is not a [[WP:NOTHOWTO|Howto]] or a set or tutorials so if the code examples become too large, they are likely to get deleted. --[[User:McSly|McSly]] ([[User talk:McSly|talk]]) 18:34, 26 March 2025 (UTC)
:Hi @[[User:MadHanSolo|MadHanSolo]], I can work towards adding in a brief section of performance optimization taking into account the advice from @[[User:McSly|McSly]] about examples. I was briefly going to cover Just-In-Time Compilation, Static Compilation, Concurrency and Parallelism, and Efficient Data Structures. [[User:Chbeast|Chbeast]] ([[User talk:Chbeast|talk]]) 20:15, 29 March 2025 (UTC)
 
== Problems ==
----
 
1, Why does the programing language template doesn't use an [https://www.python.org/community/logos/ offical logo] of Python, like it [https://en.wikipedia.org/w/index.php?title=Python_(programming_language)&oldid=1299817513 did before]? [[User:Xzkdeng|Xzkdeng]] ([[User talk:Xzkdeng|talk]]) 08:51, 15 July 2025 (UTC)
:substantively?. Ok here: about the above stuff, theres no need for me to reply as I agree more of less with your changes. Although .pyc are simply compiled to bytecode, and python barely does any kind of optimization, so you really like to toot your own horn.
 
== "Batteries included" removed ==
:re the new, more relevant stuff, I feel that unit testing should be mentioned directly with the explanation of pythons type system, and that some points of the culture list should be included on the page.
[[User:Hfastedge|Hfastedge]] 09:05 18 Jun 2003 (UTC)
----
 
Because in the first reference that was given the term "batteries" doesn't show up anymore, and the second reference is a long-withdrawn PEP. [[User:Jae|jae]] ([[User talk:Jae|talk]]) 12:20, 17 July 2025 (UTC)
 
-----
A fine general article as the the features of Python, but (unless I'm to tired to notice it) there doesn't seem to be a mention of the uses of Python as a glue language, either with C/C++ using a SWIG interface or with Java in the form of Jython. The stuff about Python vs. Java, whilst being a fair enough comparison, maybe misleads into thinking that their use is in direct competition, whereas they can play complementary roles in development. I'd be tempted to make these comments but I'm (a) rather too new to wikipedia to chance it and (b) way too tired at the moment. But I think this stuff is worth mentioning. [[User:sobekhotep|sobekhotep]]
----
==Inheritance==
From what I read, Python has inheritance but no access control (public, private,...). Can someone ellaborate on OOP in Python? -- [[User:Error|Error]]
 
:Python has inheritance, including multiple inheritance. It has ''limited'' support for private variables using name mangling. See [http://www.python.org/doc/current/tut/node11.html#SECTION0011600000000000000000 the "Classes" section of the tutorial] for details.
 
:From the tutorial: ''As is true for modules, classes in Python do not put an absolute barrier between definition and user, but rather rely on the politeness of the user not to "break into the definition."''
 
:OOP doctrines such as the use of accessor methods to read data members are not enforced in Python. Just as Python offers [[functional programming]] constructs but does not attempt to demand referential transparency (contra [[Scheme programming language|Scheme]]), it offers (and extensively uses!) its object system but does not demand OOP behavior (contra [[Java programming language|Java]]). --[[User:Fubar Obfusco|FOo]] 04:58, 2 Sep 2003 (UTC)
----
==Collection types==
Python 2.3 now comes with an un-ordered collection type, the set.
I too will refrain from adding to the Python Wiki page as I cannot match the high standard of the article. - Paddy3118
 
----
 
Added link to [[Aspect oriented programming]] for the types of programming styles that Python offers. See [http://www.cs.tut.fi/~ask/aspects/aspects.html this article] or [http://www.google.com/search?q=aspect+programming+python&sourceid=mozilla-search&start=0&start=0&ie=utf-8&oe=utf-8 this] google search for support. [[Hyakugei]]