How do I get the length of a BucketListResultSet
amazon-s3, boto
Solution
The `BucketListResultSet` is a generator that handles any pagination for you behind the scenes. So, the only way to get the "length" of it would be to actually iterate over all of the results. One simple way to do that would be to use `list(l)` in your example. Note that this will be an expensive operation since it involves at least one (and possibly many) round trips to the S3 service.
Problem
Using boto.S3, what is the best way to get the total length of a BucketListResultSet? Do I really need to iterate through all of it? ``` from boto.s3.connection import S3Connection conn = S3Connection('XXX', 'YYYY') bucket = conn.get_bucket('myBucket') l = bucket.list('just/a/prefix/') ``` Here, `l` is a BucketListResultSet. How can I get the total number of objects in `l`?