[issue46974] set function for lists on numbers, sometimes sorts elements from smallest to largest, and sometimes not

2022-03-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

This is expected behavior. A set has no defined order. If you convert a set to 
a list, and you want some specific order, you'll need to sort it yourself.

--
nosy: +eric.smith
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46974] set function for lists on numbers, sometimes sorts elements from smallest to largest, and sometimes not

2022-03-10 Thread PiTeR


New submission from PiTeR :

set function for lists on numbers, sometimes sorts elements from smallest to 
largest, and sometimes not
to find this bug, sometimes you need to display the result several times
example code:
def tupla():
import random
ilosc = random.randint(0,49)
n=0
lista=[]
i=0
while True:
n = random.randint(1,100)
lista.append(n)
i=i+1
if i==ilosc-1:
break
lista = set(lista)
list(lista)
print(lista)

--
components: Windows
files: bug_1.PNG
messages: 414848
nosy: paul.moore, pio.paluchowski, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: set function for lists on numbers, sometimes sorts elements from 
smallest to largest, and sometimes not
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file50666/bug_1.PNG

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com