Path: csiph.com!eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!border2.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'subject:Django': 0.03; 'prefix': 0.07; 'processing.': 0.07; 'cc:addr:python-list': 0.09; 'modulo': 0.09; 'proficient': 0.09; 'units,': 0.09; 'python': 0.10; 'corrupt': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'in...': 0.16; 'wrote:': 0.16; 'string': 0.17; 'stick': 0.18; 'string,': 0.18; '>>>': 0.20; 'windows': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; 'ascii': 0.22; 'am,': 0.23; "python's": 0.23; 'header:In- Reply-To:1': 0.24; 'mon,': 0.24; '(which': 0.26; 'skip:" 20': 0.26; 'message-id:@mail.gmail.com': 0.27; 'far,': 0.29; 'reduced': 0.29; 'symbols': 0.29; "they'll": 0.29; 'code': 0.30; 'another': 0.32; 'good.': 0.32; 'getting': 0.33; 'michael': 0.33; 'largely': 0.33; 'skip:j 20': 0.33; 'languages': 0.34; 'server': 0.34; 'received:google.com': 0.35; 'so,': 0.35; 'could': 0.35; 'text': 0.35; 'unicode': 0.35; 'quite': 0.35; 'but': 0.36; '(and': 0.36; 'data.': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'things': 0.38; 'itself': 0.38; 'anything': 0.38; 'end': 0.39; 'why': 0.39; 'subject:the': 0.39; 'care': 0.60; 'your': 0.60; 'avoid': 0.61; 'different': 0.63; 'great': 0.63; 'chinese': 0.79; 'counts': 0.81; '8bit%:77': 0.84; 'chrisa': 0.84; 'emoticons,': 0.84; "life's": 0.84; 'popular.': 0.84; 'absolutely': 0.88; 'to:none': 0.91; 'same,': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=uRYxMMaem0giW/0sZp9rnAikHLzhqDnjuSEPNIPvIbs=; b=0jCJnsxvyMgL7Id/Djzg+Wp+wY35Vagrg+LlirRndokMe7CGNizheeeM2CUpDsSIKV M8s+FOMzJy8oqeByu1bmXVOrKYmh4LB3y1Fp7FLgDnLo2NeVdLNN3ncJjQwXPzRZomrH 1vRzYPeMaGH5MRErRhp7weCykT/yViBE0NGbg/OQIW5FI+llqWShF+YV86/9SjhJHRRt HinQD6HfndqVbxmbaQl/0D+xnVQFvG26IVtp8fiwVFLwwcc2A1ZHPAi6ZReMNAZtlXYP xl6sWTg2bDwTh5CH6+JR9bLvJb4J5jn/SkjyPDXtXWl7alcrbJ5RpceykWXUeGHGNiaT u8EA== MIME-Version: 1.0 X-Received: by 10.107.12.166 with SMTP id 38mr7163385iom.157.1439170069775; Sun, 09 Aug 2015 18:27:49 -0700 (PDT) In-Reply-To: <55C790D3.3040906@gmail.com> References: <55C790D3.3040906@gmail.com> Date: Mon, 10 Aug 2015 11:27:49 +1000 Subject: Re: Is Django the way to go for a newbie? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1439170072 news.xs4all.nl 2848 [2001:888:2000:d::a6]:36797 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:95210 On Mon, Aug 10, 2015 at 3:41 AM, Michael Torrie wrote: > Web development is very a very hard problem, largely because it involves > quite a few different domain-specific languages that you have to be > proficient in... > > In this area, node.js is getting very popular. I don't care much for > javascript but using it on the server as well as the web browser itself > reduced the number of languages you have to know by one. There's another thing you absolutely have to know when you do web development, and that's i18n. This is why I don't recommend Node.js for server-side work - because Python's Unicode support is better than JS's. Stick with Python (and avoid Python 2 on Windows) and you get great Unicode support. Do anything in JavaScript/ECMAScript and you get UTF-16 as the official representation. What's the length of the string "Hello, world"? >>> len("Hello, world") 12 > "Hello, world".length 12 So far, so good. What if those weren't ASCII characters? >>> len("=F0=9F=84=B7=F0=9F=84=B4=F0=9F=84=BB=F0=9F=84=BB=F0=9F=84=BE, =F0= =9F=85=86=F0=9F=84=BE=F0=9F=85=81=F0=9F=84=BB=F0=9F=84=B3") 12 (That's Python 3. In Python 2, you'd need to put a u"" prefix on the string, but it's otherwise the same, modulo the Windows narrow-build issue.) > "=F0=9F=84=B7=F0=9F=84=B4=F0=9F=84=BB=F0=9F=84=BB=F0=9F=84=BE, =F0=9F=85= =86=F0=9F=84=BE=F0=9F=85=81=F0=9F=84=BB=F0=9F=84=B3".length 22 ECMAScript stipulates that strings are not codepoints, but UTF-16 code units, so whenever you work with astral characters (which includes a lot of emoticons, Chinese characters, and other symbols that your end users *will* use), they'll get things wrong. The length of the string counts astral characters twice; indexing/slicing can take half of a character; any manipulation at all could corrupt your data. So, use Python for all your text processing. Life's better that way. ChrisA