[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: extension to string.gmatch (structural regular expressions)
- From: Norman Ramsey <nr@...>
- Date: Thu, 03 Jan 2008 16:33:28 -0500
> Yeah, that's one thing of two bigs things I miss in Lua coming from
> Python, list comprehensions and the str.split method.
> > If so, I would welcome the addition of a split()-like method ...
> I certainly would as well! I would suggest the syntax be the same as
> Python's: no argument/default -> whitespace ([ \t\r\n]+), else split
> by chars of each argument...
The default is great (spelt '%s+'), but I'd object pretty violently to
'split by chars'. I'd like to see 'split' cut a string into the exact
same pieces as 'gmatch', only to have split return exactly those
pieces that gmatch does not. This semantics minizes the additional
cognitive load on the poor user :-)