• Lucid Dreaming - Dream Views




    Results 1 to 25 of 28
    Like Tree2Likes

    Thread: Ask me about Python

    Threaded View

    1. #6
      Rational Spiritualist DrunkenArse's Avatar
      Join Date
      May 2009
      Gender
      Location
      Da Aina
      Posts
      2,941
      Likes
      1092
      Quote Originally Posted by ninja9578 View Post
      Is it possible to shut off the garbage collector? Professionals hate garbage collectors.
      Professionals don't hate garbage collectors. Professionals like to get as much work done with as little code as possible in the most readable manner because that allows for a better program. That's why professionals use python when it's appropriate.

      Anyway, your example is garbage. You are referring to a limitation of the C library pthreads which has nothing to do with either garbage collection or threading in general.
      Python
      Code:
      import threading
      
      mutex = threading.lock()
      
      # critical section
      with mutex:
          if something:
              return something
          elif something_else:
             return something_else
      
      # mutex is automatically released when we exit the with block through any path 
      # this includes uncaught exceptions
      See why professionals like python where it's appropriate?

      When you started talking about garbage collectors, I thought you were going to bring up the usual (and valid) criticism that they can pause program execution when they are running. so you would not want a garbage collector in a pacemaker or other time critical piece of software. Given the fact that most large C/C++ programs for which this is not a concern end up manually reinventing a garbage collector anyways (or using a third party one, or leaking like the titanic), i think that it's just that much more ridiculous for you to claim that 'professionals' don't like garbage collectors and reflects a sort of macho, speed is everything attitude that I often see from C/C++ programmers.

      I think it's because you're mad that a long running java (ugh!) process can outperform a long running C++ process due to microoptimizations that the JITC can make based on runtime conditions that aren't available to even the smartest static compilers.
      Last edited by PhilosopherStoned; 10-02-2010 at 12:56 AM.
      Previously PhilosopherStoned

    Similar Threads

    1. Pass Variables Between JavaScript and C++/Python?
      By youssarian in forum Tech Talk
      Replies: 6
      Last Post: 01-12-2010, 04:27 AM
    2. Halp! (Python)
      By ThreeLetterSyndrom in forum Tech Talk
      Replies: 5
      Last Post: 06-23-2009, 09:43 PM
    3. Tell me about Python
      By DuB in forum Tech Talk
      Replies: 9
      Last Post: 04-29-2009, 04:55 PM
    4. Python Reality Check Tester
      By Wesley_Gray in forum Lucid Aids
      Replies: 10
      Last Post: 08-01-2008, 02:16 AM
    5. Fav Python Quotes
      By Mystical_Journey in forum The Lounge
      Replies: 20
      Last Post: 05-12-2005, 09:50 PM

    Bookmarks

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •