Python is Considered Harmful

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christos TZOTZIOY Georgiou

    #16
    Re: Python is Considered Harmful

    On Mon, 27 Oct 2003 19:39:40 +0100, rumours say that "Jegenye 2001 Bt"
    <jegenye2001@fw .hu> might have written:
    [color=blue]
    >Thank you, Alex, for clarifing this issue for me..
    >
    >So this was actually like the famous equation
    >"9*6=42"
    >:-)[/color]

    Nope, the left part of the equation is yet to be defined.
    --
    TZOTZIOY, I speak England very best,
    Ils sont fous ces Redmontains! --Harddix

    Comment

    • Alex Martelli

      #17
      Re: Python is Considered Harmful

      Jegenye 2001 Bt wrote:
      [color=blue]
      > Thank you, Alex, for clarifing this issue for me..
      >
      > So this was actually like the famous equation
      > "9*6=42"
      > :-)
      > It is correct (or incorrect) if you look at it in the right (or wrong)
      > way.[/color]

      Do you mean, implicitly using base 13? I know of no programming
      language that lets you set the number base to be used for literals
      (except presumably ones with particularly 'powerful' macros...?-)
      and I hope I never have to contend with one.


      Alex

      Comment

      • Justin Pearson

        #18
        Re: Python is Considered Harmful

        Alex Martelli <aleax@aleax.it > writes:
        [color=blue]
        >
        > Do you mean, implicitly using base 13? I know of no programming
        > language that lets you set the number base to be used for literals[/color]
        Forth.[color=blue]
        > (except presumably ones with particularly 'powerful' macros...?-)[/color]

        [color=blue]
        > and I hope I never have to contend with one.
        >[/color]
        You might be lucky :-).

        /Justin
        [color=blue]
        >
        > Alex
        >[/color]

        --

        Comment

        • Heather Coppersmith

          #19
          Re: Python is Considered Harmful

          On Tue, 28 Oct 2003 11:35:25 GMT,
          Alex Martelli <aleax@aleax.it > wrote:
          [color=blue]
          > Do you mean, implicitly using base 13? I know of no programming
          > language that lets you set the number base to be used for
          > literals (except presumably ones with particularly 'powerful'
          > macros...?-) and I hope I never have to contend with one.[/color]

          Lisp, through the variable *read-base*. It's handy if you already
          have data (e.g., in a file generated by someone else) in a non-10
          base.

          Regards,
          Heather

          --
          Heather Coppersmith
          That's not right; that's not even wrong. -- Wolfgang Pauli

          Comment

          • Alex Martelli

            #20
            Re: Python is Considered Harmful

            Justin Pearson wrote:
            [color=blue]
            > Alex Martelli <aleax@aleax.it > writes:
            >[color=green]
            >>
            >> Do you mean, implicitly using base 13? I know of no programming
            >> language that lets you set the number base to be used for literals[/color]
            > Forth.[color=green]
            >> (except presumably ones with particularly 'powerful' macros...?-)[/color]
            >
            >[color=green]
            >> and I hope I never have to contend with one.
            >>[/color]
            > You might be lucky :-).[/color]

            Actually, I did work in Forth (it was the in-ROM language of a
            neat computer I once bought, called "Jupiter ACE"; and also of a
            special-purpose image processing PC card I once used at work),
            but never came across that "feature" (assuming those dialects of
            Forth in those ROMs supported it, that is). Guess I was lucky
            that in those special cases I wasn't sharing code w/others:-).


            Alex

            Comment

            • Jerzy Karczmarczuk

              #21
              Re: Python is Considered Harmful

              Alex Martelli wrote:[color=blue]
              > Jegenye 2001 Bt wrote:[/color]
              [color=blue][color=green]
              >>So this was actually like the famous equation
              >>"9*6=42"
              >>:-)
              >>It is correct (or incorrect) if you look at it in the right (or wrong)
              >>way.[/color]
              >[/color]
              [color=blue]
              > Do you mean, implicitly using base 13? I know of no programming
              > language that lets you set the number base to be used for literals
              > (except presumably ones with particularly 'powerful' macros...?-)
              > and I hope I never have to contend with one.[/color]

              In Icon you can write 13r9 * 13r6. Icon is a decent, although weakly known
              language, without any "particular ly 'powerful' macros", which permits to
              choose the base of literals. Nothing horrible.


              Jerzy Karczmarczuk

              Comment

              • Alex Martelli

                #22
                Re: Python is Considered Harmful

                Jerzy Karczmarczuk wrote:
                [color=blue]
                > Alex Martelli wrote:[color=green]
                >> Jegenye 2001 Bt wrote:[/color]
                >[color=green][color=darkred]
                >>>So this was actually like the famous equation
                >>>"9*6=42"[/color][/color][/color]
                ...[color=blue][color=green]
                >> Do you mean, implicitly using base 13? I know of no programming[/color][/color]
                ...[color=blue]
                > In Icon you can write 13r9 * 13r6. Icon is a decent, although weakly known
                > language, without any "particular ly 'powerful' macros", which permits to
                > choose the base of literals. Nothing horrible.[/color]

                Yes, I used to love Icon (the coroutines and backtracking and all, cool!)
                but notice it uses EXPLICIT indications of non-10 base. There is, indeed,
                nothing at all horrible with that.

                Besides, the problem is not with 9 or 6, which happen to have the same
                value in either base 10 or 13:-). The problem is with that result...:)


                Alex

                Comment

                • Stefan Axelsson

                  #23
                  Re: Python is Considered Harmful

                  In article <yjvnb.367268$R 32.12107331@new s2.tin.it>, Alex Martelli wrote:[color=blue]
                  >
                  > Actually, I did work in Forth (it was the in-ROM language of a
                  > neat computer I once bought, called "Jupiter ACE"; and also of a
                  > special-purpose image processing PC card I once used at work),
                  > but never came across that "feature" (assuming those dialects of
                  > Forth in those ROMs supported it, that is). Guess I was lucky
                  > that in those special cases I wasn't sharing code w/others:-).[/color]

                  Well the Jupiter ACE (of which I'm still a proud owner) suppored it,
                  it's in the '79 standard after all. E.g. just do '16 base !', for
                  hexadecimal input for example. Makes writing an assembler in Forth,
                  or the usual combination of Forth and assembly simpler if nothing else.

                  As everything Forth, judicious use is key.

                  Stefan,
                  --
                  Stefan Axelsson (email at http://www.cs.chalmers.se/~sax)

                  Comment

                  • Alan Offer

                    #24
                    Re: Python is Considered Harmful

                    Isaac To <kkto@csis.hku. hk> wrote in message news:<7ioew3xjh 1.fsf@enark.csi s.hku.hk>...
                    [color=blue]
                    > I believe the behaviour can be fixed rather easily by some directives, say
                    > making it
                    >
                    > map(lambda f: f(1), [lambda x: x+(*i) for i in range(3)])
                    >
                    > where the * construct would get the reference of i at function definition
                    > time rather than at function invocation time (anyone can point me to an
                    > PEP?).[/color]

                    We can essentially do this by passing i to a function that then returns the
                    desired function. So to make flist with the functions that mike420 wanted,
                    we can use:

                    flist = map(lambda i: (lambda x: x+i), range(3))

                    Now [f(1) for f in flist] is [1, 2, 3] as he expected.

                    Comment

                    • Marco Antoniotti

                      #25
                      Re: Python is Considered Harmful



                      Alan Offer wrote:
                      [color=blue]
                      > Isaac To <kkto@csis.hku. hk> wrote in message news:<7ioew3xjh 1.fsf@enark.csi s.hku.hk>...
                      >
                      >[color=green]
                      >>I believe the behaviour can be fixed rather easily by some directives, say
                      >>making it
                      >>
                      >> map(lambda f: f(1), [lambda x: x+(*i) for i in range(3)])
                      >>
                      >>where the * construct would get the reference of i at function definition
                      >>time rather than at function invocation time (anyone can point me to an
                      >>PEP?).[/color]
                      >
                      >
                      > We can essentially do this by passing i to a function that then returns the
                      > desired function. So to make flist with the functions that mike420 wanted,
                      > we can use:
                      >
                      > flist = map(lambda i: (lambda x: x+i), range(3))
                      >
                      > Now [f(1) for f in flist] is [1, 2, 3] as he expected.[/color]

                      This is good and I stand corrected then. At least you can achieve this
                      with Python.

                      Cheers
                      --
                      marco

                      Comment

                      • Isaac To

                        #26
                        Re: Python is Considered Harmful

                        >>>>> "Alan" == Alan Offer <alan_offer@hot mail.com> writes:

                        Alan> Isaac To <kkto@csis.hku. hk> wrote in message
                        Alan> news:<7ioew3xjh 1.fsf@enark.csi s.hku.hk>...[color=blue][color=green]
                        >> I believe the behaviour can be fixed rather easily by some
                        >> directives, say making it
                        >>
                        >> map(lambda f: f(1), [lambda x: x+(*i) for i in range(3)])
                        >>
                        >> where the * construct would get the reference of i at function
                        >> definition time rather than at function invocation time (anyone can
                        >> point me to an PEP?).[/color][/color]

                        Alan> We can essentially do this by passing i to a function that then
                        Alan> returns the desired function. So to make flist with the functions
                        Alan> that mike420 wanted, we can use:

                        Alan> flist = map(lambda i: (lambda x: x+i), range(3))

                        Alan> Now [f(1) for f in flist] is [1, 2, 3] as he expected.

                        Ah... that means

                        map(lambda f: f(1), [(lambda i: lambda x: x+i)(i) for i in range(3)])

                        Seems make sense to me.

                        Regards,
                        Isaac.

                        Comment

                        Working...