Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197649

Re: Python (was Re: Recent history of vi)

From Lawrence D’Oliveiro <ldo@nz.invalid>
Newsgroups comp.os.linux.misc, alt.folklore.computers, comp.lang.python
Subject Re: Python (was Re: Recent history of vi)
Date 2025-12-20 22:28 +0000
Organization A noiseless patient Spider
Message-ID <10i77u3$2aj53$2@dont-email.me> (permalink)
References (17 earlier) <wwvy0nma8fp.fsf@LkoBDZeT.terraraq.uk> <693d5437$0$2499$426a34cc@news.free.fr> <10hl622$jeli$11@dont-email.me> <slrn10kakjl.14g1t.candycanearter07@candydeb.host.invalid> <wwvzf7djwbi.fsf@LkoBDZeT.terraraq.uk>

Cross-posted to 3 groups.

Show all headers | View raw


On Sat, 20 Dec 2025 10:12:49 +0000, Richard Kettlewell wrote:

> Another property suggested in [1] for ‘strong typing’ is that
> functions can only be called with with arguments matching a declared
> type. In Python, function arguments do not have declared types[2]
> and does not even infer them; anything goes. You will only hit an
> exception if you try to use the arguments in the wrong way.

Python calls this “duck typing”. The called code expects the passed
objects to have certain members; so long as they have those, they can
be of any type. E.g. a function might be written to write to an output
file object, but anything passed that has a suitable “.write()” method
on it will work.

In other words, if it looks like a duck and quacks like a duck, then
it is acceptable in place of a duck.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: Python (was Re: Recent history of vi) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-14 02:05 +0000
  Re: Python (was Re: Recent history of vi) candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> - 2025-12-19 13:30 +0000
    Re: Python (was Re: Recent history of vi) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-19 20:58 +0000
      Re: Python (was Re: Recent history of vi) rbowman <bowman@montana.com> - 2025-12-20 05:48 +0000
    Re: Python (was Re: Recent history of vi) Richard Kettlewell <invalid@invalid.invalid> - 2025-12-20 10:12 +0000
      Re: Python (was Re: Recent history of vi) c186282 <c186282@nnada.net> - 2025-12-20 05:25 -0500
        Re: Python (was Re: Recent history of vi) rbowman <bowman@montana.com> - 2025-12-21 04:22 +0000
      Re: Python (was Re: Recent history of vi) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-20 22:28 +0000
      Re: Python (was Re: Recent history of vi) rbowman <bowman@montana.com> - 2025-12-21 04:25 +0000

csiph-web