Skip to content

CONTRIBUTING: Drop Python 2 requirement #4713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -136,22 +136,6 @@ make sure logging in Scapy remains helpful.
- If you are working on Scapy's core, you may use: `scapy.error.log_loading`
only while Scapy is loading, to display import errors for instance.


### Python 2 and 3 compatibility

The project aims to provide code that works both on Python 2 and Python 3. Therefore, some rules need to be applied to achieve compatibility:

- byte-string must be defined as `b"\x00\x01\x02"`
- exceptions must comply with the new Python 3 format: `except SomeError as e:`
- lambdas must be written using a single argument when using tuples: use `lambda x, y: x + f(y)` instead of `lambda (x, y): x + f(y)`.
- use int instead of long
- use list comprehension instead of map() and filter()
- `__bool__ = __nonzero__` must be used when declaring `__nonzero__` methods
- `__next__ = next` must be used when declaring `next` methods in iterators
- `StopIteration` must NOT be used in generators (but it can still be used in iterators)
- `io.BytesIO` must be used instead of `StringIO` when using bytes
- `__cmp__` must not be used.

### Code review

Maintainers tend to be picky, and you might feel frustrated that your