Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote:
In message gvlppt$hk...@news.lysator.liu.se, Thomas Bellman wrote:
Speaking as a sysadmin, running applications for production,
programs not using SO_REUSEADDR should be taken out and shot.
Not using SO_REUSEADDR means forcing
, no matter
what you do.
Not using SO_REUSEADDR means forcing a service interruption of
half an hour (IIRC) if for some reason the service must be
restarted, or having to reboot the entire machine. No thanks.
I have been in that situation.
--
Thomas Bellman, Lysator Academic Computer Club
. For example, a linefeed without a backslash
before it (and you would probably want a way to escape the
backslash, in case you want to end a message with a backslash).
- Have small header of a fixed size at the start of each message,
that includes the length of the message in octets.
--
Thomas
Steven D'Aprano st...@remove-this-cybersource.com.au wrote:
You can hash numbers no matter how big they are.
hash(float('inf'))
314159
Cute. And hash(float('-inf')) is -271828...
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
God is real, but Jesus
. For example, you can avoid having
to deal with quoting shell metacharacters, and interpreting the
return values are easier.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Life IS pain, highness. Anyone who tells ! bellman @ lysator.liu.se
differently is selling something
to pass that string
unquoted to /bin/sh when the user thought he was just typing a
filename.)
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
I don't think [that word] means what you! bellman @ lysator.liu.se
think it means. -- The Princess Bride! Make Love
at all. The operator
module is your friend: key=operator.attrgetter('real', 'imag')
will create the required tuples for sorting.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
God is real, but Jesus is an integer. ! bellman @ lysator.liu.se
shells, and hardly inside them either.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Adde parvum parvo magnus acervus erit ! bellman @ lysator.liu.se
(From The Mythical Man-Month) ! Make Love -- Nicht Wahr!
--
http://mail.python.org/mailman
by the shell he started the Python
program from, but Python does *not* update to reflect changes to
the working directory.
Use '@pwd' instead of '@echo $(PWD)'.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Beware of bugs in the above code; I have! bellman
() function as well, but you can't argue that because a
sum *involving* a NULL value returns NULL.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
This isn't right. This isn't even wrong. ! bellman @ lysator.liu.se
-- Wolfgang Pauli ! Make
it might actually make sense to
treat the empty sequence as an error, but just ignore non-numeric
elements (i.e, treat them as if they were zero). And in some
cases both should be an error, and in some neither should be an
error.
--
Thomas Bellman, Lysator Computer Club, Linköping University
to
point to things outside the chroot, you are at least guaranteed
that you won't give the chroot:ed process to much information.
Unfortunately, you won't be giving it the tools it needs to do
its designed job, either, since symlinks can't escape a chroot.
--
Thomas Bellman, Lysator Computer Club
'list', {'y': 0, 'x': 0})
d['z']
[]
d
defaultdict(type 'list', {'y': 0, 'x': 0, 'z': []})
The keys you give to the fromkeys() method will all be set to the
same object (the integer zero, in the case above), though, which
might not be what you want.
--
Thomas Bellman, Lysator
device files or setuid binaries.
All this is of course assuming that the chroot is done for
security reasons. There are other reasons one might want to
run in chroot.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Life IS pain, highness. Anyone who tells
not in new ]
[None, None, None, None, None, None, None, None, None, None, None,
None, None, None, None, None, None]
Yes, you do get a correct result in 'new', but you *also* create
a 17 long list with all elements set to None, that is immediately
thrown away.
--
Thomas Bellman, Lysator
the
first time a key is mentioned, and if the keys are mostly unique,
that will be the majority of the times, and calling a pure Python
function is fairly slow in CPython. (It probably won't matter
unless you have many thousands of unique keys, though.)
--
Thomas Bellman, Lysator Computer Club
.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
What sane person could live in this world ! bellman @ lysator.liu.se
and not be crazy? -- Ursula K LeGuin ! Make Love -- Nicht Wahr!
--
http://mail.python.org/mailman/listinfo/python-list
I gave about performance
does not apply; my understanding is that calling built-in functions
(like the int constructor) is fast.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Beware of bugs in the above code; I have! bellman @ lysator.liu.se
only proved
Jean-Paul Calderone [EMAIL PROTECTED] wrote:
(Ctrl+Z which sends SIGSTOP and _cannot_ be masked
or otherwise ignored)
Bzzt! Ctrl-Z causes a SIGTSTP to be sent, not SIGSTOP, and
SIGTSTP can be both caught, ignored and masked.
--
Thomas Bellman, Lysator Computer Club
common, so if you want
to reach a large customer base, make sure that your Python
programs work with Python 2.3.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Don't tell me I'm burning the candle at both ! bellman @ lysator.liu.se
ends -- tell me where to get more
that the four-tuple identifying the TCP connection will be
unique.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
There are many causes worth dying for, but ! bellman @ lysator.liu.se
none worth killing for. -- Gandhi ! Make Love -- Nicht Wahr!
--
http
, then no, in Scheme
only #f is false, and the empty list () is considered true.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
When C++ is your hammer, everything ! bellman @ lysator.liu.se
looks like a thumb.! Make Love -- Nicht Wahr!
--
http
Ivo [EMAIL PROTECTED] wrote:
Thomas Bellman wrote:
However, the os.read() function will only read what is currently
available. Note, though, that os.read() does not do line-based
I/O, so depending on the timing you can get incomplete lines, or
multiple lines in one read.
be carefull
Christian Heimes [EMAIL PROTECTED] writes:
Thomas Bellman wrote:
The readlines() method will read until it reaches end of file (or
an error occurs), not just what is available at the moment. You
can see that for your self by running:
Bad idea ;)
Why is it a bad idea to see how
is currently
available. Note, though, that os.read() does not do line-based
I/O, so depending on the timing you can get incomplete lines, or
multiple lines in one read.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Adde parvum parvo magnus acervus erit
` module suggested by the other poster.
I think you would be better off looking into the correctly spelled
'threading' module rather than the misspelled 'trheading' module. :-)
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
God is real, but Jesus is an integer
that there won't be
any more lines in response to its command.
If you can't get the program you are calling to follow some
protocol like this, then you can only make guesses. Sometimes
you can make fairly good guesses, and sometimes it will be more
or less impossible...
--
Thomas Bellman, Lysator
.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
God is real, but Jesus is an integer. ! bellman @ lysator.liu.se
! Make Love -- Nicht Wahr!
--
http://mail.python.org/mailman/listinfo/python-list
or
terminals, you would have major problems, since suddenly calling
the eof() method would block the process. Probably not what you
were expecting.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Life IS pain, highness. Anyone who tells ! bellman @ lysator.liu.se
to recognize
a character rendered in the Taiwanese or mainland Chinese way.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Adde parvum parvo magnus acervus erit ! bellman @ lysator.liu.se
(From The Mythical Man-Month) ! Make Love -- Nicht Wahr!
--
http
comprehensions:
c
Traceback (most recent call last):
File stdin, line 1, in module
NameError: name 'c' is not defined
eval('[ord(c) for c in parrot]')
[112, 97, 114, 114, 111, 116]
c
't'
This is supposed to be changed in Python 3.0.
--
Thomas Bellman, Lysator
to your terminal, not to anyone else's.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Don't tell me I'm burning the candle at both ! bellman @ lysator.liu.se
ends -- tell me where to get more wax!! ! Make Love -- Nicht Wahr!
--
http://mail.python.org/mailman
, but after many years working with computer
security I have managed to learn not to do *that* particular
error again; I hope...)
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Life IS pain, highness. Anyone who tells ! bellman @ lysator.liu.se
differently
as arguments, and thus passed the four words
foo, bar, gazonk and del as arguments for the above #!
line, but I don't remember what Unix that was.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Adde parvum parvo magnus acervus erit ! bellman @ lysator.liu.se
* of
the variables, not the actual contents of them. It is the
*dereferencing* of those casted pointers that interpret the bit
patterns in the variables as if they were another type, not the
casting itself.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
I don't think [that word
)
return self.__dumps[0](*args, **kwargs)
xmlrpclib.dumps = _xmldumps(xmlrpclib.dumps)
import SimpleXMLRPCServer
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
This isn't right. This isn't even wrong. ! bellman @ lysator.liu.se
Alex Martelli [EMAIL PROTECTED] wrote:
C has no stand on complex numbers.
If by that you mean that C does not have complex numbers, then
you are wrong. C99 defines the three types float _Complex,
double _Complex, and long double _Complex, and also the header
complex.h.
--
Thomas Bellman
Lawrence D'Oliveiro [EMAIL PROTECTED] writes:
const is in C89/C90.
Although with slightly different semantics from in C++... For
instance:
static const int n = 5;
double a[n];
is valid C++, but not valid C.
--
Thomas Bellman, Lysator Computer Club, Linköping University
download from
http://www.lysator.liu.se/~bellman/download/asyncproc.py
I suspect that it only works on Unix, though.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Beware of bugs in the above code; I have! bellman @ lysator.liu.se
only proved it correct
size of 4 Kbyte.)
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
There are many causes worth dying for, but ! bellman @ lysator.liu.se
none worth killing for. -- Gandhi ! Make Love -- Nicht Wahr!
--
http://mail.python.org/mailman/listinfo/python-list
| myprogram.py' will stop at some random point,
when the OS happens to decide that myprogram.py should be scheduled
twice without dd getting the chance to fill the pipe buffer
inbetween.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
We don't understand the software
much more fragile; think for example about what
happens if your SQL statement (I assume that's what sqlsth is)
yields zero rows, and you then try to look at pkcolumns after
that loop.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
God is real, but Jesus is an integer
use the poll() methods on the Popen object to
check if the process has terminated.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
You are in a twisty little passage of ! bellman @ lysator.liu.se
standards, all conflicting.! Make Love -- Nicht
:
os.makedirs(/tmp/trh/spam/norwegian/blue/parrot/cheese)
except os.error, e:
if e.errno != errno.EEXIST:
raise
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
I refuse to have a battle of wits with an ! bellman @ lysator.liu.se
unarmed person
/blue/parrot/cheese)
except os.error, e:
if ( e.errno != errno.EEXIST or
not os.path.isdir(/tmp/trh/spam/norwegian/blue/parrot/cheese)):
raise
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Beware of bugs in the above code; I have
test it.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Beware of bugs in the above code; I have! bellman @ lysator.liu.se
only proved it correct, not tried it. ! Make Love -- Nicht Wahr!
--
http://mail.python.org/mailman/listinfo/python-list
? You
just *might* find the answer to your question if you look at what
you can do with Popen objects. Actually, just learning about the
exact semantics of the communicate() method might be enought to
solve your problem.
--
Thomas Bellman, Lysator Computer Club, Linköping University
' is waiting for I/O even on a single-CPU
system.
And I'm fairly certain that 'sort' won't start spending CPU time
until it has collected all its input, so you won't gain much
there either.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
We don't understand the software
=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?= [EMAIL PROTECTED] wrote:
Thomas Bellman wrote:
Fixed-with characters *do* have advantages, even in the external
representation. With fixed-with characters you don't have to
parse the entire file or stream in order to read the Nth character;
instead
(the way UTF-8 is), nor uses fixed-with characters (like
UTF-32 does)?
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
You are in a twisty little passage of ! bellman @ lysator.liu.se
standards, all conflicting.! Make Love -- Nicht Wahr!
--
http
efficient.
The codec for UTF-32 is extremely simple. There are no illegal
sequences to care about, like there are in UTF-8 and UTF-16, just
illegal single 32-bit values (those that are larger than 0x10).
And not the least, UTF-32 is *beautiful* compared to UTF-16.
--
Thomas Bellman
use it as inspiration for doing it yourself.
It requires the subprocess module, but I have successfully used
it under Python 2.3.2 with subprocess installed locally.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Adde parvum parvo magnus acervus erit ! bellman
be ignored away.
There is a local cost with it, for learning Python, but I'm not
sure there really is a global cost, when you look at the entire
situation.
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
Too much of a good thing is WONDERFUL. ! bellman
the English
language for allowing them to write such books, or do you
blame the writers for using English in a bad way?
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
We don't understand the software, and! bellman @ lysator.liu.se
sometimes we don't
54 matches
Mail list logo