Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #89707
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Subject | Re: Rewriting to Python 3 |
| Date | 2015-05-01 17:56 +1000 |
| References | <87egn0rcc1.fsf@Equus.decebal.nl> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1.1430467011.3347.python-list@python.org> (permalink) |
Cecil Westerhof <Cecil@decebal.nl> writes:
> On my system I have:
> PARSER_RE_STR = '/(%s)=' % '|'.join(DN_LUT.keys() + DN_LUT.values())
> in:
> /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py
Are you in contact with the author of that third-party library? Why is
it in your Python 3.4 site-packages?
> In Python 3 that gives:
> TypeError: unsupported operand type(s) for +: 'dict_keys' and 'dict_values'
>
> How should I rewrite this?
My attempt:
PARSER_RE_STR = "/({keys}|{values})=".format(
keys=DN_LUT.keys(), values=DN_LUT.values())
Explicit is better than implicit, especially in mini-languages like
string interpolation.
--
\ “Often, the surest way to convey misinformation is to tell the |
`\ strict truth.” —Mark Twain, _Following the Equator_ |
_o__) |
Ben Finney
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Rewriting to Python 3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-01 09:22 +0200
Re: Rewriting to Python 3 Ben Finney <ben+python@benfinney.id.au> - 2015-05-01 17:56 +1000
Re: Rewriting to Python 3 Peter Otten <__peter__@web.de> - 2015-05-01 10:09 +0200
Re: Rewriting to Python 3 Chris Angelico <rosuav@gmail.com> - 2015-05-01 18:13 +1000
Re: Rewriting to Python 3 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-01 09:10 +0100
Re: Rewriting to Python 3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-01 16:41 +0200
Re: Rewriting to Python 3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-01 16:52 +0200
csiph-web