Thanks Mark that did the trick, couldn't quite figure out the syntax before. 

Craig Prinn
Document Solutions Manager
Office Phone 919-767-6640
Cell Phone    410-320-9962
Fax              410-243-0973
3600 Clipper Mill Road
Suite 404
Baltimore, MD 21211
-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Wednesday, June 15, 2011 6:00 AM
To: [email protected]
Subject: Tutor Digest, Vol 88, Issue 54

Send Tutor mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://mail.python.org/mailman/listinfo/tutor
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Tutor digest..."


Today's Topics:

   1. Re: Already Initialized Object Inheritance? (WolfRage)
   2. Re: trying to translate and ebcidic file (Mark Tolonen)


----------------------------------------------------------------------

Message: 1
Date: Tue, 14 Jun 2011 23:42:59 -0700
From: WolfRage <[email protected]>
To: Japhy Bartlett <[email protected]>
Cc: Python Tutor <[email protected]>
Subject: Re: [Tutor] Already Initialized Object Inheritance?
Message-ID: <1308120179.1952.50.camel@wolfrage-LE1600>
Content-Type: text/plain; charset="UTF-8"

Unfortunately I am not able to inherit "stdscr" using that method. As
Python returns with an error stating that "stdscr" is not defined. This
error is returned at run time and by the compiler prior to actual
execution. If you would like I can write a quick example that will
generate the error message for that method.
--
Jordan
On Wed, 2011-06-15 at 02:04 -0400, Japhy Bartlett wrote:
> When you're subclassing something, you use the syntax:
> 
> class Foo(Bar):
> 
> It seems like you're trying to do:
> 
> class Bar:
>     class Foo:
> 
> - Japhy
> 
> On Wed, Jun 15, 2011 at 12:47 AM, WolfRage <[email protected]> wrote:
> > I can not get this to behave in the manor that I would like. I am trying
> > to have an object refereed to as CursesApp.Screen become the already
> > initialized object "stdscr". To elaborate I would like it to become that
> > object but to also be able to define additional methods and properties,
> > so more along the lines of inherit from "stdscr". Is this even possible?
> > Well I can make it equal to that object I can not add additional methods
> > and properties to it? Additionally, so that I learn; where has my
> > thinking been too short sited? Thank you for your help.
> > --
> > Jordan
> >
> > ****CODE BELOW****
> >
> > #!/usr/bin/python3
> > """With thi method I can make the class "Screen" become "stdscr" but if
> > I refernce any of the new methods or properties the applications
> > promptly fails and notifies me that the method or property does not
> > exist. Another downside of this method is I can not reference
> > self.Screen.* or it crashes."""
> > import curses
> > class CursesApp:
> >    def __init__(self, stdscr):
> >        self.Screen(stdscr) #This is the stdscr object.
> >        curses.init_pair(1,curses.COLOR_BLUE,curses.COLOR_YELLOW)
> >        #self.Screen.bkgd(' ', curses.color_pair(1))
> >        #self.mainLoop()
> >
> >    #def mainLoop(self):
> >        #while 1:
> >            #self.Screen.refresh()
> >            #key=self.Screen.getch()
> >            #if key==ord('q'): break
> >
> >    class Screen:
> >        def __init__(self,stdscr):
> >            self=stdscr
> >            #self.height, self.width = self.getmaxyx() # any reference
> > to these crashes
> >            #self.offsety, self.offsetx = -self.height/2, -self.width/2
> > # any reference to these crashes
> >            #self.curx, self.cury = 1, 1 # any reference to these
> > crashes
> >            self.clear()
> >            self.border(0)
> >            while 1:
> >                self.refresh()
> >                key=self.getch()
> >                if key==ord('q'): break
> >
> > def main():
> >    cursesapp = curses.wrapper(setup)
> >
> > def setup(stdscr):
> >    CursesApp(stdscr)
> >
> > if __name__ == '__main__':
> >    main()
> >
> >
> >
> > ****CODE BELOW****
> >
> > #!/usr/bin/python3
> > """With this method I can make "Screen" become "stdscr" but if I
> > obviously can not even define any new methods or properties. But atleast
> > the references can be used through out the class with out crashing."""
> > import curses
> > class CursesApp:
> >    def __init__(self, stdscr):
> >        self.Screen=stdscr #This is the stdscr object.
> >        curses.init_pair(1,curses.COLOR_BLUE,curses.COLOR_YELLOW)
> >        self.Screen.bkgd(' ', curses.color_pair(1))
> >        self.mainLoop()
> >
> >    def mainLoop(self):
> >        while 1:
> >            self.Screen.refresh()
> >            key=self.Screen.getch()
> >            if key==ord('q'): break
> >
> > def main():
> >    cursesapp = curses.wrapper(setup)
> >
> > def setup(stdscr):
> >    CursesApp(stdscr)
> >
> > if __name__ == '__main__':
> >    main()
> >
> > _______________________________________________
> > Tutor maillist  -  [email protected]
> > To unsubscribe or change subscription options:
> > http://mail.python.org/mailman/listinfo/tutor
> >




------------------------------

Message: 2
Date: Wed, 15 Jun 2011 02:20:27 -0700
From: "Mark Tolonen" <[email protected]>
To: [email protected]
Subject: Re: [Tutor] trying to translate and ebcidic file
Message-ID: <[email protected]>
Content-Type: text/plain; format=flowed; charset="iso-8859-1";
        reply-type=original


"Prinn, Craig" <[email protected]> wrote in message 
news:[email protected]...
> I am looking for a way to translate and ebcidic file to ascii. Is there a 
> pre-existing library for this, or do I need to do this from scratch? If
 > from scratch and ideas on where to start?

There are a couple of EBCDIC codecs (see list of codecs in 
http://docs.python.org/library/codecs.html).

Try:    open('file.txt').read().decode('ibm500').encode('ascii','replace')

You'll get '?' for chars ascii doesn't support.

-Mark





------------------------------

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor


End of Tutor Digest, Vol 88, Issue 54
*************************************
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to