Source code for csv module

Discussion in 'Python' started by vsoler, Feb 2, 2009.

  1. vsoler

    vsoler Guest

    Hi you all,

    I just discovered the csv module here in the comp.lang.python group.

    I have found its manual, which is publicly available, but since I am
    still a newby, learning techniques, I was wondering if the source code
    for this module is available.

    Is it possible to have a look at it?

    Thanks
    vsoler, Feb 2, 2009
    #1
    1. Advertising

  2. vsoler

    Jon Clements Guest

    On 2 Feb, 20:46, vsoler <> wrote:
    > Hi you all,
    >
    > I just discovered the csv module here in the comp.lang.python group.
    >
    > I have found its manual, which is publicly available, but since I am
    > still a newby, learning techniques, I was wondering if the source code
    > for this module is available.
    >
    > Is it possible to have a look at it?
    >
    > Thanks


    The csv module is a wrapper around a C extension. If you're happy
    reading C code then downloading the Python sources will let you take a
    goosey.

    Jon.
    Jon Clements, Feb 2, 2009
    #2
    1. Advertising

  3. vsoler

    vsoler Guest

    On 2 feb, 21:51, Jon Clements <> wrote:
    > On 2 Feb, 20:46, vsoler <> wrote:
    >
    > > Hi you all,

    >
    > > I just discovered the csv module here in the comp.lang.python group.

    >
    > > I have found its manual, which is publicly available, but since I am
    > > still a newby, learning techniques, I was wondering if the source code
    > > for this module is available.

    >
    > > Is it possible to have a look at it?

    >
    > > Thanks

    >
    > The csv module is a wrapper around a C extension. If you're happy
    > reading C code then downloading the Python sources will let you take a
    > goosey.
    >
    > Jon.


    I'm still interested in learning python techniques. Are there any
    other modules (standard or complementary) that I can use in my
    education?
    vsoler, Feb 2, 2009
    #3
  4. vsoler

    Tim Chase Guest

    > I just discovered the csv module here in the comp.lang.python
    > group.


    It certainly makes life easier.

    > I have found its manual, which is publicly available, but
    > since I am still a newby, learning techniques, I was wondering
    > if the source code for this module is available.
    >
    > Is it possible to have a look at it?


    Yep...the source csv.py is likely already on your computer:

    >>> import csv
    >>> csv.__file__

    '/usr/lib/python2.5/csv.pyc'
    tchase@asgix2:~$ ls /usr/lib/python2.5/csv.*
    /usr/lib/python2.5/csv.py /usr/lib/python2.5/csv.pyc


    Same idea in Windows:

    >>> import csv
    >>> csv.__file__

    'C:\\Program Files\\Python24\\lib\\csv.pyc'
    c:\> dir "\Program Files\Python24\lib\csv.*"
    ...

    Just about all the modules in the standard library have python
    source in this same directory, so you can spelunk within.

    -tkc
    Tim Chase, Feb 2, 2009
    #4
  5. vsoler

    Tim Roberts Guest

    vsoler <> wrote:
    >
    >I'm still interested in learning python techniques. Are there any
    >other modules (standard or complementary) that I can use in my
    >education?


    Are you serious about this? Are you not aware that virtually ALL of the
    Python standard modules are written in Python, and are included in their
    full, readable source form in every Python installation? \Python25\lib in
    Windows, /usr/lib/python25 in Linux.
    --
    Tim Roberts,
    Providenza & Boekelheide, Inc.
    Tim Roberts, Feb 3, 2009
    #5
  6. vsoler

    Jon Clements Guest

    On 3 Feb, 04:27, Tim Roberts <> wrote:
    > vsoler <> wrote:
    >
    > >I'm still interested in learning python techniques. Are there any
    > >other modules (standard or complementary) that I can use in my
    > >education?

    >
    > Are you serious about this?  Are you not aware that virtually ALL of the
    > Python standard modules are written in Python, and are included in their
    > full, readable source form in every Python installation?  \Python25\lib in
    > Windows, /usr/lib/python25 in Linux.
    > --
    > Tim Roberts,
    > Providenza & Boekelheide, Inc.


    Okies, so the sniffer is there as readable python, but the most
    interesting bit (which fair enough I made the assumption the OP was
    interested in) is the reader/writer functionality -- which is
    implemented as a shared library and thus, unless you have a source
    install of python somewhere, there is no readable code.

    Jon.
    Jon Clements, Feb 3, 2009
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Ortmann
    Replies:
    4
    Views:
    562
    Skip Montanaro
    Jul 2, 2003
  2. Michal Mikolajczyk
    Replies:
    0
    Views:
    634
    Michal Mikolajczyk
    Feb 13, 2004
  3. Skip Montanaro
    Replies:
    0
    Views:
    700
    Skip Montanaro
    Feb 13, 2004
  4. Tintin92
    Replies:
    1
    Views:
    1,677
    Andrew Thompson
    Feb 14, 2007
  5. jliu66
    Replies:
    0
    Views:
    499
    jliu66
    Oct 19, 2007
Loading...

Share This Page