Dick Moores wrote:
> At 07:39 PM 7/12/2008, Kent Johnson wrote:
>> On Sat, Jul 12, 2008 at 6:03 PM, Dick Moores <[EMAIL PROTECTED]> wrote:
>> > At 01:34 PM 7/12/2008, Kent Johnson wrote:
>>
>> >> In [2]: assert(False, "Asserted false")
>> >>
>> >> This is "assert condition" where the condition is a
On Sat, Jul 12, 2008 at 8:10 PM, Dick Moores <[EMAIL PROTECTED]> wrote:
> But why will a tuple with two elements will always evaluate to
> True?
>
> In [2]: (3,5) == True
> Out[2]: False
> In [3]: ("qwerty", "asdfg") == True
> Out[3]: False
> In [4]:
>
>
The value formally known as True is only on
At 07:39 PM 7/12/2008, Kent Johnson wrote:
On Sat, Jul 12, 2008 at 6:03 PM, Dick Moores <[EMAIL PROTECTED]> wrote:
> At 01:34 PM 7/12/2008, Kent Johnson wrote:
>> In [2]: assert(False, "Asserted false")
>>
>> This is "assert condition" where the condition is a tuple with two
>> elements, hence t
On Sat, Jul 12, 2008 at 6:03 PM, Dick Moores <[EMAIL PROTECTED]> wrote:
> At 01:34 PM 7/12/2008, Kent Johnson wrote:
>> In [2]: assert(False, "Asserted false")
>>
>> This is "assert condition" where the condition is a tuple with two
>> elements, hence true so there is no output.
>
> In [13]: asser
At 01:34 PM 7/12/2008, Kent Johnson wrote:
On Sat, Jul 12, 2008 at 4:01 PM, Dick Moores <[EMAIL PROTECTED]> wrote:
> _Python in a NutShell_, p. 138 has a bit on the assert statement which I
> don't completely understand.
>
> It says the syntax is
>
> assert condition[, expression]
>
> I was hopin
At 01:24 PM 7/12/2008, Danny Yoo wrote:
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
> In my code I have
>
> assert(len(list(set(colors_used_this_cycle))) ==
> len(colors_used_this_cycle), "A color has been used twice!")
>
> But it doesn't work. Cases where a color has been used m
At 01:28 PM 7/12/2008, Michiel Overtoom wrote:
Dick wrote:
> I was hoping to put some sort of explanation of failure in an
> assert statement. But how to do it?
> So I'd like to know what that 'expression' in the syntax can be,
> and how to use it.
I think it would help if you separate the dete
On Sat, Jul 12, 2008 at 4:01 PM, Dick Moores <[EMAIL PROTECTED]> wrote:
> _Python in a NutShell_, p. 138 has a bit on the assert statement which I
> don't completely understand.
>
> It says the syntax is
>
> assert condition[, expression]
>
> I was hoping to put some sort of explanation of failure
On Sat, Jul 12, 2008 at 9:47 AM, Paul Melvin
<[EMAIL PROTECTED]> wrote:
> And how can i go about testing that i get appropriate values during the
> testing/building phase (generally speaking), is it lots of print/return
> statements and then remove them?
Take a look at the doctest and unittest mo
Dick wrote:
> I was hoping to put some sort of explanation of failure in an
> assert statement. But how to do it?
> So I'd like to know what that 'expression' in the syntax can be,
> and how to use it.
I think it would help if you separate the detection of duplicate colors from
the assert state
> In my code I have
>
> assert(len(list(set(colors_used_this_cycle))) ==
> len(colors_used_this_cycle), "A color has been used twice!")
>
> But it doesn't work. Cases where a color has been used more than once go
> right through it
Let's try a simple example.
Go back to the structure of an asse
_Python in a NutShell_, p. 138 has a bit on the assert statement which I
don't completely understand.
It says the syntax is
assert condition[, _expression_]
I was hoping to put some sort of explanation of failure in an assert
statement. But how to do it?
In my code I have
assert(len(list(set(colo
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Alan Gauld
> Sent: 12 July 2008 18:08
> To: tutor@python.org
> Subject: Re: [Tutor] Classes v2, thoughts/suggestions please
>
>
> "Paul Melvin" <[EMAIL PROTECTED]> wrote
>
> > i have come up with a w
"Paul Melvin" <[EMAIL PROTECTED]> wrote
i have come up with a working class for a square,
Well done. It might not be the most elegant solution on the
inside but it isn't too bad from the users point of view and thats
what you should aim for IMHO.
I was thinking about using *args to get may
Hi Eric,
I tried following and it seems to work:
fullstring = """l1r1 ll1r2 l1r3l1
r4 l1r5
l2r1l2r3l3
r3 l2r4l2r5
l3r1l3r2l3r3l3r4l3r5
"""
# This should be a string like your's. "\t"-seperated columns,
"\n"-seperated
# rows, with "\n" in some co
On Sat, Jul 12, 2008 at 8:55 AM, Eric Abrahamsen
<[EMAIL PROTECTED]> wrote:
> I've been fooling around with variations on the following (assuming
> splitlist = fullstring.split('\t')):
>
> for x in xrange(8, sys.maxint, 8):
>try:
>splitlist[x:x] = splitlist.pop(x).split('\n')
>exce
Please reply to the list and not just me. That way we all get to
contribute and to learn.
Eric Abrahamsen wrote:
Sorry I haven't explained this clearly, it's just one more symptom of
my confusion... Your example has a tab between records as well as
between fields:
That's not how I see it! L
Thanks to Alans insights i have come up with a working class for a square,
overcomplicated probably but it lays the groundwork for my polygon class
which will iterate over something to generate an n-sided polygon.
If anyone is interested in actually running/testing this you need to get
hold of pgyl
Eric Abrahamsen wrote:
I have a horribly stupid text parsing problem that is driving me
crazy, and making me think my Python skills have a long, long way to
go...
What I've got is a poorly-though-out SQL dump, in the form of a text
file, where each record is separated by a newline, and each f
I have a horribly stupid text parsing problem that is driving me
crazy, and making me think my Python skills have a long, long way to
go...
What I've got is a poorly-though-out SQL dump, in the form of a text
file, where each record is separated by a newline, and each field in
each record
"Alan Gauld" <[EMAIL PROTECTED]> wrote
class Square:
def __init__(self,p1,p2,p3,p4):
self.points = [p1,p2,p3,p4]
def draw(self):
myTookKitDrawSquare(p1.x,p1.y, p1.col,
p2.x,p2.y, p2.col,
"ammar azif" <[EMAIL PROTECTED]> wrote
I am going to develop an application that will launch the
user's computer default web browser pointing to a URL.
How to do this in python and which library should I use?
Look at the webbrowser module, it is intended to do just that.
Also, my developme
22 matches
Mail list logo