what’s the difference between socket.send() and socket.sendall() ?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Jan 7 10:28:18 EST 2013


On Mon, 07 Jan 2013 18:35:20 +0800, iMath wrote:

> <p class="MsoNormal"><tt><span lang="EN-US" style="font-size: 12pt;
> color: white; background-color: rgb(68, 110, 248); background-position:
> initial initial; background-repeat: initial initial; ">what’s the
> difference between socket</span></tt><tt><span lang="EN-US"
> style="font-size: 12pt; ">.send() and <span style="color: white;
> background-color: rgb(68, 110, 248); background-position: initial
> initial; background-repeat: initial initial; ">socket</span>.sendall()
> ?</span></tt> </p>


Please re-send your question as text, instead of as HTML (so-called "rich 
text"). Since many people are reading this forum via Usenet, sending HTML 
is considered abusive. This is a text newsgroup, not a binary newsgroup.

If you *must* use a client that sends HTML, please make sure that it 
ALWAYS sends a plain text version of your message as well. But here are 
eight reasons you should not rely on fancy formatting (colours, fonts, 
bold, etc.) in text-based media such as email (or news):

- HTML code in email is one of the top 3 signs of spam. Many people
  send "rich text" email straight to the trash as a way of eliminating
  spam.

- HTML code in email is a privacy and security risk. For example,
  that means that the sender can track whether or not you have read
  the email using "web bugs" whether or not you consent to being
  tracked. There are viruses, spyware and other malware that can be
  transmitted through HTML code in email. For this reason, many
  people filter HTML email straight to the trash.

- HTML code forces your choice in font, font size, colours, etc. on
  the reader. Some people prefer to read emails using their own
  choice of font rather than yours, and consider it rude for others
  to try to force a different font. Sending white text on coloured 
  background is especially nasty, because it hurts readability of
  even for people with perfect vision.

- Even if readers don't mind the use of "rich text" in principle, in
  practice once they have received enough emails with pink text on a
  purple and yellow background with blinking stars and dancing fairies
  all over the page, in pure self-defence they may disable or delete 
  HTML emails.

- Use of colour for emphasis discriminates against the approximately
  10% of the male population who are colour-blind.

- Use of italics or other formatting may discriminate against those 
  who are blind and using screen readers to "read" their email. I 
  once was on a maths mailing list for about three years before I
  realised that the most prolific and helpful person there was as 
  blind as a bat.

- Programming is a *text-based* activity. Code depends on WHAT you
  write, not its colour, or the font you use, or whether there are
  smiley faces in the background winking at you. So especially in
  programming circles, many people find HTML code in emails to be a
  distraction and an annoyance. Being able to express yourself in 
  plain text without colours and fonts is a good practice for any
  programmer to get used to.

- Even if you think that people who dislike HTML emails are wrong, or
  silly, or being precious, or completely nuts, nevertheless you should
  indulge us. You are asking for free advice. It does not pay for you to
  offend or annoy those you are asking for help. 


(Apologies to anyone on the "tutor" mailing list who has already seen 
this message earlier today.)



-- 
Steven



More information about the Python-list mailing list