Rivka Miller wrote:
> I am looking for a regexp for a string not at the beginning of the
> line.
>
> For example, I want to find $hello$ that does not occur at the
> beginning of the string, ie all $hello$ that exclude ^$hello$.
The begging of the string is zero width character. So you could use
n
Larry.Mart wrote:
> Since there are duplicates, I can't use a dict. And if I have any
> extraneous data in the keys (i.e. something to make them unique) then
> I still have to walk through the entire dict to find the matches.
You can use slightly different approach. With double mapping you could
Andre Majorel wrote:
> Is there a way to keep the definitions of the high-level
> functions at the top of the source ? I don't see a way to
> declare a function in Python.
I am not a Python developer, but Pythonic way of definition not
declaration is definitely interesting. Languages with variabl
Hi all,
I am beginner in Python. What is interesting for me is that Python
interpreter treats in different way dot and square bracket notations.
I am coming from JavaScript where both notations lead prototype chain
lookup.
In Python it seems square bracket and dot notations lead lookup in
differen
Francesco Bochicchio wrote:
> User classes - that is the ones you define with the class statement -
> can implement support for the squared bracket and
> dot notations:
> - the expression myinstance[index] is sort of translated into of
> myinstance.__getitem__(index)
> - the expression myinsta
Terry Reedy wrote:
> Right. d.items is a dict method. d['items'] is whatever you assign.
> Named tuples in the collections modules, which allow access to fields
> through .name as well as [index], have the name class problem. All the
> methods are therefore given leading underscore names to avoid
Steve Crook wrote:
> Whilst certainly more compact, I'd be interested in views on how
> pythonesque this method is.
Instead of calling function you could use:
d = {}
d[key] = (key in d and d[key]) + 1
Regards.
--
http://mail.python.org/mailman/listinfo/python-list
Chris Angelico wrote:
> I've just spent a day coding in Javascript, and wishing browsers
> supported Python instead (or as well). All I needed to do was take two
> dates (as strings), figure out the difference in days, add that many
> days to both dates, and put the results back into DOM Input obj