2012/8/28 Richard D. Moores
> On Mon, Aug 27, 2012 at 6:33 PM, Japhy Bartlett
> wrote:
>
> > something like:
> >
> > def _validate_int(obj):
> > """Raise an exception if obj is not an integer."""
> > m = int(obj + 0) # May raise TypeError.
> > if obj != m:
> > raise ValueErr
On Tue, Aug 28, 2012 at 12:13 AM, Jerry Zhang wrote:
>
>
> 2012/8/28 Richard D. Moores
>
>> On Mon, Aug 27, 2012 at 6:33 PM, Japhy Bartlett
>> wrote:
>>
>> > something like:
>> >
>> > def _validate_int(obj):
>> > """Raise an exception if obj is not an integer."""
>> > m = int(obj + 0) #
Op 28-08-12 10:06, Richard D. Moores schreef:
On Tue, Aug 28, 2012 at 12:13 AM, Jerry Zhang wrote:
2012/8/28 Richard D. Moores
On Mon, Aug 27, 2012 at 6:33 PM, Japhy Bartlett
wrote:
something like:
def _validate_int(obj):
"""Raise an exception if obj is not an integer."""
m =
Timo wrote:
> Op 28-08-12 10:06, Richard D. Moores schreef:
>> On Tue, Aug 28, 2012 at 12:13 AM, Jerry Zhang
>> wrote:
>>>
>>> 2012/8/28 Richard D. Moores
>>>
On Mon, Aug 27, 2012 at 6:33 PM, Japhy Bartlett
wrote:
> something like:
>
> def _validate_int(obj):
>
On 28/08/2012 05:13, Richard D. Moores wrote:
On Mon, Aug 27, 2012 at 6:33 PM, Japhy Bartlett wrote:
something like:
def _validate_int(obj):
"""Raise an exception if obj is not an integer."""
m = int(obj + 0) # May raise TypeError.
if obj != m:
raise ValueError('expec
On Tue, Aug 28, 2012 at 1:21 AM, Timo wrote:
> Op 28-08-12 10:06, Richard D. Moores schreef:
>> What if I wanted 3., 1234., etc. to be considered ints, as they are by
>> _validate_int() ?
>
>
isinstance(3., (int, float))
> True
>
> Because 3. is a float, not int.
And
>>> isinstance(3.7, (i
On Tue, Aug 28, 2012 at 11:13 AM, Richard D. Moores wrote:
> On Tue, Aug 28, 2012 at 1:21 AM, Timo wrote:
> > Op 28-08-12 10:06, Richard D. Moores schreef:
>
> >> What if I wanted 3., 1234., etc. to be considered ints, as they are by
> >> _validate_int() ?
> >
> >
> isinstance(3., (int, flo
Richard D. Moores wrote:
> On Tue, Aug 28, 2012 at 1:21 AM, Timo wrote:
>> Op 28-08-12 10:06, Richard D. Moores schreef:
>
>>> What if I wanted 3., 1234., etc. to be considered ints, as they are by
>>> _validate_int() ?
>>
>>
> isinstance(3., (int, float))
>> True
>>
>> Because 3. is a floa
Hello,
I am trying to do the following :
1) Ask user for the length of the word that he'd like to guess (for
hangman game).
2) Pick a random word from /usr/share/dict/words (which I understand
is not the best choice for hangman).
3) Call a function that would pick a random word to proceed further
On Mon, 27 Aug 2012, Richard D. Moores wrote:
On Mon, Aug 27, 2012 at 6:33 PM, Japhy Bartlett wrote:
something like:
def _validate_int(obj):
"""Raise an exception if obj is not an integer."""
m = int(obj + 0) # May raise TypeError.
if obj != m:
raise ValueError('expected
On Tue, Aug 28, 2012 at 1:23 PM, Dharmit Shah wrote:
> Hello,
>
> I am trying to do the following :
>
> 1) Ask user for the length of the word that he'd like to guess (for
> hangman game).
> 2) Pick a random word from /usr/share/dict/words (which I understand
> is not the best choice for hangman)
On 28-Aug-12 04:23, Dharmit Shah wrote:
Hello,
I am trying to do the following :
1) Ask user for the length of the word that he'd like to guess (for
hangman game).
2) Pick a random word from /usr/share/dict/words (which I understand
is not the best choice for hangman).
3) Call a function that w
On Tue, Aug 28, 2012 at 6:00 AM, Peter Otten <__pete...@web.de> wrote:
>
> Anyway here's an alternative implementation:
>
def vi(x):
> ... if not isinstance(x, numbers.Number):
> ... raise TypeError
> ... if not int(x) == x:
> ... raise ValueError
You could tes
eryksun wrote:
> On Tue, Aug 28, 2012 at 6:00 AM, Peter Otten <__pete...@web.de> wrote:
>>
>> Anyway here's an alternative implementation:
>>
> def vi(x):
>> ... if not isinstance(x, numbers.Number):
>> ... raise TypeError
>> ... if not int(x) == x:
>> ... raise
On Tue, Aug 28, 2012 at 9:08 AM, Peter Otten <__pete...@web.de> wrote:
>
> That would reject "floats with an integral value" and therefore doesn't
> comply with the -- non-existing -- spec.
Gotcha.
>> >>> import numbers
>> >>> isinstance("42", numbers.Integral)
>> False
>> >>> num
On 08/28/2012 07:23 AM, Dharmit Shah wrote:
> Hello,
>
> I am trying to do the following :
>
> 1) Ask user for the length of the word that he'd like to guess (for
> hangman game).
> 2) Pick a random word from /usr/share/dict/words (which I understand
> is not the best choice for hangman).
> 3) Call
Hello,
@Hugo Arts : Thank you! That was awesome to read. Thanks for the len()
suggestion.
@ Steve : Thank you. As suggested by Dave Angel, I am going to try the
loop. And even before implementing it, I can feel that it's going to
be more efficient than recursion.
@Dave Angel : Thank you for the
On 28/08/2012 16:51, Dharmit Shah wrote:
@ Steve : Thank you. As suggested by Dave Angel, I am going to try the
loop. And even before implementing it, I can feel that it's going to
be more efficient than recursion.
May I ask why you appear to be concerned with efficiency for a hangman game?
On 28/08/12 16:51, Dharmit Shah wrote:
@Dave Angel : Thank you for the loop idea. It didn't strike me at all.
For some reason some beginners seem to find recursion a natural pattern.
Many others, including quite experienced programmers find it a mind
bending concept.
But as a general rule, wh
On 28-Aug-12 09:03, Mark Lawrence wrote:
On 28/08/2012 16:51, Dharmit Shah wrote:
@ Steve : Thank you. As suggested by Dave Angel, I am going to try the
loop. And even before implementing it, I can feel that it's going to
be more efficient than recursion.
May I ask why you appear to be conce
On 28-Aug-12 09:13, Alan Gauld wrote:
On 28/08/12 16:51, Dharmit Shah wrote:
@Dave Angel : Thank you for the loop idea. It didn't strike me at all.
For some reason some beginners seem to find recursion a natural pattern.
There is a certain "hey, you can do that? That's cool!" factor when yo
I'm working on another Python replacement for a Bash script, and I ran
into a need for enhanced time zone functions. Following directions I
found on a web site, I did the following:
# easy_install --upgrade pytz
Searching for pytz
Reading http://pypi.python.org/simple/pytz/
Reading http://pytz.sou
On Tue, Aug 28, 2012 at 1:41 PM, Ray Jones wrote:
> I'm working on another Python replacement for a Bash script, and I ran
> into a need for enhanced time zone functions. Following directions I
> found on a web site, I did the following:
>
> # easy_install --upgrade pytz
> Searching for pytz
> Rea
Ray Jones wrote:
> I'm working on another Python replacement for a Bash script, and I ran
> into a need for enhanced time zone functions. Following directions I
> found on a web site, I did the following:
>
> # easy_install --upgrade pytz
> Searching for pytz
> Reading http://pypi.python.org/simp
On 08/28/2012 11:06 AM, Peter Otten wrote:
> Ray Jones wrote:
>
>> I'm working on another Python replacement for a Bash script, and I ran
>> into a need for enhanced time zone functions. Following directions I
>> found on a web site, I did the following:
>>
>> # easy_install --upgrade pytz
>> Searc
On 29/08/12 03:41, Ray Jones wrote:
I'm working on another Python replacement for a Bash script, and I ran
into a need for enhanced time zone functions. Following directions I
found on a web site, I did the following:
# easy_install --upgrade pytz
[...]
Everything I'm reading suggests that now
Ray Jones wrote:
> On 08/28/2012 11:06 AM, Peter Otten wrote:
>> Ray Jones wrote:
>>
>>> I'm working on another Python replacement for a Bash script, and I ran
>>> into a need for enhanced time zone functions. Following directions I
>>> found on a web site, I did the following:
>>>
>>> # easy_inst
On 08/28/2012 12:35 PM, Steven D'Aprano wrote:
> On 29/08/12 03:41, Ray Jones wrote:
>> I'm working on another Python replacement for a Bash script, and I ran
>> into a need for enhanced time zone functions. Following directions I
>> found on a web site, I did the following:
>>
>> # easy_install -
On 08/28/2012 12:44 PM, Peter Otten wrote:
> Ray Jones wrote:
>
>> On 08/28/2012 11:06 AM, Peter Otten wrote:
>>> Ray Jones wrote:
>>>
I'm working on another Python replacement for a Bash script, and I ran
into a need for enhanced time zone functions. Following directions I
found on
On Tue, Aug 28, 2012 at 2:39 PM, Ray Jones wrote:
>
>> Do you have multiple python installations on your machine? Do you run
>> easy_install in one and ipython in another?
>
> Perhaps. But the module is not accessible from the 'python' shell, from
> 'idle', or from iPython.
>
> As I peruse Synapti
On 08/28/2012 12:35 PM, Steven D'Aprano wrote:
> On 29/08/12 03:41, Ray Jones wrote:
>> I'm working on another Python replacement for a Bash script, and I ran
>> into a need for enhanced time zone functions. Following directions I
>> found on a web site, I did the following:
>>
>> # easy_install --
On 08/28/2012 12:52 PM, eryksun wrote:
> On Tue, Aug 28, 2012 at 2:39 PM, Ray Jones wrote:
>>> Do you have multiple python installations on your machine? Do you run
>>> easy_install in one and ipython in another?
>> Perhaps. But the module is not accessible from the 'python' shell, from
>> 'idle',
On Tue, Aug 28, 2012 at 4:00 PM, Ray Jones wrote:
>
> Oops. No, I see that /usr/local/lib/python2.7/dist-packages is included
> in the sys.path. Now what?
Good, but does sys.path contain
/usr/local/lib/python2.7/dist-packages/pytz-2012d-py2.7.egg?
___
T
On 08/28/2012 01:11 PM, eryksun wrote:
> On Tue, Aug 28, 2012 at 4:00 PM, Ray Jones wrote:
>> Oops. No, I see that /usr/local/lib/python2.7/dist-packages is included
>> in the sys.path. Now what?
> Good, but does sys.path contain
> /usr/local/lib/python2.7/dist-packages/pytz-2012d-py2.7.egg?
No.
On 08/28/2012 01:11 PM, eryksun wrote:
> On Tue, Aug 28, 2012 at 4:00 PM, Ray Jones wrote:
>> Oops. No, I see that /usr/local/lib/python2.7/dist-packages is included
>> in the sys.path. Now what?
> Good, but does sys.path contain
> /usr/local/lib/python2.7/dist-packages/pytz-2012d-py2.7.egg?
More
On 8/28/2012 1:17 PM Ray Jones said...
On 08/28/2012 01:11 PM, eryksun wrote:
On Tue, Aug 28, 2012 at 4:00 PM, Ray Jones wrote:
Oops. No, I see that /usr/local/lib/python2.7/dist-packages is included
in the sys.path. Now what?
Good, but does sys.path contain
/usr/local/lib/python2.7/dist-pack
On 08/28/2012 01:35 PM, Emile van Sebille wrote:
> On 8/28/2012 1:17 PM Ray Jones said...
>> On 08/28/2012 01:11 PM, eryksun wrote:
>>> On Tue, Aug 28, 2012 at 4:00 PM, Ray Jones wrote:
Oops. No, I see that /usr/local/lib/python2.7/dist-packages is
included
in the sys.path. Now what
On 28/08/12 17:34, Steve Willoughby wrote:
For some reason some beginners seem to find recursion a natural pattern.
There is a certain "hey, you can do that? That's cool!" factor when you
first discover recursion.
My point was that it seems to be a natural idea for many beginners, they
dis
On Tue, Aug 28, 2012 at 5:14 PM, Alan Gauld wrote:
> On 28/08/12 17:34, Steve Willoughby wrote:
>>> For some reason some beginners seem to find recursion a natural pattern.
>>
>>
>> There is a certain "hey, you can do that? That's cool!" factor when you
>> first discover recursion.
>
>
>
On 8/28/2012 1:48 PM Ray Jones said...
On 08/28/2012 01:35 PM, Emile van Sebille wrote:
You installed this with easy_install, so the version of python therein
referenced is the same one that now should have access to it.
Try : which easy_install
then cat the result. The first line points t
Hello,
I wrote a program that I want to have running 24/7. But the problem is that I
also want to write and run other programs. I'm using Idle and it won't let me
run more than one script at a time. Do you know if there's a way to do this? Or
do I need to buy a second computer?
Thanks,
Ben
On Tue, Aug 28, 2012 at 3:30 PM, Benjamin Fishbein wrote:
> Hello,
> I wrote a program that I want to have running 24/7. But the problem is
> that I also want to write and run other programs. I'm using Idle and it
> won't let me run more than one script at a time. Do you know if there's a
> way to
On 08/28/2012 03:30 PM, Benjamin Fishbein wrote:
> Hello,
> I wrote a program that I want to have running 24/7. But the problem is that I
> also want to write and run other programs. I'm using Idle and it won't let me
> run more than one script at a time. Do you know if there's a way to do this?
On 28 Aug 2012 18:33, "Benjamin Fishbein" wrote:
>
> Hello,
> I wrote a program that I want to have running 24/7. But the problem is
that I also want to write and run other programs. I'm using Idle and it
won't let me run more than one script at a time. Do you know if there's a
way to do this? Or
I'm on a Mac. Using Lion. I just tried opening the terminal and typing
"python." And I'm able to open several terminal windows this way. I think
this should be able to run many programs simultaneously. Thanks for your
help.
-Ben
On Tue, Aug 28, 2012 at 6:04 PM, Brian van den Broek <
brian.van.den
Stupid question: how do I run a program from the terminal? I've always just
gone to the drop down menu and clicked run to do it in idle.
On Tue, Aug 28, 2012 at 6:17 PM, Ben Fishbein wrote:
> I'm on a Mac. Using Lion. I just tried opening the terminal and typing
> "python." And I'm able to open
On 08/28/2012 07:19 PM, Ben Fishbein wrote:
> Stupid question: how do I run a program from the terminal? I've always just
> gone to the drop down menu and clicked run to do it in idle.
>
>
Haven't you noticed that the correct method of posting on this forum is
to put your remarks AFTER the part yo
On 29/08/12 08:30, Benjamin Fishbein wrote:
Hello,
I wrote a program that I want to have running 24/7. But the problem is
that I also want to write and run other programs. I'm using Idle and
it won't let me run more than one script at a time.
Then don't use IDLE. IDLE is for running code intera
> On 08/28/2012 03:30 PM, Benjamin Fishbein wrote:
>> Hello,
>> I wrote a program that I want to have running 24/7. But the problem is
>> that I also want to write and run other programs. I'm using Idle and it
>> won't let me run more than one script at a time. Do you know if there's
>> a way to do
49 matches
Mail list logo