Python-list Digest, Vol 99, Issue 27

Sergi Pasoev s.pasoev at gmail.com
Tue Dec 6 03:29:54 EST 2011


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  <python-list-request at python.org>:
> Send Python-list mailing list submissions to
>        python-list at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mail.python.org/mailman/listinfo/python-list
> or, via email, send a message with subject or body 'help' to
>        python-list-request at python.org
>
> You can reach the person managing the list at
>        python-list-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Python-list digest..."
>
> Today's Topics:
>
>   1. Re: Questions about LISP and Python. (Xah Lee)
>   2. Re: Questions about LISP and Python. (Chris Angelico)
>   3. Re: 70% [* SPAM *] Re: Re: multiprocessing.Queue blocks when
>      sending   large object (Dennis Lee Bieber)
>   4. Single key press (Sergi Pasoev)
>   5. Re: Fwd: class print method... (Suresh Sharma)
>   6. Re: Single key press (88888 Dihedral)
>   7. Re: Single key press (88888 Dihedral)
>   8. Re: Scope of variable inside list comprehensions? (Rainer Grimm)
>   9. Re: Questions about LISP and Python. (alex23)
>  10. Re: Questions about LISP and Python. (Matt Joiner)
>
>
> ---------- Message transféré ----------
> From: Xah Lee <xahlee at gmail.com>
> To: python-list at python.org
> Date: Mon, 5 Dec 2011 20:36:45 -0800 (PST)
> Subject: Re: Questions about LISP and Python.
> On Dec 5, 4:31 am, Tim Bradshaw <t... at tfeb.org> 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:
>
> 〈Python Documentation Problems〉
> http://xahlee.org/perl-python/python_doc_index.html
>
> 〈Computer Language Design: What's List Comprehension and Why is It
> Harmful?〉
> http://xahlee.org/comp/list_comprehension.html
>
> 〈Lambda in Python 3000〉
> http://xahlee.org/perl-python/python_3000.html
>
> 〈What Languages to Hate〉
> http://xahlee.org/UnixResource_dir/writ/language_to_hate.html
>
> 〈Xah on Programing Languages〉
> http://xahlee.org/Periodic_dosage_dir/comp_lang.html
>
>  Xah
>
>
>
> ---------- Message transféré ----------
> From: Chris Angelico <rosuav at gmail.com>
> To: python-list at python.org
> Date: Tue, 6 Dec 2011 16:10:27 +1100
> Subject: Re: Questions about LISP and Python.
> On Tue, Dec 6, 2011 at 3:36 PM, Xah Lee <xahlee at gmail.com> 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éré ----------
> From: Dennis Lee Bieber <wlfraed at ix.netcom.com>
> To: python-list at python.org
> Date: Mon, 05 Dec 2011 21:15:09 -0800
> Subject: Re: 70% [* SPAM *] Re: Re: multiprocessing.Queue blocks when sending large object
> On Mon, 5 Dec 2011 18:49:44 +0100, DPalao <dpalao.python at gmail.com>
> 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.
>>
>        Based upon your headers, somewhere your message went through a spam
> check program...
>
> X-Greylist: Sender succeeded SMTP AUTH, not delayed by
> milter-greylist-4.3.7
>        (monster.roma2.infn.it [141.108.255.100]);
>        Mon, 05 Dec 2011 09:02:22 +0100 (CET)
> X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379,
>        Antispam-Data: 2011.12.5.74814
> X-PMX-Spam: 70%
> X-PMX-Spam-report: The following antispam rules were triggered by this
> message:
>        Rule                      Score Description
>        RDNS_SUSP_FORGED_FROM     3.500 From domain appears to be forged,
>        and arrived via a host with a known suspicious rDNS.
>        SXL_IP_DYNAMIC 3.000 Received via a known dynamic IP (SXL lookup):
>        34.140.47.93.fur
>        FORGED_FROM_GMAIL         0.100 Appears to forge gmail in the from
>        FROM_NAME_ONE_WORD        0.050 Name in From header is a single word
>        BODYTEXTP_SIZE_3000_LESS 0.000 Body size of the text/plain part is
> less
>        than 3k
>        BODY_SIZE_1500_1599 0.000 Message body size is 1500 to 1599 bytes
>        BODY_SIZE_2000_LESS 0.000 Message body size is less than 2000 bytes.
>        BODY_SIZE_5000_LESS 0.000 Message body size is less than 5000 bytes.
>        BODY_SIZE_7000_LESS 0.000 Message body size is less than 5000 bytes.
>        RDNS_GENERIC_POOLED 0.000 Sender's PTR record matches generic pooled
> --
>        Wulfraed                 Dennis Lee Bieber         AF6VN
>        wlfraed at ix.netcom.com    HTTP://wlfraed.home.netcom.com/
>
>
>
>
> ---------- Message transféré ----------
> From: Sergi Pasoev <s.pasoev at gmail.com>
> To: python-list at python.org
> Date: Tue, 6 Dec 2011 10:19:55 +0430
> Subject: Single 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 need to
> press enter afterwards
>
>
>
> ---------- Message transféré ----------
> From: Suresh Sharma <ss27051980 at gmail.com>
> To: Lie Ryan <lie.1296 at gmail.com>
> Date: Tue, 6 Dec 2011 11:23:16 +0530
> Subject: Re: Fwd: class print method...
> Dave / Ryan
> Thanks i have got it and it worked after using repr statement. Thanks everyone for their valuable feedback.
>
>
>
> On Mon, Dec 5, 2011 at 6:11 PM, Lie Ryan <lie.1296 at gmail.com> 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 at davea.name <mailto:d at davea.name>" <d at davea.name
>>> <mailto:d at 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 class
>>> 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 stored
>>> 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 print objects instead of __str__(), so you either need to use 'print' or you need to call str(), note the following:
>>
>> Python 2.7.2+ (default, Oct  4 2011, 20:06:09)
>> [GCC 4.6.1] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> suits = ['spades', 'clubs', 'diamonds', 'hearts']
>> >>> ranks = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']
>> >>> class Card:
>> ...     def __init__(self, rank, suit):
>> ...         self.suit = suit
>> ...         self.rank = rank
>> ...     def __str__(self):
>> ...         return suits[self.suit] + ' ' + ranks[self.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 this output by overriding the __repr__() on your Card class.
>>
>> In #2, the output is the __repr__() of a string, the string is the return value from __str__() of your Card class. The repr of a string is the string 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éré ----------
> From: 88888 Dihedral <dihedral88888 at googlemail.com>
> To: comp.lang.python at googlegroups.com
> Date: Mon, 5 Dec 2011 22:27:48 -0800 (PST)
> Subject: Re: 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  fast key searching for a list in the DOS application in the
> old days.
>
> This is easy in GUI of just tens of items, but for thousands of items such
> as in a directory listing, some API is really slow.
>
>
>
>
>
> ---------- Message transféré ----------
> From: 88888 Dihedral <dihedral88888 at googlemail.com>
> To: python-list at python.org
> Date: Mon, 5 Dec 2011 22:27:48 -0800 (PST)
> Subject: Re: 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  fast key searching for a list in the DOS application in the
> old days.
>
> This is easy in GUI of just tens of items, but for thousands of items such
> as in a directory listing, some API is really slow.
>
>
>
>
>
> ---------- Message transféré ----------
> From: Rainer Grimm <r.grimm at science-computing.de>
> To: python-list at python.org
> Date: Mon, 5 Dec 2011 22:42:35 -0800 (PST)
> Subject: Re: Scope of variable inside list comprehensions?
> Hello,
>
>>     try:
>>         songs = [Song(id) for id in song_ids]
>>     except Song.DoesNotExist:
>>         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 world. It's only syntactic sugar for the functions map and filter. So functions have to be pure functions. To say it in other words, they have to be side-effect free. But the python construct from above pollutes the namespace with name id.
>
> Greetings from Rottenburg,
> Rainer
>
>
>
> ---------- Message transféré ----------
> From: alex23 <wuwei23 at gmail.com>
> To: python-list at python.org
> Date: Mon, 5 Dec 2011 23:02:42 -0800 (PST)
> Subject: Re: Questions about LISP and Python.
> On Dec 6, 2:36 pm, Xah Lee <xah... at gmail.com> 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éré ----------
> From: Matt Joiner <anacrolix at gmail.com>
> To: alex23 <wuwei23 at gmail.com>
> Date: Tue, 6 Dec 2011 18:54:09 +1100
> Subject: Re: 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.
>
> ಠ_ಠ
>
>
>
> On Tue, Dec 6, 2011 at 6:02 PM, alex23 <wuwei23 at gmail.com> wrote:
>> On Dec 6, 2:36 pm, Xah Lee <xah... at gmail.com> 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



More information about the Python-list mailing list