{"action":"created","issue":{"url":"https://api.github.com/repos/construct/construct/issues/293","repository_url":"https://api.github.com/repos/construct/construct","labels_url":"https://api.github.com/repos/construct/construct/issues/293/labels{/name}","comments_url":"https://api.github.com/repos/construct/construct/issues/293/comments","events_url":"https://api.github.com/repos/construct/construct/issues/293/events","html_url":"https://github.com/construct/construct/issues/293","id":199545766,"number":293,"title":"LazySequence problems","user":{"login":"pohmelie","id":2385765,"avatar_url":"https://avatars.githubusercontent.com/u/2385765?v=3","gravatar_id":"","url":"https://api.github.com/users/pohmelie","html_url":"https://github.com/pohmelie","followers_url":"https://api.github.com/users/pohmelie/followers","following_url":"https://api.github.com/users/pohmelie/following{/other_user}","gists_url":"https://api.github.com/users/pohmelie/gists{/gist_id}","starred_url":"https://api.github.com/users/pohmelie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pohmelie/subscriptions","organizations_url":"https://api.github.com/users/pohmelie/orgs","repos_url":"https://api.github.com/users/pohmelie/repos","events_url":"https://api.github.com/users/pohmelie/events{/privacy}","received_events_url":"https://api.github.com/users/pohmelie/received_events","type":"User","site_admin":false},"labels":[{"id":440735494,"url":"https://api.github.com/repos/construct/construct/labels/question","name":"question","color":"1d76db","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-01-09T12:55:13Z","updated_at":"2017-02-25T16:12:47Z","closed_at":null,"body":"Can't get how to work with `LazySequence`\r\n``` python\r\n>>> from construct import *\r\n>>> s = LazySequence(Struct(\"foo\" / Int8ul))\r\n>>> s\r\n<LazySequence: None>\r\n>>> f = open(\"bar.bin\", \"rb\")\r\n>>> s.parse_stream(f)\r\n<LazySequenceContainer: 1 possible items, 0 cached>\r\n>>> x = _\r\n>>> x\r\n<LazySequenceContainer: 1 possible items, 0 cached>\r\n>>> for i in x: print(x)\r\n... \r\nListContainer: \r\n    Container: \r\n        foo = 212\r\n>>> \r\n```\r\nHow to iterate over lazy sequence? I want this to work with big file with repeated structures. Right now I'm just `parse_stream` in loop, but this looks dirty a bit."},"comment":{"url":"https://api.github.com/repos/construct/construct/issues/comments/282493721","html_url":"https://github.com/construct/construct/issues/293#issuecomment-282493721","issue_url":"https://api.github.com/repos/construct/construct/issues/293","id":282493721,"user":{"login":"pohmelie","id":2385765,"avatar_url":"https://avatars.githubusercontent.com/u/2385765?v=3","gravatar_id":"","url":"https://api.github.com/users/pohmelie","html_url":"https://github.com/pohmelie","followers_url":"https://api.github.com/users/pohmelie/followers","following_url":"https://api.github.com/users/pohmelie/following{/other_user}","gists_url":"https://api.github.com/users/pohmelie/gists{/gist_id}","starred_url":"https://api.github.com/users/pohmelie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pohmelie/subscriptions","organizations_url":"https://api.github.com/users/pohmelie/orgs","repos_url":"https://api.github.com/users/pohmelie/repos","events_url":"https://api.github.com/users/pohmelie/events{/privacy}","received_events_url":"https://api.github.com/users/pohmelie/received_events","type":"User","site_admin":false},"created_at":"2017-02-25T16:12:47Z","updated_at":"2017-02-25T16:12:47Z","body":"@arekbulski \r\nThis works, thanks. The only 'bad' thing is `sys.maxsize`, since if stream is pretty big/long (from network, for example) it definitely will become bigger, that `sys.maxsize`. So, two points here:\r\n* Make possible infinite range for `LazyRange`\r\n* Make `LazyGreedyRange` alias.\r\nWhat do you think? "}}
{"actor":{"display_login":"pohmelie"}}