Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Python 3.0

Name: BAWWWWWWWWWWWWWWWWWWW 2008-06-19 12:06

http://docs.python.org/dev/3.0/whatsnew/3.0.html

The print statement has been replaced with a print() function, with keyword arguments to replace most of the special syntax of the old print statement (PEP 3105). Examples:

Old: print "The answer is", 2*2
New: print("The answer is", 2*2)

Old: print x,           # Trailing comma suppresses newline
New: print(x, end=" ")  # Appends a space instead of a newline

Old: print              # Prints a newline
New: print()            # You must call the function!

Old: print >>sys.stderr, "fatal error"
New: print("fatal error", file=sys.stderr)

Old: print (x, y)       # prints repr((x, y))
New: print((x, y))      # Not the same as print(x, y)!

You can also customize the separator between items, e.g.:

print("There are <", 2**32, "> possibilities!", sep="")

which produces:

There are <4294967296> possibilities!

Notes about the print() function:

    * The print() function doesn’t support the “softspace” feature of the old print statement. For example, in Python 2.x, print "A\n", "B" would write "A\nB\n"; but in Python 3.0, print("A\n", "B") writes "A\n B\n".
    * Initially, you’ll be finding yourself typing the old print x a lot in interactive mode. Time to retrain your fingers to type print(x) instead!
    * When using the 2to3 source-to-source conversion tool, all print statements are autmatically converted to print() function calls, so this is mostly a non-issue for larger projects.

\\\

Python 3.0 uses strings and bytes instead of the Unicode strings and 8-bit strings. This means that pretty much all code that uses Unicode, encodings or binary data in any way has to change. The change is for the better, as in the 2.x world there were numerous bugs having to do with mixing encoded and unencoded text.

\\\\

    * PEP 352: Exceptions must derive from BaseException. This is the root of the exception hierarchy.
    * StandardError was removed (already in 2.6).
    * Dropping sequence behavior (slicing!) and message attribute of exception instances.
    * PEP 3109: Raising exceptions. You must now use raise Exception(args) instead of raise Exception, args.
    * PEP 3110: Catching exceptions. You must now use except SomeException as identifier: instead of except Exception, identifier:
    * PEP 3134: Exception chaining. (The __context__ feature from the PEP hasn’t been implemented yet in 3.0a2.)
    * A few exception messages are improved when Windows fails to load an extension module. For example, error code 193 is now %1 is not a valid Win32 application. Strings now deal with non-English locales.


WTF ARE THEY DOING?!

Name: Anonymous 2008-06-20 9:50

      .'"".      I LIKE PYTHON BECAUSE I ENJOY HOMOSEXUAL
     c' )"/      S/M. OH GUIDO MAKE ME USE THAT FUCKING
    __>  /_      INDENTATION. OH BABY I'M CUMMING.
 .-`_    ._'-.
( -' \  :/  )/   THERE IS ONLY ONE WAY TO DO IT: GUIDO'S
 \\._|  (  //    WAY! THAT MEANS YOU CAN'T USE ALL
  '-/)   \(,     CONTROL STRUCTURES. IF YOU NEED A DO-
     /  ) )      WHILE LOOP, A SWITCH OR BREAK OUT OF A
    / .'\ |      NESTED LOOP, TOO BAD. GUIDO SAYS IT'S TO
   /.'   \|      KEEP THE LANGUAGE CLEAN, BUT IT'S ACTUALLY
  ||     ||      TO PUNISN HIS SLAVES. THIS DOESN'T MEAN
__|/     |/__    THAT PYTHON IS FLAWED, JUST WORK AROUND IT.
_._)     (,__;                       FUCK I'M CUMMING AGAIN.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List