On Mon, May 17, 2021 at 08:31:17AM -0000, Shreyan Avigyan wrote:

> Range here means that a range or a list. Of What? A list between two 
> numbers, characters, etc. Python interprets numbers, characters as a 
> kind of PyObject. Yes it makes sense to have ranges of int and str but 
> not for others. It doesn't make sense to have ranges for some and not 
> for others. And as you demonstrated there's a current approach to use 
> <= x <= to have ranges only for the required types. The current 
> approach is very good.

I'm sorry, I cannot decipher what you mean here. I can't tell whether 
you are talking about element containment (the `in` operator) or range 
checking in the sense of `low <= value <= high`.

I thought you were talking about classical range checking but then you 
mentioned lists and you confused me.

Especially the comment about "a kind of PyObject" -- all values in 
Python are objects, so I don't understand why you mention it.

Can you explain what happens if you try to match the value 15 against 
the following "ranges" (match or no match) please?

1. range(2, 20)

3. [2, 20]

3. [2, 20, 15]

4. [None, 'hello']

Now how about the value 12.5 -- will that match?



-- 
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/S2URYZSBV5L4MTCAM5PQCWYVZ7OZHX2Z/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to