Cheerful Curmudgeon

A complete lack of ideas and the power to express them.

  • Home
  • About Me
    • Art Zemon’s PGP Key
    • Privacy Policy
  • Bede BD-4C
    • Hall of Fame
  • Piper Arrow

Real Virtual Alchemy

July 14, 2010 Art Zemon

I have learned to change lead into gold, and back again, for real! Well, sort of. Thus far, it only works within the virtual world of programming languages like Python. Here is the recipe. (If you are not into geek-speak, skip to the bottom where I natter on about reading ebooks on an iPad.)

class Lead(object):
    def prestoChango(self):
        self.__class__ = Gold

class Gold(object):
    def prestoChango(self):
        self.__class__ = Lead

pb = Lead()
print pb             # prints Lead
pb.prestoChango()
print pb             # prints Gold
pb.prestoChango()
print pb             # prints Lead

Voila! First it’s lead. Then it’s gold. Then it’s lead again.

I understand why you might want to do something like this but, at least within the projects that I work on, it would obfuscate the program too much for my liking.

I learned this from reading the Python Coookbook ebook on my iPad, which has been thoroughly enjoyable. I like the iBooks app more than I expected to. I can highlight portions of the book, without actually trashing the pages. I can scribble notes next to my highlights. I can easily browse a list of the sections that I highlighted/noted. Perhaps even more useful, I can select a word or phrase from the text of the book and instantly search either Google or Wikipedia for it.

eBooks, Software, Technology

Recent Posts

  • Stretching a Photo April 21, 2025
  • There are Elephants in the Room April 10, 2025
  • Let’s Eliminate Real WFA April 1, 2025
  • Thumb Wrist Neck Waist Height March 18, 2025
  • Avoid Targeted Advertisements February 5, 2025

About Art Zemon

Omni-curious geek. Husband. Father. Airplane builder & pilot. Bicyclist. Photographer. Computer engineer.

Categories

  • Aviation (261)
    • Bede BD-4C (174)
    • Soaring (5)
  • Bicycling (37)
    • St. Louis to Atlanta (8)
    • St. Peters to Minneapolis (18)
  • Business (48)
  • Cabbages & Kings (24)
  • Communicating (37)
  • Ecology (21)
  • Economy (8)
  • Family (35)
  • Finding the Good (43)
  • Fun (188)
    • Six Word Stories (8)
  • Gardening (5)
  • Genealogy (5)
  • Government (35)
  • Health (67)
  • Judaism (10)
  • Men (12)
  • Mideast (5)
  • Movies (8)
  • Philosophy (15)
  • Photography (27)
  • Rants & Raves (103)
  • Recommendations (35)
  • Safety (37)
  • Science (22)
    • Biology (7)
    • Physics (7)
    • Pyschology (3)
  • Technology (195)
    • eBooks (7)
    • Internet (66)
    • Software (63)
    • VOIP (5)
  • Travel (43)
  • Tzedakah (12)
  • Women (5)

You Will Also Like

  • Art Zemon's Genealogy
  • Art Zemon's Photos
  • Mastodon @babka.social
  • Mastodon @raphus.social

Search

#DonorForLife

6 gallon blood donor badge
#DonorForLife - Give Blood - Save Lives

Archives

Copyright © 2025 · Daily Dish Pro Theme on Genesis Framework · WordPress · Log in