bpo-34839: Add a 'before 3.6' in the section 'warnings' of doctest by matrixise · Pull Request #9736 · python/cpython

@matrixise

@matrixise

@matrixise matrixise changed the title Add a 'before 3.6' in the section 'warnings' of doctest bpo-34839: Add a 'before 3.6' in the section 'warnings' of doctest

Oct 6, 2018

vadmium

guarantee that the key-value pairs will be printed in any particular order, so a
test like ::
guarantee about output. For example, before Python 3.6, when printing a dict,
Python did not guarantee that the key-value pairs was printed in any

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plural: pairs were printed

@matrixise

@matrixise

tim-one

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As Raymond noted on BPO, it's still the case that nothing about the display order of sets is defined. So probably better to change the example to use a set of strings instead, and add a note about how the same kinds of things were required for dicts too before 3.6.

@matrixise

@matrixise

JulienPalard

guarantee that the key-value pairs will be printed in any particular order, so a
test like ::
guarantee about output. For example, when printing a set, Python doesn't
guarantee that the key is printed in any particular order, so a test like ::

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use elements in place of key, for members of a set.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concur with Julien. Members of a set are "elements"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rhettinger

guarantee that the key-value pairs will be printed in any particular order, so a
test like ::
guarantee about output. For example, when printing a set, Python doesn't
guarantee that the key is printed in any particular order, so a test like ::

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concur with Julien. Members of a set are "elements"

@matrixise

@matrixise

andreip

{"Hermione", "Harry"}

is vulnerable! One workaround is to do ::
was vulnerable! One workaround is to do ::

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe keep is here? Since sets are still unordered?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool thank you and fixed

@matrixise

@matrixise

Hi @rhettinger
I have fixed this PR, when you have time, could you check this PR?

Thank you,

Have a nice day,

@matrixise

@rhettinger once you will accept this PR, we could close the issue. ;-)

Thanks

JulienPalard

@matrixise

@miss-islington

Thanks @matrixise for the PR, and @JulienPalard for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Apr 12, 2019
…ythonGH-9736)

(cherry picked from commit 0522fd8)

Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>

@bedevere-bot

miss-islington added a commit that referenced this pull request

Apr 12, 2019
…H-9736)

(cherry picked from commit 0522fd8)

Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>