e in open(path):
fields = line.split('\t')
data[tuple(fields[:2])] = map(float,fields[2:])
return data
d1 = read_data(sys.argv[1])
d2 = read_data(sys.argv[2])
for key in d1:
if key in d2:
diffs = map(sub, d1[key], d2[key])
print key, diffs
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
method signatures like this is worse than the problem
they're trying (unsuccessfully) to solve. You should try to resolve
the cyclic dependencies first. If it's not possible, that's probably a
sign that they should live in the same module after all.
George
--
http://mail.python.org/mailman/listinfo/python-list
n many other languages (C, Pascal, etc.), a
^
Methinks the only real disagreement in this thread is what's a
"modern" language; Joe has made clear that he's not comparing Python
to C, Pascal or Fortran.
George
--
http://mail.python.org/mailman/listinfo/python-list
f all the data lines must or
should be given at once, append them in a list and feed them all as
soon as the next section is found), something like:
class parse_a(object):
def __init__(self, metadata):
print 'parser a', metadata
def parse(self, line):
print 'a', line
# similar for parse_b and parse_c
# ...
def parse(lines):
parse = None
for line in lines:
if test_for_type(line):
type_id, metadata = line.split(' ', 1)
parse = type2parser[type_id](metadata).parse
else:
parse(line)
George
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 17, 5:59 pm, Stef Mientki <[EMAIL PROTECTED]> wrote:
> mina2020 wrote:
>
> what has this todo with Python ?
Do you take the time to reply to every spam you receive ?
--
http://mail.python.org/mailman/listinfo/python-list
y the file is not tab delimited. If you used an editor to
produce dummy.txt, check whether it uses soft tabs and disable it
temporarily.
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 21, 1:44 pm, [EMAIL PROTECTED] wrote:
> > Most likely the file is not tab delimited. If you used an editor to
> > produce dummy.txt, check whether it uses soft tabs and disable it
> > temporarily.
>
> > HTH,
> > George
> > Most likely the file is not
ypeError: __call__() takes exactly 2 arguments (1
> given)
You have to wrap it as an (unbound) instance method explicitly:
from types import MethodType
Foo.meth = MethodType(Obj(), None, Foo)
f.meth()
For normal functions this seems to be done implicitly (of course you
can do it explicitly if you w
maintained any more. For commercial
solutions, Star-P [3] seems an interesting platform, with bindings to
Matlab and Python. Freebase [4] is apparently built on a special graph
database but unfortunately only the stored data are available, not the
DB source code.
George
[1] http://www.boost.org/
', 'bcb',
'bc', 'bd']. Currently I do it with:
s.sort(cmp=lambda x,y: 0 if x==y else
-1 if x.startswith(y) else
+1 if y.startswith(x) else
cmp(x,y))
Can this be done with an equivalent key function instead of cmp ?
George
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 3, 12:55 pm, [EMAIL PROTECTED] wrote:
> Mariyam> Process Manager for Windows
> Mariyam> (http://processpriority.wiki.sourceforge.net/) It has always
> Mariyam> been a pain to use applications like
> Mariyam> Office/Outlook/Matlab/Delphi/Mozilla...Image editing s/w
> Mariy
ngs too:
>
> print sorted(s, key=lambda x: [-ord(l) for l in x], reverse=True)
>
> Bye,
> bearophile
Awesome! I tested it on a sample list of ~61K words [1] and it's
almost 40% faster, from ~1.05s dropped to ~0.62s. That's still >15
times slower than the default sorting (0
vate fields/methods.
Technically there are no private attributes in (pure) Python so the
answer is still classes.
George
--
http://mail.python.org/mailman/listinfo/python-list
optimizations, you can define a class with __slots__:
>>> class MyStruct(object):
... __slots__ = ('x', 'y')
...
>>> s = MyStruct()
>>> s.x = 3
>>> s.y = 4
>>> s.z= 5
Traceback (most recent call last):
File "", line 1,
t; missed having an equivalent to the Pascal record or C
> struct: essentially a named mutable tuple.
+1. FWIW, I posted a recipe along these lines, following closely the
functionality and implementation of namedtuple:
http://code.activestate.com/recipes/576555/
George
--
http://mail.python.org/mailman/listinfo/python-list
t = 0
... for i,size in enumerate(sizes):
... stop = start+size
... slices[i] = slice(start,stop)
... start = stop
... return lambda string: [string[s].strip() for s in slices]
...
>>> order_slicer = slicer(10,1,10,4)
>>> order_slicer('__2345H30_NC_'.replace('_',' '))
['2345', 'H', '30', 'NC']
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
ator is infinite, and although it can be
artificially constrained by, say, a maxdepth parameter, for now I'm
interested in finite regexps only. It shouldn't be too hard to write
one from scratch but just in case someone has already done it, so much
the better.
George
--
http://mail.python.org/mailman/listinfo/python-list
elf is copied while in Java (and Python)
only the reference ("handler") is copied. By the way, passing a
(copied) reference is *not* equivalent to call by reference: in the
former case, the assignment of the reference to a different object has
only a local effect, i.e. it is not reflected to the caller's frame,
whine in call by ref it does.
George
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 4, 9:56 pm, Paul McGuire <[EMAIL PROTECTED]> wrote:
> On Nov 4, 1:34 pm, George Sakkis <[EMAIL PROTECTED]> wrote:
>
>
>
> > Is there any package that parses regular expressions and returns an
> > AST ? Something like:
>
> > >&g
On Nov 4, 3:30 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
> > Is there any package that parses regular expressions and returns an
> > AST ? Something like:
>
> >>>> parse_rx(r'i (love|hate) h(is|er) (cat|dog)s?\s*!+')
>
old data structures (e.g.
[default]dicts and [named]tuples).
George
--
http://mail.python.org/mailman/listinfo/python-list
would be
no need to copy the sequence:
def freeze(self):
self.__class__ = frozenlist
George
--
http://mail.python.org/mailman/listinfo/python-list
an error.
Given that in SQL "NULL `op` something" is False for all comparison
operators (even NULL=NULL), raising an error seems a much lesser evil
George
--
http://mail.python.org/mailman/listinfo/python-list
the object
you're trying to pickle until you find the problematic one(s) ?
Something like:
class MyClass(object):
...
def __getstate__(self):
del self.foo
return self.__dict__
Then do the same to the class of self.foo, and so on recursively,
until you find the real culprit.
HT
ject in Python.
>
> I'm not sure why this special case was dropped in Python 3.0. None
> is generally used to be a place holder for a n/a-value and as
> such will pop up in lists on a regular basis.
>
> I think the special case for None should be readded to Python 3.0.
On p
rue if the object responds to that
> > method, False otherwise.
>
> Too hard. For methods, which are what define duck species, and any
> attribute guaranteed to not be null, "assert ob.name" is equivalent to
> "assert hasattr(ob, 'name')".
As you just sh
general sense, e.g. for Java including both
primitives and object references), i.e. there's the following
approximate mapping in terminology:
Python jargon Non-python jargon
===
object value (primitive or composite)
value state (
implications.
To me this seems it combines the worst of both worlds: the
explicitness of LBYL with the heuristic nature of duck typing.. might
as well call it "doyoufeellucky typing". If you are going to Look
Before You Leap, try to stick to isinstance/issubclass checks
(especially in 2.6+ that they can be overriden) instead of crafting ad-
hoc rules of what makes an object be X-like.
George
--
http://mail.python.org/mailman/listinfo/python-list
is it possible that there could be any
> language feature Python doesn't have, which might be useful to anyone
> in any situation?
Sure; true multithreading, macros, non-crippled lambda, optional
static typing are some reasonable features people miss in Python. The
topic of this thread just isn't one of them.
George
--
http://mail.python.org/mailman/listinfo/python-list
Zope and Twisted had to come up with interfaces to manage their
massive (for Python at least) complexity.
George
--
http://mail.python.org/mailman/listinfo/python-list
gt; cases would not be this complex, of course, but would be closer to
>
> assert(fits(foo, strlike))
>
> But this is still pretty ugly. Hmm. Maybe I'd better wait for
> ABCs. :)
You might also be interested in the typecheck module whose syntax
looks nicer, at least for the common cases:
http://oakwinter.com/code/typecheck/dev/
George
--
http://mail.python.org/mailman/listinfo/python-list
tantiate a new x object for
> each iteration of the FOR loop
What is box()? Pasting its definition would help.
George
--
http://mail.python.org/mailman/listinfo/python-list
end(6)
where `expr` would mean "evaluate the expression in the function
body". Apart from the obvious usage for mutable objects, an added
benefit would be to have default arguments that depend on previous
arguments:
def foo(x, y=`x*x`, z=`x+y`):
return x+y+z
as opposed to the more verbos
...
> However I can see
> far more justification for the behavior Python currently exhibits than
> the semantic time-bomb you are proposing.
I didn't propose replacing the current behavior (that would cause way
too much breakage), only adding a new syntax which is now invalid, so
one would have to specify it explicitly.
George
--
http://mail.python.org/mailman/listinfo/python-list
When quoting wikipedia became the new Godwin's law ?? :)
George
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 16, 2:30 pm, "Chris Rebert" <[EMAIL PROTECTED]> wrote:
> On Sun, Nov 16, 2008 at 11:02 AM, George Sakkis <[EMAIL PROTECTED]> wrote:
> > On Nov 16, 8:28 am, Steve Holden <[EMAIL PROTECTED]> wrote:
>
> >> "Less obvious" is entirel
On Nov 17, 12:25 am, "W. eWatson" <[EMAIL PROTECTED]> wrote:
> Is there some repository that says something like for Python 2.5 it works
> with:
>
> Win OSes: W2K, XP, Vista
> numpy vers y, matplotlib vers x. scipy z, etc.
http://www.catb.org/~esr/faqs/smart-questions.html#writewell
--
http://mai
d a PhD in
denotational semantics or ontology to use Python effectively. The
current discussion on that thread may be interesting to language
lawyers and philosophers but it's pretty much irrelevant in
understanding how Python works.
George
--
http://mail.python.org/mailman/listinfo/python-list
e the language 10 years from now,
> so why not change it now?
You probably messed up with your time machine; "now" is 2008, not
1991 ;-)
George
--
http://mail.python.org/mailman/listinfo/python-list
t, just decorate it explicitly at runtime:
def CheckIP():
...
n = int(raw_input('Give number of retries:'))
CheckIP = retry(n)(CheckIP)
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 19, 1:53 am, gavino <[EMAIL PROTECTED]> wrote:
> python vs smalltalk 80
>
> which is nicer?
Dunno but there's an interesting talk about this:
http://www.youtube.com/watch?v=oHg5SJYRHA0
--
http://mail.python.org/mailman/listinfo/python-list
>
> Traceback (most recent call last):
> File "", line 1, in
> NameError: name 'd1' is not defined
>
> Do you really want a "default" argument that changes value depending
> upon actions performed in the /surrounding/ scope?
Yes, the surrounding scope in this case is the global scope; changing
or deleting globals has by definition global reach. Regardless, how
common is this usage in real code ? I believe an order of magnitude
less than the need for fresh mutable objects.
George
--
http://mail.python.org/mailman/listinfo/python-list
t; class Foo():
> bar = 1
> gum = 2
>
> mylist = ['bar','gum']
>
> a = Foo()
> for each in mylist:
> a.eval(each) = 999
>
> If so, what is the proper syntax/method for this.
for each in mylist:
setattr(a, each, 999)
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
boolean option, pass action="store_true" to
p.add_option(). The test then is reduced to "if zipfile" and the
program is to be called by "myscript.py -c". Read the docs [1] for
more details.
HTH,
George
[1] http://docs.python.org/library/optparse.html#standard-option-actions
--
http://mail.python.org/mailman/listinfo/python-list
s to explicitly create a copy of the object
> > property befor passing it to recursive_func, but if it's used more than
> > once inside various parts of the class that could get messy.
>
> > Any thoughts? Am I crazy and this is supposed to be the way python works?
>
> Of course, providing a shallow (or deep as necessary) copy makes it
> work, I'm curious as to why the value passed as a parameter to a
> function outside the class is passed a reference rather than a copy.
Why should it be a copy by default ? In Python all copies have to be
explicit.
George
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 20, 6:58 pm, [EMAIL PROTECTED] wrote:
> Johannes> Seems it was removed on purpose - I'm sure there was a good
> Johannes> reason for that, but may I ask why?
>
> Start here:
>
> http://www.mail-archive.com/[EMAIL PROTECTED]/msg11474.html
>
> Also, a comment to this blog post sug
#x27;attributes' to avoid confusion?
>
> Is this correct enough for me to avoid the aforementioned bug pile?
No, a class can have attributes just like a instance can, and you can
use setattr() to set an attribute for a class just like you do it for
instances:
class Foo():
bar = 1
gum =
On Nov 21, 10:18 am, Chuck Connors <[EMAIL PROTECTED]> wrote:
> Any help, pseudo code, or whatever push in the right direction would
> be most appreciated. I am a novice Python programmer but I do have a
> good bit of PHP programming experience.
I'm wondering if PHP experience precludes the abil
tion, provided that (1) it *is*
still possible to write dynamic code if necessary and (2) the extra
effort in writing and reading it is not off-putting (e.g. no C++
template metaprogramming atrocities)
George
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 21, 11:05 am, Steve Holden <[EMAIL PROTECTED]> wrote:
> George Sakkis wrote:
> > On Nov 21, 10:18 am, Chuck Connors <[EMAIL PROTECTED]> wrote:
>
> >> Any help, pseudo code, or whatever push in the right direction would
> >> be most appreciated. I a
On Nov 21, 2:01 pm, Richard Riley <[EMAIL PROTECTED]> wrote:
> George Sakkis <[EMAIL PROTECTED]> writes:
> > On Nov 21, 11:05 am, Steve Holden <[EMAIL PROTECTED]> wrote:
> >> George Sakkis wrote:
> >> > On Nov 21, 10:18 am, Chuck Connors <[EMAIL
#append to the list generated before.
> while num <= 10:
> aList.append(num)
> num +=1
> else:
> return aList
>
> Why is this? Thanks, hope its not a stupid quesiton.
Sigh.. no it's not stupid at all; actually it is (and will probably
remain, unfortunately) the most FA
.compile(r'''
(?:\D|\b)# find a non-digit or word boundary..
(\d{4}) # .. followed by the 4 digits to be matched as group
#1..
(?:\D|\b)# .. which are followed by non-digit or word boundary
''', re.VERBOSE)
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
, dynamically.
>
> Is this possible? If so, how?
Easily:
derived_cls = type('Derived', (cls1, cls2, *rest_classes), {})
item = derived_cls(**itemArgs)
You will probably want to cache the generated classes so that at most
one class is created for each combination of mixins.
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
coherent
presentation.
It sounds like the sort of thing to avoid. I'm just learning Python myself
and I'll look elsewhere.
George
George A. Grimes
972-995-0190 - Desk
214-205-0244 - Cell
"The major difference between a thing that might go wrong and a thing that
cannot possi
Hi guys,
I've been developing some code for a university project using Python.
We've been working on an existing codebase, cleaning it up and removing
dead wood.
We decided to make some changes to internal message handling by using a
SocketServer, which worked great when we were using 2.6, a
On 2009-03-11 04:36:29 +, "Mark Tolonen" said:
"David George" wrote in message
news:00150e67$0$27956$c3e8...@news.astraweb.com...
Hi guys,
I've been developing some code for a university project using Python.
We've been working on an existing codebas
On 2009-03-11 19:02:26 +, Falcolas said:
On Mar 11, 12:28 pm, David George wrote:
On 2009-03-11 04:36:29 +, "Mark Tolonen" s
aid:
"David George" wrote in message
news:00150e67$0$27956$c3e8...@news.astraweb.com...
Hi guys,
I've been developing s
On 2009-03-12 08:03:06 +, "Mark Tolonen" said:
"Falcolas" wrote in message
news:1b6a95a4-5680-442e-8ad0-47aa9ea08...@w1g2000prk.googlegroups.com...
On Mar 11, 1:11 pm, David George wrote:
Again, problem here is the issue of being unable to kill the server
whi
above behaviour? If not, what would be a
reasonable alternative to supervisor? I know of upstart and daemontools.
George
--
http://mail.python.org/mailman/listinfo/python-list
27;x' is 'x'+''
True
>>> 'x' is ''+'x'
True
>>> 'x' is 'x'*1
True
>>> 'x' is str('x')
True
>>> 'x' is str('x')+str('')
True
>>> 'x' is str.__new__(str,'x')
True
George
--
http://mail.python.org/mailman/listinfo/python-list
adable (took me 10 seconds to parse vs 1 for the former).
- slower (makes a function call on every round).
- broken (creates a new dict instead of modifying the original in
place).
Really, there's not much of a dilemma here.
George
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 18, 2:13 pm, "R. David Murray" wrote:
> George Sakkis wrote:
> > Is there a way to turn off (either globally or explicitly per
> > instance) the automatic interning optimization that happens for small
> > integers and strings (and perhaps other types) ? I tr
rtin mentioned, this is easy even
without str.new(), simply by wrapping each url in an instance of a
small Node class.
George
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 18, 4:50 pm, "andrew cooke" wrote:
> this is completely normal (i do exactly this all the time), BUT you should
> use "==", not "is".
Typically, but not always; for example check out the identity map [1]
pattern used in SQLAlchemy [2].
George
[1
if is_boundary(cur,next):
yield group
group = []
group.append(next)
cur = next
yield group
George
[1] http://code.activestate.com/recipes/521877/
--
http://mail.python.org/mailman/listinfo/python-list
Raymond Cote wrote:
George Trojan wrote:
1. Is supervisor still developed?
I note that, although the information on the site is pretty old, there
have been some respository checkins in Feb and March of this year:
<http://lists.supervisord.org/pipermail/supervisor-checkins/>
-r
I
April fools day is not until tomorrow. Your joke is a day early.
George A. Grimes
972-995-0190 - Desk
214-205-0244 - Cell
-Original Message-
From: filmmaker [mailto:centrixfi...@gmail.com]
Sent: Tuesday, March 31, 2009 3:47 PM
To: python-list@python.org
Subject: make money
es/528936/
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
groups())),
...
}
If not, you can combine the handler definition with the mapping update
by using a simple decorator factory such as the following (untested):
def rxhandler(rx, mapping):
rx = re.compile(rx)
def deco(func):
mapping[rx] = func
return func
return deco
d = {}
@rxhandler("^DATASET:\s*(.+) ", d)
def handle_dataset(match):
...
@rxhandler("^AUTHORS:\s*(.+) ", d)
def handle_authors(match):
...
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
The
> > immediate result is that you'll see any errors and be able to fix them
> > before they end up in your script.
>
> > Nick Ballardhttp://90daysofpython.blogspot.com
>
> thanks, i'll give it a try
Or even better, install IPython [1], a python interpreter on steroids.
It's the first 3rd party python package I install on every new system
I work on; it's so powerful and versatile, it has almost displaced the
regular linux shell for me. I highly recommend it.
George
[1] http://ipython.scipy.org/
--
http://mail.python.org/mailman/listinfo/python-list
A in this way?
>
> Note that I'm looking for the calling object and NOT the calling
> function.
Read up on descriptors [1], it seems that's what you're looking for.
HTH,
George
[1] http://users.rcn.com/python/download/Descriptor.htm
--
http://mail.python.org/mailman/listinfo/python-list
lt`, confidence) tuples, or
it might be a justifiable cost ? Any other API extension approaches
that are applicable to such situations ?
George
--
http://mail.python.org/mailman/listinfo/python-list
ppealing if `Result` happens
to be a builtin (e.g. float or list). Technically you can subclass
builtins but I think, in this case at least, the cure is worse than
the disease.
George
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 6, 7:57 pm, "andrew cooke" wrote:
> andrew cooke wrote:
> > George Sakkis wrote:
> >> That's more of a general API design question but I'd like to get an
> >> idea if and how things are different in Python context. AFAIK it's
> &g
On Apr 7, 3:18 pm, Adam Olsen wrote:
> On Apr 6, 3:02 pm, George Sakkis wrote:
>
> > For example, it is common for a function f(x) to expect x to be simply
> > iterable, without caring of its exact type. Is it ok though for f to
> > return a list for some types/values
kits built for exactly this purpose instead of putting together an
ad-hoc, informally-specified bug-ridden slow implementation of half of
their feature set.
George
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 11, 4:26 pm, Mike H wrote:
> George,
>
> I'd love to. Can you give me an idea of where to start looking? I've
> gone through a couple of books, and Googled a ton of websites. Maybe
> I'm just not using the right terms. My background is definitely not
>
5675])
>>> # convert to a 4by3 array in place
>>> s.shape = (4,3)
>>> s
array([[ 0.84971586, 0.05786009, 0.9645675 ],
[ 0.84971586, 0.05786009, 0.9645675 ],
[ 0.84971586, 0.05786009, 0.9645675 ],
[ 0.84971586, 0.05786009, 0.9645675 ]])
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 11, 6:05 pm, ergconce...@googlemail.com wrote:
> On Apr 11, 11:18 pm, George Sakkis wrote:
>
>
>
> > The numpy import *is* important if you want to use numpy-specific
> > features; there are many "tricks" you can do easily with numpy arrays
> >
r the involved classes and don't care about Python 3.x
(where old-style classes are gone), you may choose to downgrade
GeneralTypeOfObject to old-style.
George
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 19, 6:01 pm, "Martin P. Hellwig"
> Besides, calling Python Object-Orientated is a bit of an insult :-). I
> would say that Python is Ego-Orientated, it allows me to do what I want.
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
void tabs if you can.
George
--
http://mail.python.org/mailman/listinfo/python-list
hi, I'm a Python beginner with a basic question. I'm writing a game
where I have keyboard input handling defined in one class, and command
execution defined in another class. The keyboard handler class
contains a dictionary that maps a key to a command string (like 'h':
'left') and the command hand
On May 5, 9:01 am, Chris Rebert wrote:
> On Tue, May 5, 2009 at 8:52 AM, George Oliver
> wrote:
> > I create instances of these classes in a list attached to a third,
> > 'brain' class.
>
> You could exploit Python's dynamism by using the getattr() fu
On May 5, 11:59 am, Dave Angel wrote:
> 1) forget about getattr() unless you have hundreds of methods in your
> map. The real question is why you need two maps. What good is the
> "command string" doing you? Why not just map the keyvalues directly
> into function objects?
Thanks for the repl
Thanks for the suggestions so far. I've taken the advice to keep
things simple so currently I'm just creating one instance of the
commandHandler and assigning it a name with command = commandHandler
(). This makes it easy to call it from any of the other handlers, and
I think this will work for wha
On May 6, 3:07 pm, Carl Banks wrote:
> I'm going to guess that you want the keyboardHandler to call method of
> commandHandler. There's no reason for commandHandler to be a handler
> at all then: keyboardHandler is already handling it.
Thanks Carl, you've got it right and your following exampl
you saw http://code.activestate.com/recipes/277940/ ?
George
--
http://mail.python.org/mailman/listinfo/python-list
, args
>>> cls.meth
<__main__.test_decorator object at 0x87663cc>
>>> cls.meth2
>>> cls().meth2(1,2,3)
Decorator2: (<__main__.cls object at 0x8766ecc>, 1, 2, 3)
Method2:(1, 2, 3)
The reason this works is that functions are already descriptors, so
you don't have to explicitly define __get__() as you would for a new
callable class (see Peter's example).
HTH,
George
--
http://mail.python.org/mailman/listinfo/python-list
On May 12, 12:49 pm, Mensanator wrote:
> On May 12, 8:27 am, rump...@web.de wrote:
>
> > > > > The language and library are missing arbitrary precision integer
> > > > > arithmetic, using GMP or something like that.
>
> > > > True, but currently not a high priority for me.
>
> > > Too bad. That ma
e()
I tried it:
>>> "Nohtyp".reverse()
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'str' object has no attribute 'reverse'
This newfangled Nohtyp language is no good, I want my money back.
George
--
http://mail.python.org/mailman/listinfo/python-list
e almost zero chances of adding syntax support
for this. Besides, Guido and other py-devs are not particularly keen
on threads as a parallelization mechanism.
George
--
http://mail.python.org/mailman/listinfo/python-list
/instance, let alone all the
special methods (e.g. __getattribute__ very rarely needs to be
overridden). Do you have an actual use case or are you just playing
around ?
George
--
http://mail.python.org/mailman/listinfo/python-list
ts so that they sum up to 1.
2. Form the cumulative sequence S = [0, w0, w0+w1, w0+w1+w2, ..., sum
(w)==1.0]
3. Call random.random() -> x
4. Find the bucket in S that x belongs to, i.e. the i so that s[i] <=
x < s[i+1] (you can do this fast using the bisect module).
5. Return choice[i]
6.
ot access by __builtins__ or locals()
> | (like ["assert","break","class",...])
>
> You appear to want the keywords that begin statements. Look at the keyword
> list in the language reference and pick those you want. Then build that
> list into
anywhere else. Saving time for the reader is a very important job of
> the writer of code.
If you push this logic too far, you should del every name immediately
after the last statement it is used in the scope. I would generally
find less readable some code spread with del every few l
se for most programs since they don't play music
anyway.
Your best bet is if the *specific* program you're interested in (e.g.
audacious) exposes this information programmatically in some way. It's
up to the developers of this application if and how they choose to do
it. Even
gt; (is greater than)
> > <= (is less than or equals)
> >> = (is greater than or equals)
>
> > Is it true?
>
> May I ask *where* did you read that crazy idea?
My guess is that he heard about the TypeErrors to be raised when
comparing values of different types and he mi
On May 13, 9:46 am, Sanoski <[EMAIL PROTECTED]> wrote:
> Any programming that helps you solve a problem is fun and
> recreational. At least, that's how I look at it. I suppose it really
> depends on why you're doing it, what your objective is, etc. But I'd
> say, why not?
You must be new here. It
1101 - 1200 of 1560 matches
Mail list logo