Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wishlist: iteration len()-type operator #3

Open
GoogleCodeExporter opened this issue Aug 22, 2015 · 4 comments
Open

Wishlist: iteration len()-type operator #3

GoogleCodeExporter opened this issue Aug 22, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

Rather than have an application provide an iterable list of objects (like,
say, 'changes') *and* a value like 'num_changes', it'd be right handy if
the template could simply ask for the length of the list in some way.

Original issue reported on code.google.com by cmpilato on 19 Dec 2008 at 6:57

@GoogleCodeExporter
Copy link
Author

Actually, right now, we don't allow an iterable -- just sequences. There was a 
patch
a while back (gotta dig out from my mailbox) to allow for iterables. If that 
happens,
then you would not necessarily be able to do a len() call (sequences have 
length;
iterables do not).

That said, there will need to be an error if you attempt to take the length of a
scalar, and that same error could be used for iterables.

Did you have an idea for the syntax?

Original comment by gstein on 19 Dec 2008 at 7:18

@GoogleCodeExporter
Copy link
Author

Oh. Idea for syntax. We had discussed .list-index at one point, noting that 
names
with a dash (not an underscore) would be reserved to ezt. Maybe the syntax 
could be:

  [foo.bar.list-len]

Other ideas?

Original comment by gstein on 19 Dec 2008 at 7:20

@GoogleCodeExporter
Copy link
Author

I'm glad you remembered our conversation about syntax, because I didn't. :-) 
"list-len" seems fine.

Original comment by cmpilato on 19 Dec 2008 at 7:54

@gstein
Copy link
Owner

gstein commented Aug 22, 2015

CC: @cmpilato

@gstein gstein self-assigned this Aug 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants