<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel about="http://permalink.gmane.org/gmane.comp.python.tutor">
    <title>gmane.comp.python.tutor</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50085"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50084"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50083"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50082"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50081"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50080"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50079"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50078"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50077"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50076"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50075"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50074"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50073"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50072"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50071"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50070"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50069"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50068"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50067"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.tutor/50066"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50085">
    <title>Re: Python Docs (Was: Reformatting phone number)</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50085</link>
    <description>
and somehow you missed
# 3.6.1 String Methods
# 3.6.2 String Formatting Operations

which even should have come first in your search.

&lt;snip&gt;

But the *very next page*, called "Deprecated string functions", links
to 3.6.1 which is what you want.


I think it looks like you are not trying very hard, or that you are
letting your expectations color your search too much.


At the bottom of every page in the docs it says, "See About this
document... [link] for information on suggesting changes." Specific
suggestions for improvement are more likely to be well received than
complaints.

I guess I am a little defensive here, I think the docs are pretty
good. It's true that beginners don't realize that so much meat is in
the library reference, I'm not sure how to make that more obvious. But
your particular problems in finding endswith() in the LR I think come
from you wearing PHP-colored blinders.

Kent
_______________________________________________
Tutor maillist  -  Tutor&lt; at &gt;python.org
http://mail.python.org/mailman</description>
    <dc:creator>Kent Johnson</dc:creator>
    <dc:date>2008-08-21T16:58:55</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50084">
    <title>Re: Problems with Gauge Bar.</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50084</link>
    <description>_______________________________________________
Tutor maillist  -  Tutor&lt; at &gt;python.org
http://mail.python.org/mailman/listinfo/tutor
</description>
    <dc:creator>Olrik Lenstra</dc:creator>
    <dc:date>2008-08-21T16:27:13</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50083">
    <title>Python Docs (Was: Reformatting phone number)</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50083</link>
    <description>2008/8/21 W W &lt;srilyk&lt; at &gt;gmail.com&gt;:

Thanks. Searching for startswith(), assuming that I do not know the
name of it, leads me to the same p

</description>
    <dc:creator>Dotan Cohen</dc:creator>
    <dc:date>2008-08-21T16:13:59</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50082">
    <title>Python Docs (Was: Reformatting phone number)</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50082</link>
    <description>2008/8/21 Kent Johnson &lt;kent37&lt; at &gt;tds.net&gt;:

Let's start from there. I need the startswith() function, but I do not
know it's name. I search for "strings" and find this:
4. String Services
    * 4.1 string -- Common string operations
          o 4.1.3 String functions

But on that page, this is all there is:
"""
The following functions are available to operate on string and Unicode
objects. They are not available as string methods.

capwords( s)
[snip description]
maketrans( from, to)
[snip description]
Warning: Don't use strings derived from lowercase  and uppercase as
arguments; in some locales, these don't have the same length. For case
conversions, always use lower() and upper().
""

So Python has only two string functions? That's what it looks like.


I will start with those, thanks.


Thanks, Kent. I will be a nuisance! Is there any place to suggest
improvements to the docs? I see on the python.org site it is suggested
to email website bugs to the site admin. Does that go for the docs? I
am not the one </description>
    <dc:creator>Dotan Cohen</dc:creator>
    <dc:date>2008-08-21T16:01:46</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50081">
    <title>Re: Reformatting phone number</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50081</link>
    <description>_______________________________________________
Tutor maillist  -  Tutor&lt; at &gt;python.org
http://mail.python.org/mailman/listinfo/tutor
</description>
    <dc:creator>W W</dc:creator>
    <dc:date>2008-08-21T11:31:09</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50080">
    <title>Re: Reformatting phone number</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50080</link>
    <description>2008/8/21 OmerT &lt;Jaggojaggo+Py&lt; at &gt;gmail.com&gt;:

Exactly- that only works for term, classes, and functions that you
already know the name of. The php docs have a list of all the
functions with a one-line description. It's very easy to find which
funtion performs what one needs.

I would have never found the startswith() function with the current
document structure. But I suppose that is subject for another thread,
which I am sure would degrade quickly into a flamewar. I don't want to
be the cause of that :)

</description>
    <dc:creator>Dotan Cohen</dc:creator>
    <dc:date>2008-08-21T10:13:58</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50079">
    <title>Re: Reformatting phone number</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50079</link>
    <description>

Chapters 2 and 3 of the library reference are highly recommended.
http://docs.python.org/lib/lib.html

In particular:
2.1 Built-in Functions lists all globally available functions
(functions that are not part of a class)
3.6 Sequence Types gives operations on strings, lists and tuples
(which are all sequences)
3.6.1 String Methods includes endswith()
3.8 Mapping Types -- dict
etc.

Many Python functions are grouped into library modules.  You could
consider this to be the grouping by category that you want. The rest
of the library reference (after chapter 3) documents the modules.
Browse the table of contents to see what is available.

And you are welcome to ask this group if you can't find what you are
looking for.

Kent
_______________________________________________
Tutor maillist  -  Tutor&lt; at &gt;python.org
http://mail.python.org/mailman/listinfo/tutor

</description>
    <dc:creator>Kent Johnson</dc:creator>
    <dc:date>2008-08-21T10:50:10</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50078">
    <title>Re: Merging table-like files with overlapping values in onecolumn</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50078</link>
    <description>

Yes, as long as the order of entries doesn't matter - a dict does not
preserve order. Make a dict that maps a key to a list of values
(collections.defaultdict is useful for this). Read each file and add
its pairs to the dict. Then iterate the dict and write to a new file.

If you do care about order, there are various implementations of
ordered dictionaries available.

Kent
_______________________________________________
Tutor maillist  -  Tutor&lt; at &gt;python.org
http://mail.python.org/mailman/listinfo/tutor

</description>
    <dc:creator>Kent Johnson</dc:creator>
    <dc:date>2008-08-21T10:42:31</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50077">
    <title>Merging table-like files with overlapping values in onecolumn</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50077</link>
    <description>Hi all,

I'm new to Python and trying to come up with an elegant way of tackling the following problem. Sorry for the lengthy description:

I have several input files where in each file, every line has a space-separated pair values. The files are essentially tables with two columns. There are no duplicates in the first column values within each file, but they overlap when all files are considered. I'd like to merge them into one file according to values of the first column of each file with values from the second column of all files combined like this:

First file:
bar 100
foo 90
yadda 22

Second file:
bar 78
yadda 120
ziggy 99

Combined file:
bar 100 78
foo 90 NONE
yadda 22 120
ziggy NONE 99

I'm considering several approaches. In the first brute force way, I can read in each file, parse it into lines, parse lines into words, and write the values from the second word to a new output file along with the first word. That seems awful. My second idea is to convert each file into a dictionary (since the first co</description>
    <dc:creator>Kat</dc:creator>
    <dc:date>2008-08-21T09:56:49</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50076">
    <title>Re: programming tic tac toe</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50076</link>
    <description>
#Assuming you number the board positions as:
#board = [ [0,1,2],
#          [3,4,5],
#          [6,7,8] ]

#then you could define the winning combinations as:

winners = [ (0,1,2),(3,4,5),(6,7,8), #rows
             (0,3,6),(1,4,7),(2,5,8), #cols
             (0,4,8),(6,4,2)          #diags
             ]

#and return all these combinations from the current board with:

def mapped(board):
     return [ (board[i/3][i%3],board[j/3][j%3],board[k/3][k%3])
              for i,j,k in winners]

#and finally, assuming you're using X's and Y's,
#identify a winning line with:

def line(board):
      if ( ('X','X','X') in mapped(board) or
           ('Y','Y','Y') in mapped(board) ):
          return True
      return False

#now two test cases
board = ([['X','Y','Y'],
           ['Y','X','X'],
           ['Y','X','Y']
          ])

print line(board)

board = ([['X','Y','Y'],
           ['Y','X','X'],
           ['Y','Y','X']
          ])

print line(board)

HTH,

Emile




_____________________________________________</description>
    <dc:creator>Emile van Sebille</dc:creator>
    <dc:date>2008-08-21T08:03:50</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50075">
    <title>Re: Reformatting phone number</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50075</link>
    <description>mostly, I google "docs.python" and the term or class I'm looking for.
Mind, this mainly works for modules or classes which came with the interpreter.

G'luck.

On Thu, Aug 21, 2008 at 9:08 AM, Dotan Cohen &lt;dotancohen&lt; at &gt;gmail.com&gt; wrote:
_______________________________________________
Tutor maillist  -  Tutor&lt; at &gt;python.org
http://mail.python.org/mailman/listinfo/tutor
</description>
    <dc:creator>OmerT</dc:creator>
    <dc:date>2008-08-21T07:32:14</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50074">
    <title>Re: Reformatting phone number</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50074</link>
    <description>2008/8/21 Robert Berman &lt;bermanrl&lt; at &gt;embarqmail.com&gt;:

I don't have more of a C background than a one-semester course in
university. But the details between the languages are night and day. I
am enjoying Python. I recently heard that Python is like writing
psuedo-code that runs. I am seeing that this is true. I especially
love the use of indentation for block demarcation.


Error are certainly the best way to learn.


Thanks.

</description>
    <dc:creator>Dotan Cohen</dc:creator>
    <dc:date>2008-08-21T06:13:21</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50073">
    <title>Re: Reformatting phone number</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50073</link>
    <description>2008/8/21 Kent Johnson &lt;kent37&lt; at &gt;tds.net&gt;:

Nice! I had looked for this type of function, but could not find it.

Is there a list of functions, organized by categories, for Python?
Take for example these pages from te php documentation:
http://il.php.net/manual/en/book.strings.php
http://il.php.net/manual/en/book.array.php
http://il.php.net/manual/en/book.math.php

which are all linked from:
http://il.php.net/manual/en/funcref.php

Is there anything like this for Python? If not, I am willing to code
the site if some Python gurus will help contribute their knowledge.




This I have read, while googling this thread.


This I will read, to keep up to speed.

Thanks!

</description>
    <dc:creator>Dotan Cohen</dc:creator>
    <dc:date>2008-08-21T06:08:07</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50072">
    <title>Re: programming tic tac toe</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50072</link>
    <description>"Ark" &lt;cloudneozero&lt; at &gt;gmail.com&gt; wrote



Given that there are always 3x3 cells on an oxo board and
therefore only 8 possible winning lines hard coding is probably
a reasonable approach. You could make it into a single boolean
condition which would be slightly less typing and slightly faster
but otherwise what you have is fine I think:

def line(board):
    return  board[0][0] == board[0][1] == board[0][2] or
              board[1][0] == board[1][1] == board[1][2] or
              ...
              board[2][0] == board[1][1] == board[[0][2]

But I'm not sure its that much nicer! :-)

For the more general case of an NxN board then you
should probably consider using a loop and relative
indexing but for 3x3 hard coded is better IMHO.

</description>
    <dc:creator>Alan Gauld</dc:creator>
    <dc:date>2008-08-21T05:53:50</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50071">
    <title>programming tic tac toe</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50071</link>
    <description>_______________________________________________
Tutor maillist  -  Tutor&lt; at &gt;python.org
http://mail.python.org/mailman/listinfo/tutor
</description>
    <dc:creator>Ark</dc:creator>
    <dc:date>2008-08-21T00:30:32</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50070">
    <title>Re: Reformatting phone number</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50070</link>
    <description>
Another way to write this is
  if sys.argv[1].startswith('0'):


You need to learn about slicing. This is a way of indexing any
sequence, including strings. See
http://docs.python.org/tut/node5.html#SECTION005120000000000000000
http://docs.python.org/lib/typesseq.html

In particular, you want
  number = '+972' + sys.argv[1][1:]

which takes all characters of argv[0] after the first.

Kent
_______________________________________________
Tutor maillist  -  Tutor&lt; at &gt;python.org
http://mail.python.org/mailman/listinfo/tutor

</description>
    <dc:creator>Kent Johnson</dc:creator>
    <dc:date>2008-08-20T23:41:26</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50069">
    <title>Re: Reformatting phone number</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50069</link>
    <description>2008/8/21 Robert Berman &lt;bermanrl&lt; at &gt;embarqmail.com&gt;:

It does help, and I will make a point of familiarizing myself with the
errors reported by runtime errors (is this a valid term in Python, as
there are no compile errors) such as those generated from code like
this:
s='hello, world!'
s=int(s)

</description>
    <dc:creator>Dotan Cohen</dc:creator>
    <dc:date>2008-08-20T22:38:31</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50068">
    <title>Re: Reformatting phone number</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50068</link>
    <description>2008/8/21 Alan Gauld &lt;alan.gauld&lt; at &gt;btinternet.com&gt;:

This characteristic is similar enough to php (a language where one
doesn't even think about types) that I will get used to it. Thanks.

</description>
    <dc:creator>Dotan Cohen</dc:creator>
    <dc:date>2008-08-20T22:39:47</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50067">
    <title>Re: Reformatting phone number</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50067</link>
    <description>"Dotan Cohen" &lt;dotancohen&lt; at &gt;gmail.com&gt; wrote


In Python values have types and variables are simply
names associated with values.

Thus

v = '123'    # v 'is' a string because '123' is a string
v = 123     # now v 'is' an int because 123 is an int.

The variable takes on the type of the value with which it is
associated but it can be made to refer to any other value
and thus its type effectively changes. So it's best not to
think of variables having types but rather consider objects
(or values) as having a type, and variables as being
associated with objects..

This is one of the most fundamental characteristics of
Python and one of the hardest for users of other languages
to adapt to.

HTH,

</description>
    <dc:creator>Alan Gauld</dc:creator>
    <dc:date>2008-08-20T22:29:45</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50066">
    <title>Re: Reformatting phone number</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50066</link>
    <description>_______________________________________________
Tutor maillist  -  Tutor&lt; at &gt;python.org
http://mail.python.org/mailman/listinfo/tutor
</description>
    <dc:creator>Robert Berman</dc:creator>
    <dc:date>2008-08-20T22:08:47</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.tutor/50065">
    <title>Re: Reformatting phone number</title>
    <link>http://permalink.gmane.org/gmane.comp.python.tutor/50065</link>
    <description>2008/8/21 Robert Berman &lt;bermanrl&lt; at &gt;embarqmail.com&gt;:

Perhaps. In php the distinction was made by the fact that there were
no non-numerical characters in a string. I don't know enough Python to
know if this is the case. Can I declare a variable type in Python as
in C?

</description>
    <dc:creator>Dotan Cohen</dc:creator>
    <dc:date>2008-08-20T21:27:30</dc:date>
  </item>
  <textinput about="http://search.gmane.org/?group=$group=gmane.comp.python.tutor">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.python.tutor</link>
  </textinput>
</rdf:RDF>
