Chris Angelico wrote:
And I've seen a number of proposals to build Python with its *keywords* localized. While there is a reasonable limit to this (for instance, I wouldn't expect the disassembly of CPython byte-code to have "STORE_FAST" translated into another language), there's nothing wrong with programmers being able to write their code in their languages.
Just for fun, I used Google Translate to turn a piece of my Python code into French. Some of the results were rather amusing. For example, it turned "mess" (short for "message") into "désordre", and "but" (short for "button") into "mais". It got "for", "in", "if", "else" and "return" right, though! # Original code def ask(mess, responses = ["OK", "Cancel"], default = 0, cancel = -1, wrap_width = 60, **kwds): box = Dialog(**kwds) d = box.margin lb = wrapped_label(mess, wrap_width) lb.topleft = (d, d) buts = [] for caption in responses: but = Button(caption, action = lambda x = caption: box.dismiss(x)) buts.append(but) brow = Row(buts, spacing = d, equalize = 'w') lb.width = max(lb.width, brow.width) col = Column([lb, brow], spacing = d, align ='r') col.topleft = (d, d) if default is not None: box.enter_response = responses[default] else: box.enter_response = None if cancel is not None: box.cancel_response = responses[cancel] else: box.cancel_response = None box.add(col) box.shrink_wrap() return box.present() # Translated code demander def (désordre, réponses = ["OK", "Annuler"], par défaut = 0, annulent = -1, wrap_width = 60, kwds **): boîte de dialogue = (** kwds) d = box.margin lb = wrapped_label (désordre, wrap_width) lb.topleft = (d, d) BUTS = [] pour la légende dans les réponses: mais = Bouton (légende, action = lambda x = légende: box.dismiss (x)) buts.append (mais) Brow = ROW (buts, l'espacement = d, égalisent = 'W') lb.width = max (lb.width, brow.width) col = Colonne ([lb, le front], l'espacement = d, align = 'r') col.topleft = (d, d) si par défaut ne est pas None: box.enter_response = réponses [défaut] d'autre: box.enter_response = Aucun si annuler ne est pas None: box.cancel_response = réponses [Annuler] d'autre: box.cancel_response = Aucun box.add (col) box.shrink_wrap () retourner box.present () -- https://mail.python.org/mailman/listinfo/python-list