Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50814
| References | <mailman.23559.1374105603.3113.python-list@python.org> |
|---|---|
| From | Ben Last <ben@benlast.com> |
| Date | 2013-07-18 09:29 +0800 |
| Subject | Re: Python-list Digest, Vol 118, Issue 144 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4819.1374110968.3114.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
> From: Gregory Ewing <greg.ewing@canterbury.ac.nz>
> To: python-list@python.org
> Is 'dash' the same as 'literal("-")'?
>
Yes, it's a convenience method, like 'dot' and 'underscore'. The code I
pasted is from the unit tests, where I use the different methods to push
coverage up.
> Is there any difference between 'then' and 'followed_by'?
>
Nope, they're synonyms. Same as 'zero_or_more' is the same as
'any_number_of', or 'digit' is the same as 'digits'.
Why do some things have __ in front of them? Is there a
> difference between 'literal' and '__literal'?
>
Er... looks like a garblement in my post! There are no __ in my original
:( It should be:
north_american_number_re = (RE().start
.literal('(').followed_by.exactly(3).digits.then.literal(')')
.then.one.literal("-").then.exactly(3).digits
.then.one.dash.followed_by.exactly(4).digits.then.end
.as_string())
Thanks for the comments!
Cheers
b
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Python-list Digest, Vol 118, Issue 144 Ben Last <ben@benlast.com> - 2013-07-18 09:29 +0800
csiph-web