>site.py adds the exit/quit Quitter instances to builtins (2.x
>__builtin__). When called they raise SystemExit, like sys.exit does.
So it does. You learn something new every day...
When did that first happen? It was one of my biggest frustrations
with Python when I first started learning, that
> On Sat, Feb 9, 2013 at 8:33 PM, Alan Gauld
> wrote:
>>
>> Where does exit() come from? Usually its from sys but you
>> don't import from sys anywhere...
>
> site.py adds the exit/quit Quitter instances to builtins (2.x
> __builtin__). When called they raise SystemExit, like sys.exit does
> Maybe the OP meant to say 'quit()' ? That does not require an import.
Ooh! another option I didn't know about!
So many ways to get rid of Python and here's me been importing sys
or raising SystemExit all these years... :-)
Alan G.
___
Tutor mailli
ALAN GAULD wrote:
>> Maybe the OP meant to say 'quit()' ? That does not require an import.
>
>
> Ooh! another option I didn't know about!
> So many ways to get rid of Python and here's me been importing sys
> or raising SystemExit all these years... :-)
I tend to use none of these and my script
On Sun, Feb 10, 2013 at 3:39 AM, ALAN GAULD wrote:
> So it does. You learn something new every day...
> When did that first happen? It was one of my biggest frustrations
> with Python when I first started learning, that you couldn't call exit
> without first importing sys (v1.3). But I never notic
Hello,
I have a program where I'm overriding the retrieval of items from a list.
As background: The data held by the lists are calculated but then read
potentially many times thereafter, so in order to prevent needless
re-calculating the same value over and over, and to remove checking/caching
co
On 02/10/2013 09:32 AM, Walter Prins wrote:
Hello,
I have a program where I'm overriding the retrieval of items from a list.
As background: The data held by the lists are calculated but then read
potentially many times thereafter, so in order to prevent needless
re-calculating the same value o
On 11/02/13 01:32, Walter Prins wrote:
Hello,
I have a program where I'm overriding the retrieval of items from a list.
As background:
[...snip interesting but irrelevant background...]
Here's a test application that demonstrates the issue:
[...snip overly complicated application...]
Her
Walter Prins wrote:
> Hello,
>
> I have a program where I'm overriding the retrieval of items from a list.
> As background: The data held by the lists are calculated but then read
> potentially many times thereafter, so in order to prevent needless
> re-calculating the same value over and over,
On 02/10/2013 10:10 AM, Dave Angel wrote:
On 02/10/2013 09:32 AM, Walter Prins wrote:
Hello,
I have a program where I'm overriding the retrieval of items from a list.
As background: The data held by the lists are calculated but then read
potentially many times thereafter, so in order to preve
Peter Otten wrote:
> def __iter__(self):
> for i in range(len(self)):
> return self[i]
That should of course be 'yield', not 'return'
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.pytho
On 02/09/2013 05:46 AM, Albert-Jan Roskam wrote:
- Original Message -
From: Jim Byrnes To: tutor@python.org Cc:
Sent: Saturday, February 9, 2013 3:02 AM Subject: [Tutor] Which pip
for Ubuntu 12.04
How important is it to have the latest pip installed?
Initially I want to use it to ins
I am out of the office until 19/02/2013.
I am attending an IBM Redbook residency in Raleigh, NC, USA ... and have
limited access to my mail.
My response to your email will be delayed during this time.
Thanks
David J Pearson MBCS CITP CEng MIET
Technical Staff Member
Solution Architect [Mobile,
Op 10-02-13 17:01, Jim Byrnes schreef:
On 02/09/2013 05:46 AM, Albert-Jan Roskam wrote:
- Original Message -
From: Jim Byrnes To: tutor@python.org Cc:
Sent: Saturday, February 9, 2013 3:02 AM Subject: [Tutor] Which pip
for Ubuntu 12.04
How important is it to have the latest pip insta
On Sun, Feb 10, 2013 at 1:53 PM, Timo wrote:
> Op 10-02-13 17:01, Jim Byrnes schreef:
>
> On 02/09/2013 05:46 AM, Albert-Jan Roskam wrote:
>>
>>> - Original Message -
>>>
>>> From: Jim Byrnes To: tutor@python.org Cc:
Sent: Saturday, February 9, 2013 3:02 AM Subject: [Tutor] Which
Hi guys, I wondered if you knew what I could add to this code so that when the
user enters 1 from the menu and then doesn't enter a valid binary number the
program should ask them over and over again until valid binary number is
entered.
here is the code:
def show_menu():
print("==
On 10 February 2013 15:29, Ghadir Ghasemi wrote:
> Hi guys, I wondered if you knew what I could add to this code so that when
> the user enters 1 from the menu and then doesn't enter a valid binary number
> the program should ask them over and over again until valid binary number is
> entered.
On 10 February 2013 14:32, Walter Prins wrote:
[snip
>
> This worked mostly fine, however yesterday I ran into a slightly unexpected
> problem when I found that when the list contents is iterated over and values
> retrieved that way rather than via [], then __getitem__ is in fact *not*
> called on
The bigger issue with mongo is the apt versions are old. Be sure to follow
the instructions on mongos site.
If you pip install pymongo with a ubunuto or mint build your gtg
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription opt
I am changing the subject line to one that is more explicit.
On 2/10/2013 3:29 PM, Ghadir Ghasemi wrote:
elif choice not in '1' or '2' or '3':
print("Invalid input-try again!")
This works, but not for the reasons you had in mind.
For experiment, try:
>>> '1' or '2' or '3'
'1'
>
On 10/02/13 20:25, ALAN GAULD wrote:
Maybe the OP meant to say 'quit()' ? That does not require an import.
Ooh! another option I didn't know about!
So many ways to get rid of Python and here's me been importing sys
or raising SystemExit all these years... :-)
exit() and quit() (as added
On Sun, Feb 10, 2013 at 1:53 PM, Timo wrote:
>> However, I still wonder if using the outdated pip from the repository will
>> allow me to install the latest python packages? Will trying to use an
>> outdated pip cause me problems?
>
> I doubt it will. Have a look at the pip changelog to see what h
Hi Alan,
Here are the additional details:
Python version: 2.7.3
OS version: Windows 7 -64 bit
I have an application that has a automation layer built in python. During every
subsequent runs, I want to log the process threads and GDI objects ( the one
you see in the Windows task manager) in my p
I have a text file with each line in following format:
Book Name, Author Name, Genre, Publication Date
I would like to perform following queries on this file:
* Get all books written by an author
* Remove all books of an author
* Get information about a book (pretty print matching line!)
* Ge
On 02/11/2013 12:14 AM, neubyr wrote:
> I have a text file with each line in following format:
>
> Book Name, Author Name, Genre, Publication Date
>
> I would like to perform following queries on this file:
> * Get all books written by an author
> * Remove all books of an author
> * Get informa
On 02/11/2013 12:14 AM, neubyr wrote:
I have a text file with each line in following format:
Book Name, Author Name, Genre, Publication Date
I would like to perform following queries on this file:
* Get all books written by an author
* Remove all books of an author
* Get information about
26 matches
Mail list logo