Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.01; 'oct': 0.02; 'python.': 0.04; 'string.': 0.04; 'subject:Python': 0.05; 'bytes.': 0.07; 'prints': 0.07; 'typed': 0.07; 'python': 0.08; 'also:': 0.09; 'fwd:': 0.09; 'libraries.': 0.09; 'listing,': 0.09; 'namespace': 0.09; 'ptr': 0.09; 'statement.': 0.09; 'thanx': 0.09; 'api': 0.09; 'output': 0.10; 'def': 0.13; 'gui': 0.13; 'stored': 0.13; 'feedback.': 0.15; 'subject:Issue': 0.15; '"copyright",': 0.16; '"credits"': 0.16; '"license"': 0.16; '"unknown': 0.16; '[gcc': 0.16; 'alex23': 0.16; 'bieber': 0.16; 'captured': 0.16; 'class;': 0.16; 'date:\xc2\xa0mon,': 0.16; 'deck': 0.16; 'design:': 0.16; 'email addr:ix.netcom.com': 0.16; 'imposing': 0.16; 'input.': 0.16; 'lee)': 0.16; 'linux2': 0.16; 'lisp': 0.16; 'ncurses': 0.16; 'program...': 0.16; 'programing': 0.16; 'rainer': 0.16; 'repr': 0.16; 'stdin': 0.16; 'syntactic': 0.16; 'terminated.': 0.16; 'trap': 0.16; 'troll': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'x-greylist:': 0.16; 'mon,': 0.16; 'language': 0.17; 'wrote:': 0.18; '>>>': 0.18; 'bytes': 0.18; 'ryan': 0.18; 'string,': 0.18; 'appears': 0.19; 'memory': 0.21; 'programming': 0.21; 'subject:list': 0.21; 'url:home': 0.21; 'dec': 0.22; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'somewhere': 0.23; 'wonder': 0.23; '----------': 0.23; '+0100,': 0.23; '+0530': 0.23; 'delayed': 0.23; 'equally': 0.23; 'here?': 0.23; 'itself,': 0.23; 'pair': 0.23; 'string': 0.24; 'library.': 0.24; 'shell': 0.24; 'suspect': 0.24; 'modify': 0.25; 'code': 0.25; 'skip:[ 10': 0.27; 'variable': 0.28; 'url:mailman': 0.28; 'lee': 0.28; 'script': 0.28; 'message-id:@mail.gmail.com': 0.28; 'fine.': 0.29; 'generic': 0.29; 'matches': 0.29; 'script.': 0.29; 'date:': 0.29; 'worked': 0.29; 'print': 0.29; 'pm,': 0.29; 'class': 0.29; 'host': 0.30; 'construct': 0.30; 'robust': 0.30; 'shut': 0.30; 'skip:\xc2 20': 0.30; 'spelling': 0.30; 'style.': 0.30; 'subject:Digest': 0.30; 'syntax,': 0.30; 'tens': 0.30; 'track,': 0.30; 'functional': 0.31; 'press': 0.72; 'dennis': 0.73; 'hate': 0.73; 'regional': 0.73; 'song': 0.73; 'skip:\xc2 10': 0.74; 'greetings': 0.74; 'dead': 0.77; 'why?': 0.77; 'unsubscribe': 0.79; "'2',": 0.84; "'3',": 0.84; '-0800': 0.84; '0.000': 0.84; '3.000': 0.84; 'abandon': 0.84; 'angelico)': 0.84; 'card:': 0.84; 'joiner': 0.84; 'popular.': 0.84; 'qualities': 0.84; 'rank,': 0.84; 'ranks': 0.84; 'slow.': 0.84; 'url:xahlee': 0.84; 'xah': 0.84; 'email addr:googlegroups.com': 0.91; 'hearts': 0.91; 'items,': 0.91; 'points,': 0.91; "sender's": 0.91; 'suresh': 0.91; 'suspicious': 0.91; '1500': 0.93; 'fuck': 0.93; 'rank': 0.93; 'realistic': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=QzCq0ld2VGm4LE7ncwlY93fm+NvqEh33WWJ76YJn/EQ=; b=bNE8G20MKYWSI+KyIgnmqFnL9cidqci0uUTLgs72Da6QhAAMN3GkXSHYw+5G/5yyH4 mQ5N3eRTxUSv5fCQ7qeFzQ5C5AhWSnBKP3veA0V+/a5je1jtcf5y+dAs/TuE/fCzgOO4 AdvuZ6gtODWUrVCpVbAWLbrbE9IT3SR27A7lU= MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 6 Dec 2011 12:59:54 +0430 Subject: Re: Python-list Digest, Vol 99, Issue 27 From: Sergi Pasoev To: 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.12 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: 390 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1323160196 news.xs4all.nl 6878 [2001:888:2000:d::a6]:41737 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:16707 I do not want GUI, I just want a console application which will read a single character input. When you read from stdin for example, you have it to be terminated. 2011/12/6 : > Send Python-list mailing list submissions to > =C2=A0 =C2=A0 =C2=A0 =C2=A0python-list@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > =C2=A0 =C2=A0 =C2=A0 =C2=A0http://mail.python.org/mailman/listinfo/python= -list > or, via email, send a message with subject or body 'help' to > =C2=A0 =C2=A0 =C2=A0 =C2=A0python-list-request@python.org > > You can reach the person managing the list at > =C2=A0 =C2=A0 =C2=A0 =C2=A0python-list-owner@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Python-list digest..." > > Today's Topics: > > =C2=A0 1. Re: Questions about LISP and Python. (Xah Lee) > =C2=A0 2. Re: Questions about LISP and Python. (Chris Angelico) > =C2=A0 3. Re: 70% [* SPAM *] Re: Re: multiprocessing.Queue blocks when > =C2=A0 =C2=A0 =C2=A0sending =C2=A0 large object (Dennis Lee Bieber) > =C2=A0 4. Single key press (Sergi Pasoev) > =C2=A0 5. Re: Fwd: class print method... (Suresh Sharma) > =C2=A0 6. Re: Single key press (88888 Dihedral) > =C2=A0 7. Re: Single key press (88888 Dihedral) > =C2=A0 8. Re: Scope of variable inside list comprehensions? (Rainer Grimm= ) > =C2=A0 9. Re: Questions about LISP and Python. (alex23) > =C2=A010. Re: Questions about LISP and Python. (Matt Joiner) > > > ---------- Message transf=C3=A9r=C3=A9 ---------- > From:=C2=A0Xah Lee > To:=C2=A0python-list@python.org > Date:=C2=A0Mon, 5 Dec 2011 20:36:45 -0800 (PST) > Subject:=C2=A0Re: Questions about LISP and Python. > On Dec 5, 4:31=C2=A0am, Tim Bradshaw wrote: >> On 2011-12-05 11:51:11 +0000, Xah Lee said: >> >> > python has more readible syntax, more modern computer language >> > concepts, and more robust libraries. These qualities in turn made it >> > popular. >> >> Yet you still post here: why? > > i don't like python, and i prefer emacs lisp. The primary reason is > that python is not functional, especially with python 3. The python > community is full of fanatics with their drivels. In that respect, > it's not unlike Common Lisp community and Scheme lisp community. > > see also: > > =E3=80=88Python Documentation Problems=E3=80=89 > http://xahlee.org/perl-python/python_doc_index.html > > =E3=80=88Computer Language Design: What's List Comprehension and Why is I= t > Harmful?=E3=80=89 > http://xahlee.org/comp/list_comprehension.html > > =E3=80=88Lambda in Python 3000=E3=80=89 > http://xahlee.org/perl-python/python_3000.html > > =E3=80=88What Languages to Hate=E3=80=89 > http://xahlee.org/UnixResource_dir/writ/language_to_hate.html > > =E3=80=88Xah on Programing Languages=E3=80=89 > http://xahlee.org/Periodic_dosage_dir/comp_lang.html > > =C2=A0Xah > > > > ---------- Message transf=C3=A9r=C3=A9 ---------- > From:=C2=A0Chris Angelico > To:=C2=A0python-list@python.org > Date:=C2=A0Tue, 6 Dec 2011 16:10:27 +1100 > Subject:=C2=A0Re: Questions about LISP and Python. > On Tue, Dec 6, 2011 at 3:36 PM, Xah Lee wrote: >> i don't like python, and i prefer emacs lisp. The primary reason is >> that python is not functional, especially with python 3. The python >> community is full of fanatics with their drivels. In that respect, >> it's not unlike Common Lisp community and Scheme lisp community. > > So you hate Python. Fine. Why post here? Why not just abandon Python > as a dead loss and go code in Lithp? > > Clearly something is keeping you here. Is it that there's something > about Python that you really like, or are you just trolling? > > ChrisA > > > > ---------- Message transf=C3=A9r=C3=A9 ---------- > From:=C2=A0Dennis Lee Bieber > To:=C2=A0python-list@python.org > Date:=C2=A0Mon, 05 Dec 2011 21:15:09 -0800 > Subject:=C2=A0Re: 70% [* SPAM *] Re: Re: multiprocessing.Queue blocks whe= n sending large object > On Mon, 5 Dec 2011 18:49:44 +0100, DPalao > wrote: > >>Obviously it was not me who added the disgusting "70% [* SPAM *]" string = to >>the subject. And I'd like to know the answer too. >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0Based upon your headers, somewhere your messag= e went through a spam > check program... > > X-Greylist: Sender succeeded SMTP AUTH, not delayed by > milter-greylist-4.3.7 > =C2=A0 =C2=A0 =C2=A0 =C2=A0(monster.roma2.infn.it [141.108.255.100]); > =C2=A0 =C2=A0 =C2=A0 =C2=A0Mon, 05 Dec 2011 09:02:22 +0100 (CET) > X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, > =C2=A0 =C2=A0 =C2=A0 =C2=A0Antispam-Data: 2011.12.5.74814 > X-PMX-Spam: 70% > X-PMX-Spam-report: The following antispam rules were triggered by this > message: > =C2=A0 =C2=A0 =C2=A0 =C2=A0Rule =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Score Description > =C2=A0 =C2=A0 =C2=A0 =C2=A0RDNS_SUSP_FORGED_FROM =C2=A0 =C2=A0 3.500 From= domain appears to be forged, > =C2=A0 =C2=A0 =C2=A0 =C2=A0and arrived via a host with a known suspicious= rDNS. > =C2=A0 =C2=A0 =C2=A0 =C2=A0SXL_IP_DYNAMIC 3.000 Received via a known dyna= mic IP (SXL lookup): > =C2=A0 =C2=A0 =C2=A0 =C2=A034.140.47.93.fur > =C2=A0 =C2=A0 =C2=A0 =C2=A0FORGED_FROM_GMAIL =C2=A0 =C2=A0 =C2=A0 =C2=A0 = 0.100 Appears to forge gmail in the from > =C2=A0 =C2=A0 =C2=A0 =C2=A0FROM_NAME_ONE_WORD =C2=A0 =C2=A0 =C2=A0 =C2=A0= 0.050 Name in From header is a single word > =C2=A0 =C2=A0 =C2=A0 =C2=A0BODYTEXTP_SIZE_3000_LESS 0.000 Body size of th= e text/plain part is > less > =C2=A0 =C2=A0 =C2=A0 =C2=A0than 3k > =C2=A0 =C2=A0 =C2=A0 =C2=A0BODY_SIZE_1500_1599 0.000 Message body size is= 1500 to 1599 bytes > =C2=A0 =C2=A0 =C2=A0 =C2=A0BODY_SIZE_2000_LESS 0.000 Message body size is= less than 2000 bytes. > =C2=A0 =C2=A0 =C2=A0 =C2=A0BODY_SIZE_5000_LESS 0.000 Message body size is= less than 5000 bytes. > =C2=A0 =C2=A0 =C2=A0 =C2=A0BODY_SIZE_7000_LESS 0.000 Message body size is= less than 5000 bytes. > =C2=A0 =C2=A0 =C2=A0 =C2=A0RDNS_GENERIC_POOLED 0.000 Sender's PTR record = matches generic pooled > -- > =C2=A0 =C2=A0 =C2=A0 =C2=A0Wulfraed =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 Dennis Lee Bieber =C2=A0 =C2=A0 =C2=A0 =C2=A0 AF6VN > =C2=A0 =C2=A0 =C2=A0 =C2=A0wlfraed@ix.netcom.com =C2=A0 =C2=A0HTTP://wlfr= aed.home.netcom.com/ > > > > > ---------- Message transf=C3=A9r=C3=A9 ---------- > From:=C2=A0Sergi Pasoev > To:=C2=A0python-list@python.org > Date:=C2=A0Tue, 6 Dec 2011 10:19:55 +0430 > Subject:=C2=A0Single key press > Hi. > > I wonder if it is realistic to get a single key press in Python > without ncurses or > any similar library. In single key press I mean something like j and k > in Gnu less > program, you press the key and and it is captured by the script without n= eed to > press enter afterwards > > > > ---------- Message transf=C3=A9r=C3=A9 ---------- > From:=C2=A0Suresh Sharma > To:=C2=A0Lie Ryan > Date:=C2=A0Tue, 6 Dec 2011 11:23:16 +0530 > Subject:=C2=A0Re: Fwd: class print method... > Dave / Ryan > Thanks i have got it and it worked after using repr statement. Thanks eve= ryone for their valuable feedback. > > > > On Mon, Dec 5, 2011 at 6:11 PM, Lie Ryan wrote: >> >> On 12/05/2011 10:18 PM, Suresh Sharma wrote: >>> >>> >>> Pls help its really frustrating >>> ---------- Forwarded message ---------- >>> From: Suresh Sharma >>> Date: Monday, December 5, 2011 >>> Subject: class print method... >>> To: "d@davea.name " >> > >>> >>> >>> Dave, >>> Thanx for the quick response, i am sorry that i did not explain >>> correctly look at the code below inspite of this i am just getting clas= s >>> object at memory location.I am sort i typed all this code on my android >>> in a hurry so.indentation could.not.be.managed but this.similar code >>> when i run all my objects created by class deck are not shown but store= d >>> in varioia meory locations. How can i display them. >>> >> >> I think you're in the right track, however I suspect you're running the = code in the shell instead of as a script. The shell uses __repr__() to prin= t objects instead of __str__(), so you either need to use 'print' or you ne= ed to call str(), note the following: >> >> Python 2.7.2+ (default, Oct =C2=A04 2011, 20:06:09) >> [GCC 4.6.1] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> suits =3D ['spades', 'clubs', 'diamonds', 'hearts'] >> >>> ranks =3D ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', '= Q', 'K'] >> >>> class Card: >> ... =C2=A0 =C2=A0 def __init__(self, rank, suit): >> ... =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.suit =3D suit >> ... =C2=A0 =C2=A0 =C2=A0 =C2=A0 self.rank =3D rank >> ... =C2=A0 =C2=A0 def __str__(self): >> ... =C2=A0 =C2=A0 =C2=A0 =C2=A0 return suits[self.suit] + ' ' + ranks[se= lf.rank] >> ... >> >>> Card(2, 3) #1 >> <__main__.Card instance at 0x7f719c3a20e0> >> >>> str(Card(2, 3)) #2 of your >> 'hearts 3' >> >>> print Card(2, 3) #3 >> hearts 3 >> >> In #1, the output is the __repr__() of your Card class; you can modify t= his output by overriding the __repr__() on your Card class. >> >> In #2, the output is the __repr__() of a string, the string is the retur= n value from __str__() of your Card class. The repr of a string is the stri= ng enclosed in quotes, which is why there is an extra pair of quotes. >> >> In #3, you're 'print'-ing a string, the string is the return value from = __str__() of your Card class. There's no extra quotes, since 'print' prints= the string itself, not the repr of the string. >> >> -- >> http://mail.python.org/mailman/listinfo/python-list > > > > > -- > Suresh Sharma > Regional Project Manager, > O2F,Mumbai > Maharashtra-400101. > > > > > > ---------- Message transf=C3=A9r=C3=A9 ---------- > From:=C2=A088888 Dihedral > To:=C2=A0comp.lang.python@googlegroups.com > Date:=C2=A0Mon, 5 Dec 2011 22:27:48 -0800 (PST) > Subject:=C2=A0Re: Single key press > On Tuesday, December 6, 2011 1:49:55 PM UTC+8, Sergi Pasoev wrote: >> Hi. >> >> I wonder if it is realistic to get a single key press in Python >> without ncurses or >> any similar library. In single key press I mean something like j and k >> in Gnu less >> program, you press the key and and it is captured by the script without = need to >> press enter afterwards > > Sounds like the =C2=A0fast key searching for a list in the DOS applicatio= n in the > old days. > > This is easy in GUI of just tens of items, but for thousands of items suc= h > as in a directory listing, some API is really slow. > > > > > > ---------- Message transf=C3=A9r=C3=A9 ---------- > From:=C2=A088888 Dihedral > To:=C2=A0python-list@python.org > Date:=C2=A0Mon, 5 Dec 2011 22:27:48 -0800 (PST) > Subject:=C2=A0Re: Single key press > On Tuesday, December 6, 2011 1:49:55 PM UTC+8, Sergi Pasoev wrote: >> Hi. >> >> I wonder if it is realistic to get a single key press in Python >> without ncurses or >> any similar library. In single key press I mean something like j and k >> in Gnu less >> program, you press the key and and it is captured by the script without = need to >> press enter afterwards > > Sounds like the =C2=A0fast key searching for a list in the DOS applicatio= n in the > old days. > > This is easy in GUI of just tens of items, but for thousands of items suc= h > as in a directory listing, some API is really slow. > > > > > > ---------- Message transf=C3=A9r=C3=A9 ---------- > From:=C2=A0Rainer Grimm > To:=C2=A0python-list@python.org > Date:=C2=A0Mon, 5 Dec 2011 22:42:35 -0800 (PST) > Subject:=C2=A0Re: Scope of variable inside list comprehensions? > Hello, > >> =C2=A0 =C2=A0 try: >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 songs =3D [Song(id) for id in song_ids] >> =C2=A0 =C2=A0 except Song.DoesNotExist: >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 print "unknown song id (%d)" % id > that's is a bad programming style. So it will be forbidden with python 3.= The reason is that list comprehension is a construct from the functional w= orld. It's only syntactic sugar for the functions map and filter. So functi= ons have to be pure functions. To say it in other words, they have to be si= de-effect free. But the python construct from above pollutes the namespace = with name id. > > Greetings from Rottenburg, > Rainer > > > > ---------- Message transf=C3=A9r=C3=A9 ---------- > From:=C2=A0alex23 > To:=C2=A0python-list@python.org > Date:=C2=A0Mon, 5 Dec 2011 23:02:42 -0800 (PST) > Subject:=C2=A0Re: Questions about LISP and Python. > On Dec 6, 2:36=C2=A0pm, Xah Lee wrote: >> The python community is full of fanatics with their drivels. > > You do know that you could just fuck right off and leave us to it, > yes? > > In general, it's the person who is shrilly imposing their minority > opinion on a disinterested audience that deserves the title 'fanatic'. > > > > ---------- Message transf=C3=A9r=C3=A9 ---------- > From:=C2=A0Matt Joiner > To:=C2=A0alex23 > Date:=C2=A0Tue, 6 Dec 2011 18:54:09 +1100 > Subject:=C2=A0Re: Questions about LISP and Python. > This guy is an even better troll than that 88888 guy. His spelling is > equally bad. His essays make some good points, but I don't see why he > doesn't shut his trap and move on. > > =E0=B2=A0_=E0=B2=A0 > > > > On Tue, Dec 6, 2011 at 6:02 PM, alex23 wrote: >> On Dec 6, 2:36=C2=A0pm, Xah Lee wrote: >>> The python community is full of fanatics with their drivels. >> >> You do know that you could just fuck right off and leave us to it, >> yes? >> >> In general, it's the person who is shrilly imposing their minority >> opinion on a disinterested audience that deserves the title 'fanatic'. >> -- >> http://mail.python.org/mailman/listinfo/python-list > > > -- > http://mail.python.org/mailman/listinfo/python-list