On Apr 7, 11:55 am, Robert Bossy <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Folks,
> > Is it possible to read hash values from txt file.
> > I have script which sets options. Hash table has key set to option,
> > and values are option values.
>
> > Way we have it, we set options in a
Folks,
Is it possible to read hash values from txt file.
I have script which sets options. Hash table has key set to option,
and values are option values.
Way we have it, we set options in a different file (*.txt), and we
read from that file.
Is there easy way for just reading file and setting opt
>
> b) Define a function to extract a "key" from your items such that items
> compare the same as their keys. For example, key(x) -> x.lower() may be
> used to compare text case-insensitively.
> Then, use a tuple (key, value) instead of the bare value. When extracting
> items from the queue,
Lets say I have a dynamic list class (may be extended from list),
where I add and remove items during program.
a = []
a.append(1)
I am trying to find is there easy way keep track of 'maximum size of
list reached"
so for example len(a) goes from 0->3->4->3
If I call a.max_size_ever(), I will g
Thanks Gabriel
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 3, 8:04 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote:
> En Thu, 03 Apr 2008 21:21:11 -0300, Dan Bishop <[EMAIL PROTECTED]>
> escribió:
>
>
>
>
>
> > On Apr 3, 6:33 pm, [EMAIL PROTECTED] wrote:
> >> I saw example of memoize function...here is snippet
>
> >> def memoize(fn, slot):
> >>
I saw example of memoize function...here is snippet
def memoize(fn, slot):
def memoized_fn(obj, *args):
if hasattr(obj, slot):
return getattr(obj, slot)
else:
val = fn(obj, *args)
setattr(obj, slot, val)
On Apr 3, 5:43 pm, John Machin <[EMAIL PROTECTED]> wrote:
> On Apr 4, 9:21 am, [EMAIL PROTECTED] wrote:
>
>
>
>
>
> > On Apr 3, 4:24 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
>
> > > <[EMAIL PROTECTED]> wrote in message
>
> > >news:[EMAIL PROTECTED]
> > > |I am week on functional programming, an
On Apr 3, 4:24 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
> |I am week on functional programming, and having hard time
> | understanding this:
> |
> | class myPriorityQueue:
> | def __init__(self, f=lamda x:x):
> |
I am week on functional programming, and having hard time
understanding this:
class myPriorityQueue:
def __init__(self, f=lamda x:x):
self.A = []
self.f = f
def append(self, item)
bisect.insort(self.A, (self.f(item), item))
n
>>> dict = {'M':3, 'R':0, 'S':2}
>>> print dict
{'S': 2, 'R': 0, 'M': 3}
now if I wanted sorted values in list, i am not able to do this
>>> print dict.values().sort()
None
it returns None instead of [0, 2, 3]
--
http://mail.python.org/mailman/listinfo/python-list
11 matches
Mail list logo