[Python-il] [pyweb-il:1072] Python coding question

Dov Grobgeld dov.grobgeld at gmail.com
Wed Jul 7 17:38:31 IDT 2010

The choice of symbols was pretty fast and arbitrary just to get the idea
across. If someone where to undertake a real "unicodification" of python,
I'm sure there are better choices for the various symbols.

The choices of 〈〉for function calls and ∘ for method specification was used
to illustrate that with enough symbols there is no more the need for
overloading them. Parentheses used for changing the order of operator
precedence is a something different from parentheses used to enclose
arguments in a function/method call.

Likewise the choice of ∀ which is named forall. I made the mental switch to
the foreach of perl which is a synonym of for (in some context). I did not
reflect especially on the mathematical/parallellism implications.

The thing is that making single characters for all operators would make the
program look more compact. The learning curve might be slightly higher
(including learning how to use the keyboard), but most people spend much
more time using a computer language than learning the language. So it is
worth creating something which has that kind of beauty to it.

Thinking about it, it would be easy to a language  "Punithon" as a
preprocessor that would implement such a syntax and output python. But
again, I dare anyone to be crazy enough to do it. :-)


On Wed, Jul 7, 2010 at 17:01, Shai Berger <shai at platonix.com> wrote:

> On Wednesday 07 July 2010, Gabor Szabo wrote:
> > Hi,
> >
> > > On Thu, Jul 1, 2010 at 5:35 PM, Dov Grobgeld <dov.grobgeld at gmail.com>
> wrote:
> > >>
> > >> Then "python" might look like:
> > >>
> > >>     ∀ n ∈ names:
> > >>       if n ≠ "foo":
> > >>         α ← n
> > >>         ß = re∘search〈"foo", α〉
> > >>
> >
> > I have not done any math for a long, long time. Would you mind explaining
> > what would the above do?
> >
> To complement Haran's reply, the translation of the above exposes why this
> wouldn't necessarily be a good idea:
> for n in names:
>        if n != "foo":
>                a = n
>                b = re.search("foo",a)
> But the differences matter:
> Dov chooses to use the function composition operator ∘ for attribute
> access;
> to me, this makes little sense, but perhaps I'm missing something.
> Why he avoids the use of parentheses for function application also escapes
> me.
> But most importantly, the use of ∀ (for all) in the loop construct implies
> parallelism, or, more accurately, independence between the code applied to
> each member of the set -- where Python forces an order and allows
> dependencies.
> I haven't been in academia for quite some time, but as far as I recall,
> people
> only used ∀ when defining conditions (e.g, """ ∀ n ∈ names: n ≠ "foo" """
> as a
> boolean expression) using read-only operations; when state-modifying
> iteration
> was intended, people tended to use "for".
> My 2 cents,
>         Shai.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://hamakor.org.il/pipermail/python-il/attachments/20100707/703ae484/attachment.htm 

More information about the Python-il mailing list