120917 Neil Bothwick wrote:
> On Sun, 16 Sep 2012 20:24:01 -0400, Philip Webb wrote:
>> We've been warned not to use Python 3 , so it's not installed in this
>> box, but it was included along with Python 2 in the Stage3 for the new
>> machine. I now find that  13  pkgs have been compiled relying on it
>> & Portage refuses to unmerge it.  Is this safe ?
> Perfectly safe, because we weren't warned to not use it,
> only to not set it as the default.  That is reasonable
> because older scripts aren't aware of the differences between Python 2/3,
> while newer scripts can explicitly call whichever version they need.
> The only problem with setting Python 3 as the default
> is that some older scripts may break.

I discovered this because my little script to do CLI calculations
-- by far the fastest of anything, if you don't need variables --
wouldn't work in the new machine till I did  s/python/python2  .

In case others might like to use it, the script is :

  #!/usr/bin/python2
  from math import *
  import sys
  expression = sys.argv[1]
  print '              ',eval(expression)

Its help is via 'pydoc math'.  Expressions need quotes if they have brackets.

It was failing with a syntax error in the print line,
when the 1st line read  #!/usr/bin/python ,
so I have to assume (1) that Python3 has been set as default
-- No ! I didn't do it ! -- & (2) its syntax for printing has changed.

Thanks for the polite explanation.  Further comments welcome.

-- 
========================,,============================================
SUPPORT     ___________//___,   Philip Webb
ELECTRIC   /] [] [] [] [] []|   Cities Centre, University of Toronto
TRANSIT    `-O----------O---'   purslowatchassdotutorontodotca


Reply via email to