<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 28.02.2017 18:18, David Mertz wrote:<br>
<blockquote
cite="mid:CAEbHw4bQXMSYvP=7+qBO7BNkWW7RcYp5-ovJMqGJ1C1mhgV8HA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote"><br>
<div>Yes, and easily written as above. What significant
advantage would it have to spell the above as:</div>
<div><br>
</div>
<div> x = alist.get(pos, default_val)</div>
<div><br>
</div>
<div>It's a couple characters shorter in the proposed
version. I guess I'll concede that needing the odd
indexing at the end to get the scalar is slightly ugly.</div>
</div>
</div>
</div>
</blockquote>
<br>
1. advantage: it looks like dict access -> allows duck typing (oh
how often I'd missed that)<br>
2. advantage: no try except<br>
3. advantage: no weird workaround with slices and additional item
access<br>
<br>
<br>
Thanks for bringing this up, Michel. First point would be most
important to me.<br>
<br>
<br>
Sven<br>
</body>
</html>