Skip to content
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

Test #2 compares different things #9

Open
marianosimone opened this issue Jan 3, 2015 · 0 comments
Open

Test #2 compares different things #9

marianosimone opened this issue Jan 3, 2015 · 0 comments

Comments

@marianosimone
Copy link

while

l.sort()

works in place (modifying the original list),

sorted(l)

returns a new list.

Even when in same cases is the same using one or the other, they are doing different things.

A fair comparison would be to replace the first way with:

def a():
    l = [0, 8, 6, 4, 2, 1, 3, 5, 7, 9]
    copy = list(l)
    copy.sort()
    return copy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant