Skip to content

Commit 29a64a4

Browse files
authored
Remove Python 2 references from the track (#3437)
* Remove Python 2 references from the track * Revert unintentional whitespace changes to test files [no important files changed]
1 parent 5bb5959 commit 29a64a4

File tree

11 files changed

+9
-22
lines changed

11 files changed

+9
-22
lines changed

concepts/comparisons/about.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ False
8282
Strings (`str`) are compared [_lexicographically_][lexographic order], using their individual Unicode code points (_the result of passing each code point in the `str` to the built-in function [`ord()`][ord], which returns an `int`_).
8383
If all code points in both strings match and are _**in the same order**_, the two strings are considered equal.
8484
This comparison is done in a 'pair-wise' fashion - first-to-first, second-to-second, etc.
85-
Unlike in Python 2.x, in Python 3.x, `str` and `bytes` cannot be directly coerced/compared.
85+
In Python 3.x, `str` and `bytes` cannot be directly coerced/compared.
8686

8787
```python
8888
>>> 'Python' > 'Rust'

concepts/string-formatting/about.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Use of the `%` operator for formatting is the oldest method of string formatting
149149
It comes from the C language and allows the use of positional arguments to build a `str`.
150150

151151
This method has been superseded by both `f-strings` and `str.format()`, which is why the nickname for `%` formatting is _'Old Style'_.
152-
It can be still found in python 2 and/or legacy code.
152+
It can be still found in Python 2 and/or legacy code.
153153
While using this method will work in Python 3.x, `%` formatting is usually avoided because it can be error-prone, is less efficient, has fewer options available, and any placeholder-argument mismatch can raise an exception.
154154
Using the `%` operator is similar to [`printf()`][printf-style-docs], so it is also sometimes called _printf formatting_.
155155

docs/ABOUT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The [zen of Python (PEP 20)][the zen of python] and [What is Pythonic?][what is
2222

2323
Tests and tooling for this track currently support `3.7` - `3.10.6` (_tests_) and [`Python 3.11`][311-new-features] (_tooling_).
2424
It is highly recommended that students upgrade to at least `Python 3.8`, as some features used by this track may not be supported in earlier versions.
25-
That being said, most of the exercises will work with `Python 3.6+`, and many are compatible with `Python 2.7+`.
25+
That being said, most of the exercises will work with `Python 3.6+`.
2626
But we don't guarantee support for versions not listed under [Active Python Releases][active-python-releases].
2727
We will try to note when a feature is only available in a certain version.
2828

docs/INSTALLATION.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Real Python also offers a [nice guide][helpful guide] to installation on various
66
Finally, these posts by Brett Cannon [A quick-and-dirty guide][quick-and-dirty] and [Why you should use `python -m pip`][python-m-pip], give very helpful advice on how to manage Python installations and packages.
77

88
**Note for MacOS users:** prior to MacOS Monterey (12.3), `Python 2.7` came pre-installed with the operating system.
9-
Using `Python 2.7` with Exercism or most other programs is not recommended.
9+
Using `Python 2.7` with Exercism or most other programs is not supported.
1010
You should instead install [Python 3][Python-three downloads] via one of the methods detailed below.
1111
As of MacOS Monterey (12.3), no version of Python will be pre-installed via MacOS.
1212

@@ -20,7 +20,7 @@ Some quick links into the documentation by operating system:
2020

2121
Exercism tests and tooling currently support `3.7` - `3.10.6` (_tests_) and [`Python 3.11`][311-new-features] (_tooling_).
2222
Exceptions to this support are noted where they occur.
23-
Most of the exercises will work with `Python 3.6+`, and many are compatible with `Python 2.7+`.
23+
Most of the exercises will work with `Python 3.6+`.
2424
But we don't guarantee support for versions not listed under [Active Python Releases][active-python-releases].
2525

2626

exercises/concept/black-jack/.docs/introduction.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ False
8080
Unlike numbers, strings (`str`) are compared [_lexicographically_][lexographic order], using their individual Unicode code points (_the result of passing each code point in the `str` to the built-in function [`ord()`][ord], which returns an `int`_).
8181
If all code points in both strings match and are _**in the same order**_, the two strings are considered equal.
8282
This comparison is done in a 'pair-wise' fashion - first-to-first, second-to-second, etc.
83-
Unlike in Python 2.x, in Python 3.x, `str` and `bytes` cannot be directly coerced/compared.
83+
In Python 3.x, `str` and `bytes` cannot be directly coerced/compared.
8484

8585
```python
8686
>>> 'Python' > 'Rust'

exercises/practice/circular-buffer/.meta/example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __init__(self, capacity):
2525
self.read_point = 0
2626
self.write_point = 0
2727

28-
# (protected) helper method to support python 2/3
28+
# (protected) helper method
2929
def _update_buffer(self, data):
3030
try:
3131
self.buffer[self.write_point] = data

exercises/practice/pythagorean-triplet/.meta/template.j2

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
{{ macros.header() }}
44

5-
# Python 2/3 compatibility
6-
if not hasattr(unittest.TestCase, 'assertCountEqual'):
7-
unittest.TestCase.assertCountEqual = unittest.TestCase.assertItemsEqual
85

96
class {{ exercise | camel_case }}Test(unittest.TestCase):
107
{% for case in cases -%}

exercises/practice/pythagorean-triplet/pythagorean_triplet_test.py

-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66

77
# Tests adapted from `problem-specifications//canonical-data.json`
88

9-
# Python 2/3 compatibility
10-
if not hasattr(unittest.TestCase, "assertCountEqual"):
11-
unittest.TestCase.assertCountEqual = unittest.TestCase.assertItemsEqual
12-
139

1410
class PythagoreanTripletTest(unittest.TestCase):
1511
def test_triplets_whose_sum_is_12(self):

exercises/practice/sublist/sublist.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""
22
This exercise stub and the test suite contain several enumerated constants.
33
4-
Since Python 2 does not have the enum module, the idiomatic way to write
5-
enumerated constants has traditionally been a NAME assigned to an arbitrary,
4+
Enumerated constants can be done with a NAME assigned to an arbitrary,
65
but unique value. An integer is traditionally used because it’s memory
76
efficient.
87
It is a common practice to export both constants and functions that work with

pylintrc

-5
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,6 @@ known-standard-library=
341341
# Force import order to recognize a module as part of a third party library.
342342
known-third-party=enchant, absl
343343

344-
# Analyse import fallback blocks. This can be used to support both Python 2 and
345-
# 3 compatible code, which means that the block might have code that exists
346-
# only in one or another interpreter, leading to false positives when analysed.
347-
analyse-fallback-blocks=no
348-
349344

350345
[CLASSES]
351346

reference/exercise-concepts/rna-transcription.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Example implementation
44

5-
Modified from the existing [example.py](https://github.com/exercism/python/blob/master/exercises/rna-transcription/example.py) to remove Python 2 compatiblity noise:
5+
Taken from the existing [example.py](https://github.com/exercism/python/blob/main/exercises/practice/rna-transcription/.meta/example.py):
66

77
```python
88
DNA_TO_RNA = str.maketrans("AGCT", "UCGA")

0 commit comments

Comments
 (0)