Skip to main content
Commonmark migration
Source Link

#Python - 81 93 148 150 153

Python - 81 93 148 150 153

Tweaking @BiggAl's code, since that's the game we're playing....

import threading as t,sys for a in sys.argv[1:]:t.Timer(int(a),print,[a]).start() 

... or 97 175 with delayed thread starting

import threading as t,sys for x in [t.Timer(int(a),print,[a]) for a in sys.argv[1:]]:x.start() 

Takes input via the command line, ala

./sleep-sort\ v0.py 1 7 5 2 21 15 4 3 8 

As with many python golfs, there comes a point where the code is compact enough that aliasing variables to shorten names doesn't even save characters.

This one is funky though because it aliases sys and threading BOTH as t, so sys.argv becomes t.argv. Shorter than from foo import *, and a net character savings! However I suppose Guido wouldn't be pleased...

Note to self - learn c and stop golfing in python. HOLY COW THIS IS SHORTER THAN THE C SOLUTION!

#Python - 81 93 148 150 153

Tweaking @BiggAl's code, since that's the game we're playing....

import threading as t,sys for a in sys.argv[1:]:t.Timer(int(a),print,[a]).start() 

... or 97 175 with delayed thread starting

import threading as t,sys for x in [t.Timer(int(a),print,[a]) for a in sys.argv[1:]]:x.start() 

Takes input via the command line, ala

./sleep-sort\ v0.py 1 7 5 2 21 15 4 3 8 

As with many python golfs, there comes a point where the code is compact enough that aliasing variables to shorten names doesn't even save characters.

This one is funky though because it aliases sys and threading BOTH as t, so sys.argv becomes t.argv. Shorter than from foo import *, and a net character savings! However I suppose Guido wouldn't be pleased...

Note to self - learn c and stop golfing in python. HOLY COW THIS IS SHORTER THAN THE C SOLUTION!

Python - 81 93 148 150 153

Tweaking @BiggAl's code, since that's the game we're playing....

import threading as t,sys for a in sys.argv[1:]:t.Timer(int(a),print,[a]).start() 

... or 97 175 with delayed thread starting

import threading as t,sys for x in [t.Timer(int(a),print,[a]) for a in sys.argv[1:]]:x.start() 

Takes input via the command line, ala

./sleep-sort\ v0.py 1 7 5 2 21 15 4 3 8 

As with many python golfs, there comes a point where the code is compact enough that aliasing variables to shorten names doesn't even save characters.

This one is funky though because it aliases sys and threading BOTH as t, so sys.argv becomes t.argv. Shorter than from foo import *, and a net character savings! However I suppose Guido wouldn't be pleased...

Note to self - learn c and stop golfing in python. HOLY COW THIS IS SHORTER THAN THE C SOLUTION!

deleted 9 characters in body
Source Link
arrdem
  • 846
  • 5
  • 15

#Python - 9381 93 148 150 153

Tweaking @BiggAl's code, since that's the game we're playing....

import threading as t,sys for a in sys.argv[1:]:t.Timer(int(a),sys.stdout.writeprint,[a]).start() 

... or 10697 175 with delayed thread starting

import threading as t,sys for x in [t.Timer(int(a),sys.stdout.writeprint,[a]) for a in sys.argv[1:]]:x.start() 

Takes input via the command line, ala

./sleep-sort\ v0.py 1 7 5 2 21 15 4 3 8 

As with many python golfs, there comes a point where the code is compact enough that aliasing variables to shorten names doesn't even save characters.

This one is funky though because it aliases sys and threading BOTH as t, so sys.argv becomes t.argv. Shorter than from foo import *, and a net character savings! However I suppose Guido wouldn't be pleased...

Note to self - learn c and stop golfing in python. HOLY COW THIS IS SHORTER THAN THE C SOLUTION!

#Python - 93 148 150 153

Tweaking @BiggAl's code, since that's the game we're playing....

import threading as t,sys for a in sys.argv[1:]:t.Timer(int(a),sys.stdout.write,[a]).start() 

... or 106 175 with delayed thread starting

import threading as t,sys for x in [t.Timer(int(a),sys.stdout.write,[a]) for a in sys.argv[1:]]:x.start() 

Takes input via the command line, ala

./sleep-sort\ v0.py 1 7 5 2 21 15 4 3 8 

As with many python golfs, there comes a point where the code is compact enough that aliasing variables to shorten names doesn't even save characters.

This one is funky though because it aliases sys and threading BOTH as t, so sys.argv becomes t.argv. Shorter than from foo import *, and a net character savings! However I suppose Guido wouldn't be pleased...

Note to self - learn c and stop golfing in python. HOLY COW THIS IS SHORTER THAN THE C SOLUTION!

#Python - 81 93 148 150 153

Tweaking @BiggAl's code, since that's the game we're playing....

import threading as t,sys for a in sys.argv[1:]:t.Timer(int(a),print,[a]).start() 

... or 97 175 with delayed thread starting

import threading as t,sys for x in [t.Timer(int(a),print,[a]) for a in sys.argv[1:]]:x.start() 

Takes input via the command line, ala

./sleep-sort\ v0.py 1 7 5 2 21 15 4 3 8 

As with many python golfs, there comes a point where the code is compact enough that aliasing variables to shorten names doesn't even save characters.

This one is funky though because it aliases sys and threading BOTH as t, so sys.argv becomes t.argv. Shorter than from foo import *, and a net character savings! However I suppose Guido wouldn't be pleased...

Note to self - learn c and stop golfing in python. HOLY COW THIS IS SHORTER THAN THE C SOLUTION!

deleted 5 characters in body; edited body
Source Link
arrdem
  • 846
  • 5
  • 15

#Python - 8993 148 150 153

Tweaking @BiggAl's code, since that's the game we're playing....

import threading,sys as t,sys for a in tsys.argv[1:]:t.Timer(int(a),tsys.stdout.write,[a]).start() 

... or 101 105106 175 with delayed thread starting

import threading,sys as t,sys for x in [t.Timer(int(a),tsys.stdout.write,[a]) for a in tsys.argv[1:]]:x.start() 

Takes input via the command line, ala

./sleep-sort\ v0.py 1 7 5 2 21 15 4 3 8 

As with many python golfs, there comes a point where the code is compact enough that aliasing variables to shorten names doesn't even save characters.

This one is funky though because it aliases sys and threading BOTH as t, so sys.argv becomes t.argv. Shorter than from foo import *, and a net character savings! However I suppose Guido wouldn't be pleased...

Note to self - learn c and stop golfing in python. HOLY COW THIS IS SHORTER THAN THE C SOLUTION!

#Python - 89 148 150 153

Tweaking @BiggAl's code, since that's the game we're playing....

import threading,sys as t for a in t.argv[1:]:t.Timer(int(a),t.stdout.write,[a]).start() 

... or 101 105 175 with delayed thread starting

import threading,sys as t for x in [t.Timer(int(a),t.stdout.write,[a]) for a in t.argv[1:]]:x.start() 

Takes input via the command line, ala

./sleep-sort\ v0.py 1 7 5 2 21 15 4 3 8 

As with many python golfs, there comes a point where the code is compact enough that aliasing variables to shorten names doesn't even save characters.

This one is funky though because it aliases sys and threading BOTH as t, so sys.argv becomes t.argv. Shorter than from foo import *, and a net character savings! However I suppose Guido wouldn't be pleased...

Note to self - learn c and stop golfing in python. HOLY COW THIS IS SHORTER THAN THE C SOLUTION!

#Python - 93 148 150 153

Tweaking @BiggAl's code, since that's the game we're playing....

import threading as t,sys for a in sys.argv[1:]:t.Timer(int(a),sys.stdout.write,[a]).start() 

... or 106 175 with delayed thread starting

import threading as t,sys for x in [t.Timer(int(a),sys.stdout.write,[a]) for a in sys.argv[1:]]:x.start() 

Takes input via the command line, ala

./sleep-sort\ v0.py 1 7 5 2 21 15 4 3 8 

As with many python golfs, there comes a point where the code is compact enough that aliasing variables to shorten names doesn't even save characters.

This one is funky though because it aliases sys and threading BOTH as t, so sys.argv becomes t.argv. Shorter than from foo import *, and a net character savings! However I suppose Guido wouldn't be pleased...

Note to self - learn c and stop golfing in python. HOLY COW THIS IS SHORTER THAN THE C SOLUTION!

Managed to trim four chars from the synchronous start version by integrating the starting and generating lines' loops.
Source Link
arrdem
  • 846
  • 5
  • 15
Loading
added 269 characters in body
Source Link
arrdem
  • 846
  • 5
  • 15
Loading
deleted 45 characters in body
Source Link
arrdem
  • 846
  • 5
  • 15
Loading
Added a new version, cut some characters
Source Link
arrdem
  • 846
  • 5
  • 15
Loading
fixed my char count
Source Link
arrdem
  • 846
  • 5
  • 15
Loading
Saved two chars and consolidated a line.
Source Link
arrdem
  • 846
  • 5
  • 15
Loading
Source Link
arrdem
  • 846
  • 5
  • 15
Loading