On Sun, 12 Sep 2010 02:00:02 am Lie Ryan wrote:
> As an alternative solution, you can derive from UserList and overload
> the __getitem__ and __setitem__ operator:
We've been able to inherit from list directly since at least Python 2.2.
Why are you using UserList?
--
Steven D'Aprano
On Sat, Sep 11, 2010 at 10:40 AM, Joel Goldstick
wrote:
>
> I think the first message in the original post is instructive:
>
> "I'm using the following function style I found on the net to create
> menus for a command line python script:"
>
> I (sometimes!) love looking at other peoples code to
On 09/11/10 23:25, Rance Hall wrote:
> On Fri, Sep 10, 2010 at 6:14 PM, Lie Ryan wrote:
>> On 09/11/10 07:36, Rance Hall wrote:
>
>
>
>> In most cases in Python, you would almost never need to reference the
>> list's index directly since python makes it easy to use iterators;
>> however in your
On Sat, Sep 11, 2010 at 11:15 AM, Steven D'Aprano wrote:
> On Sat, 11 Sep 2010 11:25:12 pm Rance Hall wrote:
>
> > Thanks everyone for responding, Because this menu structure is
> > repeated many times in my code, the ideal solution would have been to
> > "set index start = 1" in the beginning of
On Sat, 11 Sep 2010 11:25:12 pm Rance Hall wrote:
> Thanks everyone for responding, Because this menu structure is
> repeated many times in my code, the ideal solution would have been to
> "set index start = 1" in the beginning of the script.
That is exactly the wrong solution. That will break a
Am 11.09.2010 15:46, schrieb Joel Goldstick:
On Sat, Sep 11, 2010 at 9:25 AM, Rance Hall mailto:ran...@gmail.com>> wrote:
On Fri, Sep 10, 2010 at 6:14 PM, Lie Ryan mailto:lie.1...@gmail.com>> wrote:
> On 09/11/10 07:36, Rance Hall wrote:
> In most cases in Python, you woul
On Sat, Sep 11, 2010 at 9:25 AM, Rance Hall wrote:
> On Fri, Sep 10, 2010 at 6:14 PM, Lie Ryan wrote:
> > On 09/11/10 07:36, Rance Hall wrote:
>
>
>
> > In most cases in Python, you would almost never need to reference the
> > list's index directly since python makes it easy to use iterators;
>
On Fri, Sep 10, 2010 at 6:14 PM, Lie Ryan wrote:
> On 09/11/10 07:36, Rance Hall wrote:
> In most cases in Python, you would almost never need to reference the
> list's index directly since python makes it easy to use iterators;
> however in your particular case, which is a valid exception, enu
On 10/09/2010 23.36, Rance Hall wrote:
I'm using the following function style I found on the net to create
menus for a command line python script:
def mainmenu():
# the main menu
todolist()
mainmenuoptions = ['Clients','Jobs','Billing','Quotes','To Do
Items','Employee','Exit']
On 09/11/10 07:36, Rance Hall wrote:
> I'm using the following function style I found on the net to create
> menus for a command line python script:
>
> It works well, but the first item is the list is item 0. This is
> normal in most computing situations, but because this index is part of
> the
Yeah, just add 1 to it. When printing just do index+1 and when inputting the
user's choice, subtract 1 and use it as the array index.
Sent from my iPhone
On Sep 10, 2010, at 4:36 PM, Rance Hall wrote:
> I'm using the following function style I found on the net to create
> menus for a command
11 matches
Mail list logo