From: Eero Saynatkari Date: 2006-09-28T14:13:18+09:00 Subject: Re: Is object[x](y,z) always invalid? --mFHiwr52TKrxpkjc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2006.09.28 12:55, Ken Bloom wrote: > On Thu, 28 Sep 2006 10:18:14 +0900, Alex Gutteridge wrote: >=20 > > I'm working on converting a Python module (RPy) to Ruby and am trying = =20 > > to keep the api as close to the original as possible. In Python it =20 > > (appears - my Python is very weak) that this is valid syntax: > >=20 > > foo[x](y,z) =2E.. > > foo[x].call(y,z) > >=20 > > is another option, but goes still further from the Python api. Not a = =20 > > big problem for sure, but I just wanted to make sure there wasn't =20 > > some magic trick I was missing to make the original Python ('foo[x]=20 > > (y,z)') also valid Ruby. >=20 > foo[x].call(y,z) may be further from the original python syntax, but it's > ruby's standard syntax for doing this, as exemplified by Proc objects and > Method objects. Given the philosophy of duck typing, I don't advise > trying to depart from this convention. I would go so far as saying that the standard Ruby syntax for this is foo.x y, z --mFHiwr52TKrxpkjc Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFG1l67Nh7RM4TrhIRAp1mAKCfK5/U5dl+AoK0l0fwJoMxo7wBxACdH026 bHpqkr2DReNC9mefTnlgxsI= =GrRU -----END PGP SIGNATURE----- --mFHiwr52TKrxpkjc--