Commit Graph

115 Commits

Author SHA1 Message Date
Divay Prakash
ef6dd28625
Merge pull request #3673 from laszlokiraly/patch-1
[python/en] don't overwrite list function
2020-01-11 14:04:25 +05:30
caminsha
49a7c2dd3b Fixed typo: uptil => until 2019-11-14 00:11:02 +01:00
Mariusz Skoneczko
2486fa8c1e [python3/en] Clarify difference between iterators and iterables in the last example (closes #3586) 2019-10-22 12:08:23 +11:00
László Király
898d9d43a3
don't overwrite list
problem:
assigning a list of animals to the list variable overwrites the list function, so that later in line 531 the list function is not available and raises a Type Error:
```
In [133]: list(filled_dict.keys())
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-133-a2c520b90051> in <module>
----> 1 list(filled_dict.keys())

TypeError: 'list' object is not callable
```
solution:
use another variable name instead of list
2019-10-04 10:25:57 +02:00
Divay Prakash
80096795e0 Fix explanation for slices 2019-09-24 10:17:02 +05:30
Ben Landry
77ab89a4b3 Added write to and read from a file syntax 2019-08-21 21:14:03 -04:00
Ben Landry
0b5245e2d8 [python3/en] Added enumerate function (#3601)
* Added enumerate function

* adjusted spacing
2019-08-13 16:05:13 +05:30
Ryota Kayanuma
a9a01e4fff Add output for python3 f-string. 2019-07-15 17:26:57 +09:00
Gaven Finch
08bd255df5
Update python3.html.markdown 2019-02-05 12:43:07 -07:00
Divay Prakash
f03d941d86
Merge pull request #3424 from EvilKhaosKat/patch-1
[python3/en] A note about common gotcha with mutable defaults
2018-12-21 00:13:42 +05:30
Nico Dinata
62926bd431 [python3/en] Add note about dictionary item ordering in Python 3.7+ (#3423)
* Add changes to dict item ordering in Python 3.7+
* Fix line length
* Fix typo in example
2018-12-21 00:12:35 +05:30
Roman Garanin
7bdc3d8f2f
[python3/en] A note about common gotcha with mutable defaults
A reminder to be aware of using mutable defaults.
Whether it is a real problem or not depends on exact use-case, but an update fully describing that and updating code with copying list, or defaulting with None and conditional initialization, would probably negatively affect readability of the example.
2018-12-19 22:09:29 +03:00
Divay Prakash
1fd955ae64
Merge pull request #3413 from nielsbom/patch-2
[python3/en] show chaining operators nicer
2018-12-01 10:00:58 +05:30
Niels Bom
609abd3328 [python3/en] show that True and False are ints (#3412)
* [python3/en] show that True and False are ints

* [python3/en] rework some boolean stuff

I removed the example `-5 != False != True #=> True` because we didn't cover chaining yet.
2018-12-01 09:59:58 +05:30
Niels Bom
4a891817ee
[python3/en] show chaining operators nicer 2018-11-30 11:52:37 +01:00
Divay Prakash
30cdf4b253
Fix tuple unpacking example in python3, closes #3130 (#3328) 2018-10-26 02:35:15 +05:30
Joseph G
56258dfb72
Add f-string clarification. 2018-10-11 14:10:16 -07:00
Roberto Fernandez Diaz
04de3a348a
Clarification about sets
I indicate that a set doesn't contain duplicate elements and add a little example
2018-08-07 11:01:04 +02:00
理絵子
b6aed7a0b3
added example for f-string
Literal string interpolation is new in python 3.6 [pep-0498](https://www.python.org/dev/peps/pep-0498/)
2018-07-29 11:53:33 +09:00
qzhangjhu
50f93a94d4
Corrections on Python3 page 2018-02-28 10:08:29 -05:00
Pratik Karki
1e88ceb05a
Merge pull request #3057 from ebzzry/fix-typo
[python3/en]: fix typo
2018-02-28 18:53:15 +05:45
Rommel Martinez
213019c689 [python3/en]: fix typo 2018-02-03 18:08:24 +08:00
Aswin Sanakan
3386171160
Fix omitting in list and clarified comments 2017-12-05 12:24:43 +05:30
Keith Miyake
55efb934b8 python3/en cleanup for single inheritance merge 2017-10-23 15:11:13 -07:00
Keith Miyake
9b6d84309c [python3/en] Add single inheritance section 2017-10-19 22:26:32 -07:00
Alfonso Millan
e78e41ce30 Update python3.html.markdown (#2776) 2017-06-29 10:36:01 +02:00
Ned Batchelder
9ccd1ee05a Some improvements to Python 3 (#2713) 2017-05-18 12:40:25 +02:00
Adam Bard
e901344c04 [Python] Slightly tweak ** example
2^4 == 4^2, 2^3 seems a bit less ambiguous as an example for exponentiation.
2017-04-05 12:02:35 -07:00
Ankush Aggarwal
82c3ce4e8c add underscore to property (#2691)
property is exposed using setter and getters
2017-03-28 10:21:18 +02:00
Andrew Lee
eba9d9ffe5 Updated mistake in Python3/en tutorial (#2678)
A fix on static method section (around line 728).
Specifically, i.grunt() should raise an error since grunt() is a static method and 'i' is an instance of the class.
2017-02-28 17:15:36 +01:00
lilhandsbgdreams
56a18f79cf [python3/en] Fix two "getter" output examples (#2658) 2017-02-16 09:41:16 +01:00
Adrian Sieber
870e2fbf6d Fix omitting end / beginning in ranges (#2649) 2017-02-10 08:58:10 +01:00
ghostduck
05e4c41cb3 [python3/en] Add examples to Bool operators with ints (#2639) 2017-01-28 10:38:26 +01:00
kakakaya
c701931fee [python3/en] fixed "StopIterator", no such Exception (#2591)
* [python3/en] Add empty tuple to "False if evaluated" list

* [python3/en] Fixed "StopIterator Exception" - no such exception
2016-12-03 11:46:32 +01:00
kakakaya
d0918b2576 [python3/en] Add empty tuple to "False if evaluated" list (#2587) 2016-11-30 13:01:27 +01:00
Foo Chuan Wei
e837e25a70 [python3/en] Edit python3 division (#2560)
The result of division is always a float.
e.g. 
35/5 = 7.0
10 / 3  = 3.3333333333333335
10.0 / 3  = 3.3333333333333335
10 / 3.0  = 3.3333333333333335
2016-11-09 19:16:06 +01:00
Harry Moreno
e68bf145bc Add python3 class notes (#2479)
* explain that you can place the human and bat classes into seperate
files
* explain how to import specific functions from other files
2016-10-20 23:08:44 +02:00
Srinivas Gorur-Shandilya
8905c0c5bc [python3] updated docs on division for python3 (#2473)
* updated docs on division for python3

prev. docs were confusing, did not show how to actually divide.

* modified language about python division

* fixed grammar
2016-10-20 15:57:55 +02:00
ven
5bebeff0c3 Update python3.html.markdown 2016-10-04 15:40:48 +02:00
Subhrajyoti Sen
048163b7bf Update python3.html.markdown (#2381) 2016-09-21 17:07:24 +02:00
Patrick Callahan
2067ad6a52 [Eng/Python3] add new book: "Learn Python 3.0 VISUALLY" (#2360)
* add new book

* sanitized link
2016-09-06 18:57:47 +02:00
PhoenixYip
48ca03c3f9 correction for the set comprehension in py3 (#2358) 2016-09-06 10:38:47 +02:00
Patrick Callahan
7beaa529b9 [python3/en] Adding "Dive Into Python 3" (#2353)
The previous version of this file had the original Dive Into Python, which was written with Python 2 in mind.
It has come to my attention that the author of the original has published an updated version designed for Python 3, so I added this version back in.
2016-09-01 23:27:33 +02:00
Patrick Callahan
678fa3b974 Remove Python 2 resources from Python 3 page (#2350)
There were several resources here that teach Python 2, but not Python 3. I removed them so that a reader will only see resources that apply to Python 3.
2016-09-01 08:28:23 +02:00
J. Ryan Rembert
e053806775 [python/en] Set, dict, and generator comprehensions (#2298)
* Add set and dict comprehensions for python 2 and 3

* Clean up formatting and generator explanation

* Include documentation for generator comprehensions
2016-07-03 10:47:57 +02:00
Alexandre Constantino
e72c849556 Python3/en: multiple inheritance (#2217)
* Add __name__ check to make testing easier

* Update say to call print. Add more usage examples

* Move Modules section before Classes

Makes more sense for when explaining inheritance

* Add multiple inheritance example

* Add examples for multiple inheritance

* Add instance check examples

* Fix multiple inheritance example

* Add note on the __name__ variable
2016-06-26 15:22:47 +02:00
ven
5affe64801 String length by #1742 2016-06-16 15:19:43 +02:00
Adam Bard
f75cb997b0 Update python3.html.markdown
Remove TODO
2016-03-30 13:04:32 -07:00
Alfredo Canziani
6248cd1f84 Update python3.html.markdown
The same happens for `filter`.
```pythob
filter(lambda x: x > 5, [3, 4, 5, 6, 7])
<filter at 0x110567320>
list(filter(lambda x: x > 5, [3, 4, 5, 6, 7]))
[6, 7]
```
2016-03-30 11:24:05 -04:00
Alfredo Canziani
9dca295c05 Update python3.html.markdown
`map` requires `list` in order to convert the mapping to its list. E.g. `<map at 0x11057ce48>` to `[11, 12, 13]`.
2016-03-30 11:17:12 -04:00