[Tutor] Chunking list/array data?

2019-08-22 Thread Sarah Hembree
How do you chunk data? We came up with the below snippet. It works (with integer list data) for our needs, but it seems so clunky. def _chunks(lst: list, size: int) -> list: return [lst[x:x+size] for x in range(0, len(lst), size)] What do you do? Also, what about doing this lazily so

[Tutor] __weakref__ question

2019-07-24 Thread Sarah Hembree
Can anyone provide some simple example/s or two or three of using weakref? I'm baffled and not seeing any documentation that is meaningful. My interest is to minimize memory usage (generally speaking, overall) and am wondering if this might help. --- We not only inherit the Earth from our Ancestor

[Tutor] Make a linked list subscriptable?

2019-07-11 Thread Sarah Hembree
How might I best make a linked list subscriptable? Below is skeleton code for a linked list (my actual is much more). I've done __iter__ and __next__ but I would like to be able to do start:stop:stride I just can't figure out how. Suggestions or just hints please? # -*- coding: utf8 -*- class N

Re: [Tutor] Syntax error

2016-01-07 Thread Sarah Rasco
d the file is definitely in there... [image: Inline image 4] On Thu, Jan 7, 2016 at 8:40 AM, Sarah Rasco wrote: > Hello, > > I'm new to programming and was told that Python would be a good language > to start with. I downloaded version 3.5.1, and I have Windows 10. > > In

[Tutor] Syntax error

2016-01-07 Thread Sarah Rasco
Hello, I'm new to programming and was told that Python would be a good language to start with. I downloaded version 3.5.1, and I have Windows 10. In IDLE, I typed print ("Hello, world!") and hit enter, and it returned the message. I saved the file as hello.py in C:\python. Then, when I tried to r

[Tutor] syntax error

2015-09-14 Thread Sarah
#x27;) main() I get the error File "", line 6 Thanks, Sarah ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] memory error files over 100MB

2009-03-10 Thread Harris, Sarah L
day, March 09, 2009 9:02 PM To: Harris, Sarah L Cc: tutor@python.org Subject: Re: [Tutor] memory error On Fri, Mar 6, 2009 at 5:03 PM, Harris, Sarah L wrote: > fname=filter(isfile, glob.glob('*.zip')) > for fname in fname: > zipnames=filter(isfile, glob.glob('*.zip

[Tutor] memory error

2009-03-06 Thread Harris, Sarah L
#x27;r') for zfilename in zf.namelist(): newFile=open(zfilename, 'wb') newFile.write(zf.read(zfilename)) newFile.close() zf.close() print 'done' Regards Sarah ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] image processing

2009-03-06 Thread Harris, Sarah L
Could someone please let me know where I can find 'lots' of examples of image processing using python? Particularly MODIS and ASTER examples. Any feedback will be greatly appreciated. Regards Sarah ___ Tutor maillist - Tutor@pytho