Re: [Tutor] inheritance and super() function in python

2014-04-22 Thread Dave Angel
Jorge Leon Wrote in message: > Thank you Steve and Dave for the prompt response and advise, and sorry > about the format. > > The version of Python I'm working under is 2.7.5. About the .super(): > I'm going to try out the format you gave me for the files, and yes: > that's exactly how I had it.

Re: [Tutor] loop couldn't work well and file couldn't close

2014-04-22 Thread Dave Angel
baidusandy Wrote in message: [invisible message not copied here] By posting in html, you managed to pick black on black text. I literally could see none of your message except the boilerplate. Please tell your email program to use text mode. -- DaveA _

Re: [Tutor] methods of sorting

2014-04-22 Thread Steven D'Aprano
Hi Patti, My answers below, interleaved between your questions. On Tue, Apr 22, 2014 at 04:18:38PM -0700, Patti Scott wrote: > I'm practicing with lists.  I was looking for documentation on sorting > with cmp() because it isn't immediately clear to me how comparing > items two at a time can so

Re: [Tutor] inheritance and super() function in python

2014-04-22 Thread Steven D'Aprano
On Tue, Apr 22, 2014 at 08:59:59PM -0400, Jorge Leon wrote: > Thank you Steve and Dave for the prompt response and advise, and sorry > about the format. > > The version of Python I'm working under is 2.7.5. About the .super(): > I'm going to try out the format you gave me for the files, and yes: >

Re: [Tutor] inheritance and super() function in python

2014-04-22 Thread Jorge Leon
Thank you Steve and Dave for the prompt response and advise, and sorry about the format. The version of Python I'm working under is 2.7.5. About the .super(): I'm going to try out the format you gave me for the files, and yes: that's exactly how I had it. Something that has stuck from all the C++

Re: [Tutor] loop couldn't work well and file couldn't close

2014-04-22 Thread Alan Gauld
On 22/04/14 17:13, baidusandy wrote: I'm a newbie to Python. I want to make python useful to my work, to write a script for get some data out. But there are some setbacks. I really needs your help. Please, help me. Its too late for me to study your code properly but here are a few immediate obs

Re: [Tutor] methods of sorting

2014-04-22 Thread Danny Yoo
On Tue, Apr 22, 2014 at 4:18 PM, Patti Scott wrote: > I'm practicing with lists. I was looking for documentation on sorting with > cmp() because it isn't immediately clear to me how comparing items two at a > time can sort the entire list. As you note, comparison itself doesn't sort a list. Co

[Tutor] methods of sorting

2014-04-22 Thread Patti Scott
I'm practicing with lists.  I was looking for documentation on sorting with cmp() because it isn't immediately clear to me how comparing items two at a time can sort the entire list.  Identify max or min values, yes, but not sort the whole list.  So, the Sorting HOW TO (Dalke, Hettinger)  posted

[Tutor] loop couldn't work well and file couldn't close

2014-04-22 Thread baidusandy
I'm a newbie to Python. I want to make python useful to my work, to write a script for get some data out. But there are some setbacks. I really needs your help. Please, help me. ---the first one-- for x in range(1,a): tem=open('results\\temp'+str(x)) tem.seek(0) i_line=tem.

Re: [Tutor] subprocess not returning

2014-04-22 Thread shawn wilson
On Tue, Apr 22, 2014 at 3:10 PM, Alan Gauld wrote: > We have no clue what you are doing. You say "this works" > but we can't see what 'this' is. Is the code on the > pastebin link the working or the broken version? > Per what is expected output (which I forgot to provide - sorry about that). Sho

Re: [Tutor] inheritance and super() function in python

2014-04-22 Thread Dave Angel
Jorge Leon Wrote in message: > I think Steven has nailed your main problem, but I have two other suggestions: Use text mail, not html. This is a text list, and it can make a difference in half a dozen ways. Any decent email program has a way to select that. When showing an error, include

Re: [Tutor] Help needed with Python programming

2014-04-22 Thread Danny Yoo
Unfortunately, we can't give too much specific help on your particular problem because it's homework. You should use the knowledge you learned in your introductory programming class about designing programs. In particular, give a name to the function or functions your are designing. Be rigorous

Re: [Tutor] subprocess not returning

2014-04-22 Thread Alan Gauld
On 22/04/14 10:14, shawn wilson wrote: This works when I have a class for ldd and nothing else, but when I run it like this: https://gist.github.com/ag4ve/11171201 I don't get any of the libraries and I can't figure out where it's failing. ['fattr', [['/testroot', 0, 0, 777], ['/bin/dash']]] HER

Re: [Tutor] Help needed with Python programming

2014-04-22 Thread Mark Lawrence
On 22/04/2014 12:41, Steven D'Aprano wrote: On Mon, Apr 21, 2014 at 06:16:20PM -0700, Suhana Vidyarthi wrote: [...] # on Windows either of these will be okay filename = "C:/path/to/file.txt" filename = "C:\\path\\to\\file.txt" Or a raw string r'C:\path\to\file.txt' -- My fellow Pythonis

Re: [Tutor] Groups of mutually exclusive options

2014-04-22 Thread Alex Kleider
On 2014-04-21 19:35, Steven D'Aprano wrote: Does docopt solve the Original Poster's question? If not, that advice is not terribly helpful. I don't pretend to fully understand the Original Poster's requirement but I believe mutual exclusivity is supported. Here's a short excerpt. """ Example

[Tutor] subprocess not returning

2014-04-22 Thread shawn wilson
This works when I have a class for ldd and nothing else, but when I run it like this: https://gist.github.com/ag4ve/11171201 I don't get any of the libraries and I can't figure out where it's failing. ['fattr', [['/testroot', 0, 0, 777], ['/bin/dash']]] HERE1 [/testroot] HERE2 [/bin/dash] ['ldd',

Re: [Tutor] inheritance and super() function in python

2014-04-22 Thread Steven D'Aprano
On Tue, Apr 22, 2014 at 09:48:51AM -0400, Jorge Leon wrote: > Good day, > > > I have programmed a base class for an environment I have with no problem, > but when it comes to referencing the base class's constructor in the > derived class's constructor I have been getting errors: What version of

[Tutor] inheritance and super() function in python

2014-04-22 Thread Jorge Leon
Good day, I have programmed a base class for an environment I have with no problem, but when it comes to referencing the base class's constructor in the derived class's constructor I have been getting errors: *TypeError: Error when calling the metaclass bases* *module.__init__() takes at mos

Re: [Tutor] Help needed with Python programming

2014-04-22 Thread Steven D'Aprano
On Mon, Apr 21, 2014 at 06:16:20PM -0700, Suhana Vidyarthi wrote: [...] > I have a python code that shows a set of shortest paths between nodes A and > B. Now I have to select the least risky path among them. To do that I have > to consider the risk values of each link. I know how to calculate the

Re: [Tutor] Help needed with Python programming

2014-04-22 Thread Alan Gauld
On 22/04/14 02:16, Suhana Vidyarthi wrote: I have a python code that shows a set of shortest paths between nodes A and B. It would help if you showed us this code. Otherwise we are just making wild guesses about how you are modelling this. Also knowing which Python version you are using would

Re: [Tutor] Beginning Python 3.4.0 Programmer:Stephen Mik: Cannot get input variable to make While Loop conditional to work

2014-04-22 Thread Alan Gauld
On 22/04/14 01:18, Alan Gauld wrote: input takes as an argument a prompt string and returns the value input by the user so your usage should look like: smv_grandVariable("Enter a 1 to play or 0 to exit:") Whoops, something went badly wrong in an edit there. It should read: smv_grandVariable

[Tutor] Help needed with Python programming

2014-04-22 Thread Suhana Vidyarthi
My knowledge of coding is fairly limited and I am having a hard time writing a Python code which might be pretty simple for you :-) Here is what I am doing and I need help with: I have a python code that shows a set of shortest paths between nodes A and B. Now I have to select the least risky pat