VirtualView (for displaying large amount of items)
-
https://gist.github.com/049488b7584d47bf7ace
Sometime ago, @omz gave me some code as a starting point for making a virtual view. I basically tried to rework it into something more simpler for me to understand and use. I might have gone backwards on that point. Anyway, from time to time I have been going back to it.
I can use it as it is, for my purposes now, but really would like to make something robust enough that others could also use it. Conceptionally I personally think it's a great idea to have a VirtualView.
It's not finished, although it works.
I find myself going around in circles now. It's time to see if I can get some hard cold feedback.
If you do give some feedback, please don't sugar coat it. If you think the whole thing is crap and should be rewitten from scratch, please say that. I am not looking for any pats on the back, just looking for honest comments/suggestions. Is the only way I am going to get to a point were I can contribute something of any value.
I have put a gist link here. It's long, only because of comments :( I have not done a repo, just because I can't manage one yet.
-
Oops, 2^63.
It's ok, it's the largest number but other things break when I set the number of cells to sys.maxint
-
I am on a 32 bit box ;-) and you are on a 64 bit box... You forgot to save one bit for the sign...
import math ; mata.pow(2, 63)
.
-
Yes, but it's still good python is reporting the correct maxint. Well I am sure you are not surprised working with python on desktops, 99% of my python has been in pythonista.
I am not sure when I was 64bit all of a sudden. Maybe one of the last 2 minor iOS updates I guess. I know I wasn't before.
-
Oh, and check out https://github.com/studioimaginaire/phue for your hue lights. I know someone got it working but I can't find their post.
Search seems broken in the NodeBB? If I search 'phue', I get hits that do not contain 'phue' but I do not get the posts that I want. Is there a way to get literal hits like "
hue lights
" that ONLY give me results that contain that exact combination of letters?
-
@ccc , thanks. The link to phue lights is https://github.com/studioimaginaire/phue Is on the pythonista_tools site.
But I haven't tried to play with the hue lights for a reason up to now. I can imagine I would get caught up with them and limit my learning of my general python. I still have so far to go. So I am resisting the gadgets for the moment. I will look at the 64bit article. A bit strange, it's not like 64bit is a new idea.i had always thought apple were well placed for 64bit. But I will read and learn :)
-
Sorry @ccc. I didn't read your post correctly. You had the same link as me. But if I go through the pythonista_tools site, and look at the category 'the internet of things' the same link is there and it works. Strange.
-
@Phuket2 that might be because they changed the link in the HTML but not the display text? Try looking at the page source.
-
in python, the largest integer is not limited by maxint... try maxint**2 to confirm! it may be a good idea to stay below that number for speed though
-
Sys.maxint in an int but 2*sys.maxint is a long.
import sys # on a 32-bit machine... print(type(sys.maxint), sys.getsizeof(sys.maxint)) # (<type 'int'>, 12) print(type(sys.maxint*2), sys.getsizeof(sys.maxint*2)) # (<type 'long'>, 18) print(type(sys.maxint**2), sys.getsizeof(sys.maxint**2)) # (<type 'long'>, 22) print(type(float(0)), sys.getsizeof(float(0))) # (<type 'float'>, 16)
-
ahh, the largest integer, not largest int :). a
long
is an integer. since he was not instantiating an array that size, or passing the number to ctypes, etc, my point was he doesnt have to be limited to maxint. then again, it will take an awfullylong
time to scroll to the bottom of a few billion entries.
-
I am going back to a 16 bit system, life is easier :)
-
I'm sticking with 24 um I mean 31 er 64. :-)