Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
Convert '165.0' to int
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Chris Angelico, post: 4231259"] Clarification: This is faster if and only if you don't actually need it as a list. In spite of the variable name, it's NOT a list, and you can't index it (eg you can't work with list_of_integers[7]). However, you can iterate over it to work with the integers in sequence, and for that specific (and very common) use, it will be faster and use less memory than actually creating the list. It's also going to be a LOT faster than creating the list, if you only need a few from the beginning of it; the generator evaluates lazily. Personally, I'd just create a tiny function and use that, as has been suggested. ChrisA [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
Convert '165.0' to int
Top