Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-471

singleton pattern doesnt work. SingletonPattern.py

    XMLWordPrintable

Details

    Description

      The Singleton pattern doesn't work with new style classes (which includes Python 3.0) I've tested using version 2.5.4 (used object in my class definition) and in version 3.0 and saw the same results. Finally the backticks are deprecated in 3.0 and should be replaced with repr().

      **program output **(obviously your will differ)

      In [56]: run SingletonPattern
      <main.OnlyOne object at 0x01652C10>
      <main.OnlyOne object at 0x01652A90>
      <main.OnlyOne object at 0x01652F50>
      <main.OnlyOne object at 0x01652C10>
      <main.OnlyOne object at 0x01652A90>
      <main.OnlyOne object at 0x01652C10>
      <main.OnlyOne object at 0x01652A90>
      <main.OnlyOne object at 0x01652F50>

      Attachments

        Activity

          People

            Unassigned Unassigned
            Anonymous Anonymous
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: