<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://wiki.bht.fr/index.php?action=history&amp;feed=atom&amp;title=Ecrire_un_singleton_en_langage_python</id>
	<title>Ecrire un singleton en langage python - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.bht.fr/index.php?action=history&amp;feed=atom&amp;title=Ecrire_un_singleton_en_langage_python"/>
	<link rel="alternate" type="text/html" href="https://wiki.bht.fr/index.php?title=Ecrire_un_singleton_en_langage_python&amp;action=history"/>
	<updated>2026-05-02T21:01:14Z</updated>
	<subtitle>Historique des révisions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.36.1</generator>
	<entry>
		<id>https://wiki.bht.fr/index.php?title=Ecrire_un_singleton_en_langage_python&amp;diff=2382&amp;oldid=prev</id>
		<title>WikiAdmin le 14 janvier 2019 à 18:40</title>
		<link rel="alternate" type="text/html" href="https://wiki.bht.fr/index.php?title=Ecrire_un_singleton_en_langage_python&amp;diff=2382&amp;oldid=prev"/>
		<updated>2019-01-14T18:40:25Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version du 14 janvier 2019 à 18:40&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Ligne 1 :&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ligne 1 :&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Introduction&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;{{Introduction&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|texte=Voici un petit code écrit en python qui explique comment écrire un singleton en langage python. Notez bien que dans la méthode __init__ il faut faire quelques vérifications notamment avec les listes.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|texte=Voici un petit code écrit en python qui explique comment écrire un singleton en langage python. Notez bien que dans la méthode __init__ il faut faire quelques vérifications notamment avec les listes.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|auteurs=&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Arthur TOROSSIAN&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|auteurs=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|index=Informatique:Index&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|index=Informatique:Index&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>WikiAdmin</name></author>
	</entry>
	<entry>
		<id>https://wiki.bht.fr/index.php?title=Ecrire_un_singleton_en_langage_python&amp;diff=969&amp;oldid=prev</id>
		<title>Atoross le 5 septembre 2015 à 12:34</title>
		<link rel="alternate" type="text/html" href="https://wiki.bht.fr/index.php?title=Ecrire_un_singleton_en_langage_python&amp;diff=969&amp;oldid=prev"/>
		<updated>2015-09-05T12:34:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version du 5 septembre 2015 à 12:34&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l6&quot;&gt;Ligne 6 :&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ligne 6 :&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;#!/usr/bin/python&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;# -*- coding: UTF-8 -*-&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;class CSingleton( object ):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;class CSingleton( object ):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     class_instance = None&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;     class_instance = None&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Atoross</name></author>
	</entry>
	<entry>
		<id>https://wiki.bht.fr/index.php?title=Ecrire_un_singleton_en_langage_python&amp;diff=113&amp;oldid=prev</id>
		<title>Atoross le 17 février 2010 à 21:24</title>
		<link rel="alternate" type="text/html" href="https://wiki.bht.fr/index.php?title=Ecrire_un_singleton_en_langage_python&amp;diff=113&amp;oldid=prev"/>
		<updated>2010-02-17T21:24:07Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;fr&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Version précédente&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version du 17 février 2010 à 21:24&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l4&quot;&gt;Ligne 4 :&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Ligne 4 :&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|index=Informatique:Index&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;|index=Informatique:Index&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Voici un petit code écrit en python qui explique comment écrire un singleton en langage python. Notez bien que dans la méthode {{m|__init__}} il faut faire quelques vérifications notamment avec les listes. &lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Atoross</name></author>
	</entry>
	<entry>
		<id>https://wiki.bht.fr/index.php?title=Ecrire_un_singleton_en_langage_python&amp;diff=112&amp;oldid=prev</id>
		<title>Atoross : Nouvelle page : {{Introduction |texte=Voici un petit code écrit en python qui explique comment écrire un singleton en langage python. Notez bien que dans la méthode __init__ il faut faire quelque...</title>
		<link rel="alternate" type="text/html" href="https://wiki.bht.fr/index.php?title=Ecrire_un_singleton_en_langage_python&amp;diff=112&amp;oldid=prev"/>
		<updated>2010-02-17T21:23:35Z</updated>

		<summary type="html">&lt;p&gt;Nouvelle page : {{Introduction |texte=Voici un petit code écrit en python qui explique comment écrire un singleton en langage python. Notez bien que dans la méthode __init__ il faut faire quelque...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Introduction&lt;br /&gt;
|texte=Voici un petit code écrit en python qui explique comment écrire un singleton en langage python. Notez bien que dans la méthode __init__ il faut faire quelques vérifications notamment avec les listes. &lt;br /&gt;
|auteurs=Arthur TOROSSIAN&lt;br /&gt;
|index=Informatique:Index&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
Voici un petit code écrit en python qui explique comment écrire un singleton en langage python. Notez bien que dans la méthode {{m|__init__}} il faut faire quelques vérifications notamment avec les listes. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;python&amp;quot;&amp;gt;&lt;br /&gt;
class CSingleton( object ):&lt;br /&gt;
    class_instance = None&lt;br /&gt;
    def __init__( self, a ):&lt;br /&gt;
        print &amp;quot;CSingleton init&amp;quot;&lt;br /&gt;
        self.vitesse = a&lt;br /&gt;
        if not hasattr( self, &amp;quot;alist&amp;quot;) :&lt;br /&gt;
            self.alist = list()&lt;br /&gt;
    &lt;br /&gt;
    def __new__( typ, *args, **kwargs ):&lt;br /&gt;
        print &amp;quot;CSingleton new&amp;quot;, typ.class_instance        &lt;br /&gt;
        if typ.class_instance == None :&lt;br /&gt;
            obj = object.__new__( typ, *args, **kwargs)&lt;br /&gt;
            typ.class_instance = obj&lt;br /&gt;
        else :&lt;br /&gt;
            obj = typ.class_instance        &lt;br /&gt;
        return obj&lt;br /&gt;
&lt;br /&gt;
    def addObject(self, obj):&lt;br /&gt;
        self.alist.append( obj )&lt;br /&gt;
&lt;br /&gt;
if __name__ == '__main__' :&lt;br /&gt;
    a = CSingleton( 1 )&lt;br /&gt;
    a.addObject( &amp;quot;Lundi&amp;quot; )&lt;br /&gt;
    print &amp;quot;a.vitesse=&amp;quot;,a.vitesse&lt;br /&gt;
    print &amp;quot;a.alist=&amp;quot;,a.alist&lt;br /&gt;
&lt;br /&gt;
    b = CSingleton( 2 )&lt;br /&gt;
    b.addObject( &amp;quot;Mardi&amp;quot; )&lt;br /&gt;
    print &amp;quot;b.vitesse=&amp;quot;,b.vitesse&lt;br /&gt;
    print &amp;quot;b.alist=&amp;quot;,b.alist&lt;br /&gt;
&lt;br /&gt;
    c = CSingleton( 3 )&lt;br /&gt;
    c.addObject( &amp;quot;Mercredi&amp;quot; )&lt;br /&gt;
    print &amp;quot;c.vitesse=&amp;quot;,c.vitesse&lt;br /&gt;
    print &amp;quot;c.alist=&amp;quot;,c.alist&lt;br /&gt;
&lt;br /&gt;
    print &amp;quot;a.vitesse=&amp;quot;,a.vitesse&lt;br /&gt;
    print &amp;quot;a.alist=&amp;quot;,a.alist&lt;br /&gt;
    print &amp;quot;b.vitesse=&amp;quot;,b.vitesse&lt;br /&gt;
    print &amp;quot;b.alist=&amp;quot;,b.alist&lt;br /&gt;
    print &amp;quot;c.vitesse=&amp;quot;,c.vitesse&lt;br /&gt;
    print &amp;quot;c.alist=&amp;quot;,c.alist&lt;br /&gt;
    print &amp;quot;id(a)=&amp;quot;,id(a)&lt;br /&gt;
    print &amp;quot;id(b)=&amp;quot;,id(b)&lt;br /&gt;
    print &amp;quot;id(c)=&amp;quot;,id(c)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ce qui donne :&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
python singleton.py&lt;br /&gt;
CSingleton new None&lt;br /&gt;
CSingleton init&lt;br /&gt;
a.vitesse= 1&lt;br /&gt;
a.alist= ['Lundi']&lt;br /&gt;
CSingleton new &amp;lt;__main__.CSingleton object at 0xb7cf8ecc&amp;gt;&lt;br /&gt;
CSingleton init&lt;br /&gt;
b.vitesse= 2&lt;br /&gt;
b.alist= ['Lundi', 'Mardi']&lt;br /&gt;
CSingleton new &amp;lt;__main__.CSingleton object at 0xb7cf8ecc&amp;gt;&lt;br /&gt;
CSingleton init&lt;br /&gt;
c.vitesse= 3&lt;br /&gt;
c.alist= ['Lundi', 'Mardi', 'Mercredi']&lt;br /&gt;
a.vitesse= 3&lt;br /&gt;
a.alist= ['Lundi', 'Mardi', 'Mercredi']&lt;br /&gt;
b.vitesse= 3&lt;br /&gt;
b.alist= ['Lundi', 'Mardi', 'Mercredi']&lt;br /&gt;
c.vitesse= 3&lt;br /&gt;
c.alist= ['Lundi', 'Mardi', 'Mercredi']&lt;br /&gt;
id(a)= 3083833036&lt;br /&gt;
id(b)= 3083833036&lt;br /&gt;
id(c)= 3083833036&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Atoross</name></author>
	</entry>
</feed>