When calling iterdir() on an empty S3Path object, a single path is still returned. This differs from the pathlib.Path behavior where iterdir() on an empty Path is an empty generator.
Example:
from s3path import S3Path
from pathlib import Path
s3p = S3Path("/path/to/empty/s3dir/")
p = Path("/path/to/empty/dir")
for child in s3p.iterdir():
print(child) # prints /path/to/empty/s3dir/
for child in p.iterdir():
print(child) # never prints
When calling
iterdir()
on an emptyS3Path
object, a single path is still returned. This differs from thepathlib.Path
behavior whereiterdir()
on an emptyPath
is an empty generator.Example: