Original version by New Order
Cover by Frente!
Cover by Stabbing Westward (my favorite)
Eric's lab notes gone stellar!
Original version by New Order
Cover by Frente!
Cover by Stabbing Westward (my favorite)
from scipy.interpolate import interpolate as interp
xa = [i * 10 for i in range(10)]
ya = [200.0 + 1.5 * x for x in xa]
iobj = interp.interp1d(xa, ya)
i_xa = [i for i in range(90)]
i_ya = [iobj(x) for x in i_xa]
import pylab as pl
pl.plot(xa, ya, "o")
pl.plot(i_xa, i_ya, "-")
pl.ylim(0, 1000)
pl.show()
#define STRINGIZE_(x) #x
#define STRINGIZE(x) STRINGIZE_(x)
?: operator used in C. But by some fortune, I ran across this Python snippet:("False", "True")[var == True]var ? "True" : "False"([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]*\.?[0-9]+)?)
([-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]*\.?[0-9]+)?)([a-zA-Z]*)
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
#define NC 10
#define ALONGSTRING "A long string of nonsense that would've been truncated."
size_t len;
char *string = calloc(NC, sizeof(*string));
len = snprintf(string, NC, ALONGSTRING);
printf("Truncated string: '%s'\n", string);
if(len >= NC) {
string = realloc(string, (len + 1) * sizeof(*string));
snprintf(string, len + 1, ALONGSTRING);
}
printf("Non-truncated string: '%s'\n", string);
free(string);
return 0;
}