1 Nov 01:09 2003

### Re: More confusion on conversion

```
> hexlength = '02X' % length
> TypeError: not all arguments converted

Alan G.

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

```
1 Nov 05:13 2003

### Re: Determining systems maximum float value

```"Marc Barry"
>
> import sys
>
> print sys.maxint
>
> #-----
>
> How can this be determined for floats?
>

Emile van Sebille
emile <at> fenx.com

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

```
1 Nov 05:42 2003

### Re: function algebra

```> I couldn't stand not doing it :)
> It's a bit less readable, but should handle any
> numerical operation.
> It also handles the case of "f=Fun(math.sin) + 5"
> (so that in this case
> f(x) will be math.sin(x) + 5), plus it does
> composition:
>
> >>> cos=Fun(math.cos)
> >>> cs = cos.compose(math.sin)
> >>> cs(1)
> 0.66636674539288054
> >>> math.cos(math.sin(1))
> 0.66636674539288054
> >>>
>
> ------8<-------------
> # we don't need to add __iadd__ and such as those
> fall back to using
> unary_operators=['__neg__', '__pos__', '__abs__',
> '__invert__',
>                  '__complex__', '__int__',
> '__long__', '__float__',
>                  '__oct__', '__hex__']
> '__floordiv__',
>                   '__mod__', '__divmod__',
> '__lshift__', '__rshift__',
>                   '__and__', '__xor__', '__or__',
```

1 Nov 06:53 2003

### broken pipe

```I've been working on an internet app, off and on, for quite some time,
and the socket module keeps throwing error/"broken pipe" exceptions.
What exactly do these mean?  Also, less frequently, I see "connection
reset by peer."  What do I do about that?  Thanks.

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

```
1 Nov 16:15 2003

### Re: broken pipe

```"connection reset by peer" means that the computer sent a reset signal that
it was closing the connection.  This is a simple one-step termination.
The "normal" termination involves sending a FIN from each end to the other
end and getting an acknowledgement back.

You might find it useful to run a program like tcpdump to monitor the traffic
to help with debugging.  tcpdump is included with most linux distributions.

Scott wrote:

> I've been working on an internet app, off and on, for quite some time,
> and the socket module keeps throwing error/"broken pipe" exceptions.
> What exactly do these mean?  Also, less frequently, I see "connection
> reset by peer."  What do I do about that?  Thanks.
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor <at> python.org
> http://mail.python.org/mailman/listinfo/tutor
>

--

--
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice:	603-653-8139
fax:	801-459-9582
```

1 Nov 18:48 2003

### Re: Re: test if file is not ascii

```> for letter in line:
>    char = ord(letter)
>    if char < 20:

It should be possible to write a regex for all the letters
below ASCII 20. Checking if the regex exists in the line
is almost certainly faster than checking each character
using Python.

Something like:
regex  = "["
for n in range(20): regex = regex+chr(n)
regex = regex+"]"
re.compile(regex)

> sys.stderr.write('File contains illegal characters.\n')
> return 101

It might be nicer to raise an exception.
Certainly more Pythonic.

Alan G.

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

```
1 Nov 18:50 2003

### Re: Re: test if file is not ascii

```> ... have you tried a regular expression?

Great minds think alike...

> bb = 'this is the search string that I want to see is in it...'
> if re.search('[\x00-\x19]',bb):

But for some reason I didn't think a range would work
- I don't know why!?!

> However, I don't know off the top of my head how to specify special
> characters in regexps... What I listed might work,

It seems to in the short test I did.

Alan G

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

```
1 Nov 20:12 2003

### New-style classes

```I have heard about new-style classes, and I'm afraid
I'm using old-style classes (since I'm learning from a
new-style classes are and their benefit over old-style
classes?
Daniel Ehrenberg

__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

_______________________________________________
Tutor maillist  -  Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor

```
1 Nov 20:45 2003

### Re: New-style classes

```http://www.python.org/doc/2.2.1/whatsnew/
What's New in Python 2.2

http://www.python.org/2.2/descrintro.html
Unifying types and classes in Python 2.2

The first link is by amk (just in case he's not watching the list).
The second is by GvR and will probably make more sense after reading
the section of amk's document dealing with the new classes.

Daniel Ehrenberg wrote:

> I have heard about new-style classes, and I'm afraid
> I'm using old-style classes (since I'm learning from a
> new-style classes are and their benefit over old-style
> classes?
> Daniel Ehrenberg
>
> __________________________________
> Do you Yahoo!?
> Exclusive Video Premiere - Britney Spears
> http://launch.yahoo.com/promos/britneyspears/
>
> _______________________________________________
> Tutor maillist  -  Tutor <at> python.org
> http://mail.python.org/mailman/listinfo/tutor
>

--

--
```

1 Nov 20:55 2003

### Re: New-style classes

```One more comment.  A "classic" class has a base class defined as:
class Base:

A newstyle class has a base of object
class Base(object):
or one of the other built in types (e.g. dict or list).  I have not
encountered any cases where code was broken my switching to the new
style classes.

Lloyd Kvam wrote:

> http://www.python.org/doc/2.2.1/whatsnew/
> What's New in Python 2.2
>
> http://www.python.org/2.2/descrintro.html
> Unifying types and classes in Python 2.2
>
> The first link is by amk (just in case he's not watching the list).
> The second is by GvR and will probably make more sense after reading
> the section of amk's document dealing with the new classes.
>
>
> Daniel Ehrenberg wrote:
>
>> I have heard about new-style classes, and I'm afraid
>> I'm using old-style classes (since I'm learning from a