Prothon Prototypes vs Python Classes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Markus Wankus

    Re: [OT] Top posting is a PITA [was : Prothon Prototypes vs PythonClasses]

    Jacek Generowicz wrote:[color=blue]
    > Markus Wankus <markus_wankusG ETRIDOFALLCAPS@ hotmail.com> writes:
    >
    >[color=green]
    >>Right. So if we'd all just settle on top-posting things wouldn't be
    >>so bad after all. It's all you bottom-posters that are screwing
    >>things up for the rest of us. ;o)[/color]
    >
    >
    > Did you actually _understand_ what he wrote? Yes, I did notice the
    > smiley, but I also noticed the apparent complete failure to get the
    > point.[/color]

    Geez..you can't even joke about this apparently. OK. Whatever. I'm
    easy. I *did* get the point BTW...
    [color=blue]
    > Even if _everyone_ top-posts, then the reading direction is still
    > inconsisitent and requires the reader to jump back and-forth, to
    > understand what is going on.[/color]

    Yes.
    [color=blue]
    > Please _think_ about it. It really doesn't take very much thought to
    > understand that top-posting sucks, but it does require some. More than
    > top-posters seem to be able to muster, it seems.[/color]

    Alright.

    --

    MAN! There are some passionate individuals here. In fact, a few
    minutes after my lighthearted post I received a flood of IP spoofing
    attacks on my router (you know who you are). Man! Take it easy, grab a
    beer (or whatever tickles your fancy) and chill. Code something - that
    usually helps me. Just don't use VB or C++. ;o)

    Markus.

    Comment

    • Glenn Andreas

      Re: Prothon Prototypes vs Python Classes

      In article <slrnc6mvgv.rga .joe@gate.notch arles.ca>,
      Joe Mason <joe@notcharles .ca> wrote:
      [color=blue]
      > In article <69cbbef2.04033 11324.32837704@ posting.google. com>, has wrote:[color=green]
      > > Joe Mason <joe@notcharles .ca> wrote in message
      > > news:<slrnc6e2s m.fhj.joe@gate. notcharles.ca>. ..[color=darkred]
      > >> In article <69cbbef2.04032 80928.438d194f@ posting.google. com>, has wrote:
      > >> > # Library pseudocode
      > >> >
      > >> > _fooRegistry = []
      > >> >
      > >> > obj _Foo: # prototype object
      > >> > # Foo's code goes here
      > >> >
      > >> > def Foo(): # constructor function
      > >> > newFoo = _Foo.copy()
      > >> > _fooRegistry.ap pend(newFoo)
      > >> > return newFoo
      > >> >
      > >> >
      > >> > Dirt simple with not an ounce of class metaprogramming in sight.
      > >>
      > >> Is Foo() the standard syntax for making a new _Foo object? If this is a
      > >> new wrapper you just created, then it's no different than adding a
      > >> register() method - the user has to know that something different is
      > >> being done.
      > >>
      > >> If Foo() is the standard syntax, and you're just overriding the
      > >> implementation here, does that get inherited? If so, this missed the
      > >> condition that only some of the descendants should get added to the
      > >> registry. If not - well, inheriting the constructor seems like the more
      > >> useful behaviour in general, so why not?[/color]
      > >
      > > Don't think you've quite got the point of prototype-based OO yet.
      > > There's no real 'standard syntax' for making objects; nor is there any
      > > inheritance, classes, metaclasses, or instances. To create a new
      > > object from scratch, execute the code that defines it. Alternatively,
      > > duplicate an existing object.[/color]
      >
      > There certainly is a standard syntax for making objects. I need to know
      > how to "duplicate an existing object". Is it "obj.dup()" ?
      > "obj.clone( )"? "duplicate obj"? Most probably, the language (or
      > standard library) defines one of these, and I expect most objects to be
      > duplicated in the same way.
      >[/color]
      It can be a bit more subtle than that in a prototype based system, since
      there are two things that are different, but have nearly identical
      results, but could both be considered "duplicate an object".

      In general, you don't want to _duplicate_ the object, but rather use
      that object as "prototype" for the new object.

      First, you can make a new object that has all the same
      slots/properties/attributes as the first object - let's just call that
      "clone" for now (and we'll assume single inheritence, via a slot called
      "__parent")
      [color=blue]
      > print obj.__parent[/color]
      None[color=blue]
      > obj.a = 1
      > obj.foo = def ():[/color]
      print "a=",self.a[color=blue]
      > obj.foo()[/color]
      a=1[color=blue]
      > obj1 = obj.clone()
      > print obj1.__parent[/color]
      None[color=blue]
      > obj.a = 2 # change something in the original object
      > print obj1.a # unchanged in the "clone"[/color]
      1[color=blue]
      > obj1.foo()[/color]
      a=1

      and we'll make the second object that has first object as the __parent
      (and we'll pretend that the syntax is "new <some expression>"
      [color=blue]
      > obj2 = new obj1
      > print obj2.__parent[/color]
      <obj1>[color=blue]
      > obj2.foo()[/color]
      a=2 # since it inherits from obj1

      (obviously, the object doesn't actually retain the binded local variable
      name)

      If we looked at these three objects in a debugger:

      obj = <Object 0x1> { __parent: None, a: 1, foo: <Method 0x2> }
      obj1 = <Object 0x3> { __parent: None, a: 2, foo: <Method 0x2> }
      obj2 = <Object 0x4> { __parent: <Object 0x1> }

      If we hadn't changed obj1.a, both obj1 and obj2 would behave identically
      to obj (they all have the same properties, same behavior), even though
      internally, they are fairly different (obj1 is independant of obj, while
      obj2 is completely dependant on obj). Since both "data" and "behavior"
      is inherited, this is different from traditional class/instance
      organization (where an instance shares its behavior (methods) with all
      other instances, but has private data). This also makes the issue of
      "obj2.a = 5" important, since at that point obj2 would normally get it's
      own value of "a" (and otherwise would inherit the value of obj.a), and
      you'd want a clean way to alter obj.a from a method in obj2
      ("obj2.__parent .a = 3" would work, this is where directed resends are
      used in Self).

      In general, you want obj2 (since it inherits everything from obj, much
      like an instance "inherits" stuff from its superclass), but both are
      useful.

      Comment

      • Joe Mason

        Re: Prothon Prototypes vs Python Classes

        In article <gandreas-1F419E.08473601 042004@news.mpl s.visi.com>, Glenn Andreas wrote:[color=blue][color=green]
        >> There certainly is a standard syntax for making objects. I need to know
        >> how to "duplicate an existing object". Is it "obj.dup()" ?
        >> "obj.clone( )"? "duplicate obj"? Most probably, the language (or
        >> standard library) defines one of these, and I expect most objects to be
        >> duplicated in the same way.
        >>[/color]
        > It can be a bit more subtle than that in a prototype based system, since
        > there are two things that are different, but have nearly identical
        > results, but could both be considered "duplicate an object".
        >
        > In general, you don't want to _duplicate_ the object, but rather use
        > that object as "prototype" for the new object.
        >
        > First, you can make a new object that has all the same
        > slots/properties/attributes as the first object - let's just call that
        > "clone" for now (and we'll assume single inheritence, via a slot called
        > "__parent")[/color]

        <snip example>
        [color=blue]
        > and we'll make the second object that has first object as the __parent
        > (and we'll pretend that the syntax is "new <some expression>"[/color]

        <snip other example>

        This is certainly how Self does it. Other prototype based languages
        (such as Io) do not make this distinction. In Io, you use "clone" to
        make a new object whose parent is the object it was cloned from, and
        that's it.

        Joe

        Comment

        • Robin Munn

          Re: [OT] Top posting is a PITA

          Roy Smith <roy@panix.co m> wrote:[color=blue]
          > Jacek Generowicz <jacek.generowi cz@cern.ch> wrote:[color=green]
          >> top-posters tend to write codswallop more often that those who trim
          >> and organize their replies carefully.
          >>
          >> This is partly because the process of trimming the original post,
          >> forces you to identfy the relevant points being made[/color]
          >
          > What makes you think people who top post don't also put a lot of effort
          > into carefully organizing their replies and trimming the original post
          > down to the most relevant points?[/color]

          Bitter, hard-earned experience. Some people do so, as you demonstrated,
          but IMB,H-EE the vast majority do not.

          Another problem that occurs when some people top-post and some do not is
          that the conversation thread quickly becomes unreadable unless someone
          takes the time to rearrange it into a consistent form (as I did in
          composing this reply).

          --
          Robin Munn
          rmunn@pobox.com

          Comment

          • Aahz

            Python 3.0 (was Re: Prothon Prototypes vs Python Classes)

            In article <258fd9b8.04033 01237.60528600@ posting.google. com>,
            Magnus Lyck? <magnus@thinkwa re.se> wrote:[color=blue]
            >Michael <mogmios@mlug.m issouri.edu> wrote in message news:<40675F08. 9070402@mlug.mi ssouri.edu>...[color=green]
            >>
            >> They're planning to remove tab indention support in 3.0? I for one would
            >> be pissed off at such a change.[/color]
            >
            >I don't think you need to worry. AFAIK Python 3 is the mythological
            >if-I-could-turn-back-the-clock-and-undo-all-my-mistakes version
            >of Python, which Guido probably won't have time to work with
            >until his son is big enough to help him. (He'll be 3 in November.)
            >It will have little regard for backward compatibility, and if it
            >does appear sooner than expected, you can expect Python 2.x to be
            >maintaned in parallel for a long time.[/color]

            Not quite. Python 3000 is the mythical version; Python 3.0 is expected
            to appear some day. While there will be many changes that are not
            backward compatible, your "little regard" is unlikely to be true: Guido
            *likes* Python.
            --
            Aahz (aahz@pythoncra ft.com) <*> http://www.pythoncraft.com/

            "usenet imitates usenet" --Darkhawk

            Comment

            • Leif B. Kristensen

              Re: [OT] Top posting is a PITA

              Robin Munn wrote:
              [color=blue]
              > Another problem that occurs when some people top-post and some do not
              > is that the conversation thread quickly becomes unreadable unless
              > someone takes the time to rearrange it into a consistent form (as I
              > did in composing this reply).[/color]

              And more often than not, that's perceived as really not worth the
              effort. So, a lot of people that might have provided useful answers,
              doesn't care to reply to top-postings because it involves too much work
              to rearrange the text to respond in a sensible way.

              Top-posting *is* shitting in your pants.

              regards,
              --
              Leif Biberg Kristensen

              Validare necesse est

              Comment

              • Jacek Generowicz

                Re: [OT] Top posting is a PITA [was : Prothon Prototypes vs Python Classes]

                Markus Wankus <markus_wankusG ETRIDOFALLCAPS@ hotmail.com> writes:
                [color=blue]
                > Geez..you can't even joke about this apparently. OK. Whatever. I'm
                > easy. I *did* get the point BTW...[/color]

                Cool. Sorry ... I've been away for a few days ... and having to wade
                through a lot of top-posted crap on my return has made my tolerance
                of TPing come close to an all-time low ... which is accompanied by a
                sense of humour failure.

                I'm off to sit in a sensory deprivation tank for a few hours.

                Comment

                • Jacek Generowicz

                  Re: [OT] Top posting is a PITA

                  Roy Smith <roy@panix.co m> writes:
                  [color=blue]
                  > What makes you think people who top post don't also put a lot of effort
                  > into carefully organizing their replies and trimming the original post
                  > down to the most relevant points?[/color]

                  Over a decade of observation of usenet and mailing lists.

                  Comment

                  • Markus Wankus

                    Re: [OT] Top posting is a PITA [was : Prothon Prototypes vs PythonClasses]

                    Jacek Generowicz wrote:[color=blue]
                    > Markus Wankus <markus_wankusG ETRIDOFALLCAPS@ hotmail.com> writes:
                    >
                    >[color=green]
                    >>Geez..you can't even joke about this apparently. OK. Whatever. I'm
                    >>easy. I *did* get the point BTW...[/color]
                    >
                    >
                    > Cool. Sorry ... I've been away for a few days ... and having to wade
                    > through a lot of top-posted crap on my return has made my tolerance
                    > of TPing come close to an all-time low ... which is accompanied by a
                    > sense of humour failure.
                    >
                    > I'm off to sit in a sensory deprivation tank for a few hours.[/color]

                    Well - I guess I was being a bit of a dolt too...sorry. ;o)

                    Let's all sit in our sensory deprivation tanks! That sounds like fun!
                    Who here can construct metaclasses in the dark, in their head?

                    Markus.

                    Comment

                    • Jacek Generowicz

                      Re: [OT] Top posting is a PITA [was : Prothon Prototypes vs Python Classes]

                      Markus Wankus <markus_wankusG ETRIDOFALLCAPS@ hotmail.com> writes:
                      [color=blue]
                      > Let's all sit in our sensory deprivation tanks! That sounds like fun!
                      > Who here can construct metaclasses in the dark, in their head?[/color]

                      No problem. That's easy. It's typing them into an editor after I get
                      out where it always goes wrong :-)

                      Comment

                      • Christos TZOTZIOY Georgiou

                        Re: Prothon Prototypes vs Python Classes

                        On Mon, 29 Mar 2004 08:05:44 -0500, rumours say that "John Roth"
                        <newsgroups@jhr othjr.com> might have written:

                        [tabs vs spaces]
                        [color=blue]
                        >Reading the source for Idle is quite
                        >enlightening : there is a comment about Tk doing something
                        >rather absurd if you change the tab default.[/color]

                        Which comment, I believe, is quite old, and possibly refers to an old
                        glitch of Tk (ICBW of course).

                        I like tabs, although out of courtesy to the general consensus in the
                        python world, I filter any code I make available to the public,
                        replacing tabs with 4 spaces (at least I try to remember that :).

                        However, I have a little patch for EditorWindow.py which I apply in
                        every python installation I am going to use, inserting a
                        self.set_tabwid th(3) (which translates to a most pleasant width of 3 ens
                        for the font I use, which is proportional) somewhere in the __init__ of
                        the EditorWindow class. I don't have any bad consequences (or they went
                        unnoticed).

                        I don't preach to use tabs over spaces. I just believe in personal
                        freedom, as long as I respect commonly accepted rules.
                        --
                        TZOTZIOY, I speak England very best,
                        Ils sont fous ces Redmontains! --Harddix

                        Comment

                        Working...