ral other fixes.
>
>Homepage:
>
><http://starship.python.net/crew/theller/py2exe>
>
>Download from the usual location:
>
><http://sourceforge.net/project/showfiles.php?group_id=15583>
>
>Enjoy,
>
>Thomas
>
I haven't tried this, but I am getting interested in cannibalizing some
functionality ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 05 Sep 2005 21:39:31 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
>On 5 Sep 2005 07:27:41 -0700, "Paul McGuire" <[EMAIL PROTECTED]> wrote:
>
>>I still think there are savings to be had by looping inside the
>>try-except block, which avoids many setup/t
;> import sys
>>> bc(sys.maxint*4, 16)
'01fffc'
>>> bc(~sys.maxint*4, 16)
'fe'
oops, precendence ...
>>> bc(~(sys.maxint*4), 16)
'fe0003'
vs. the useless
>>> hex(~(sys.maxint*4))
'-0x1FF
7;100'
>>> bc(-1^3L, 2)
'100'
>>> bc(~3L, 8)
'74'
>>> bc(-1-3L, 8)
'74'
>>> bc(-1^3L, 8)
'74'
>>> bc(~3L)
'96'
>>> bc(-1-3L)
'96'
>>> bc(-1^3L)
'96'
>>> bc(bcdecode(bc(~3L)))
'96'
>>> bc(bcdecode(bc(~3L, 2),2),2)
'100'
>>> bc(~3L, 16)
'fc'
>>> bc(-1-3L, 16)
'fc'
>>> bc(-1^3L, 16)
'fc'
>>> bc(3L)
'03'
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 5 Sep 2005 22:56:29 +0200, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>
>>>as long as you have people that insist that their original misunderstandings
>>>are the only correct way to model the real world, and that all observe
t; task most likely, unless communication is
entirely via a mutable task state object, and all that's needed is to
me map to that and mess with exit state there and trigger a final .next()
to wrap up the generator.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
#x27;
r => [0, 1, 'b', 'a', 4, 5]
but two reverse relative slices match order, so
r = range(10)
r[5:-3] = range(10)[-1:-3] # rh seq is 9, 8
r => [0, 1, 8, 9, 4, 5]
I think this is kind of interesting, and I probably wouldn't have thought of
it if I had not been for Ron's enthusiasm for his "misunderstanding" ;-)
In a way, "misunderstandings" are the mutations of open source evolution of
ideas,
most of which die, but some of which mutate again and may occasionally survive.
So we need them ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
e main language requirement
(stated, that is ;-)
But "capacité de dialoguer avec des usagers non techniques et tous les membres
de l'équipe"
probably means French too ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
the larger context might be fine or not, but no one can say ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
r deleting the sentence in which the Python doc tries to
>define mathematical integers.
>
> Integers
>
> [In Python] There are three types of integers:
>
This is a nice site:
http://mathworld.wolfram.com/WholeNumber.html
http://mathworld.wolfram.com/topics/Integers.html
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 04 Sep 2005 10:10:33 +0200, Peter Otten <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>
>[it.next() appears to be a noop in the interactive interpreter]
>
>> I guess it could be in the read-eval-print loop
>
>Indeed:
>
>>>> for i in r
am running it in a console window.
Python 2.4b1 (#56, Nov 3 2004, 01:47:27)
[GCC 3.2.3 (mingw special 20030504-1)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
imilar fashion,
which gives me the feeling that -xx- as custom infix operator would
work for a lot of contexts. BTW, the ast for "left |isa| right" is
Bitor([Name('left'), Name('isa'), Name('right')])
which probably makes it faster to recognize. Obviously subtrees not
involving the specal op names would be ignored.
I don't know if ast-rewriting on the fly during customizable import
excites anyone, or if those who understand what I'm doing would just
rather I didn't post about it "devant les enfants" ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
import StringIO as SIO
>>> f = SIO('123xx678xxCxx_and so forth')
>>> for s in ireadlines(f,'xx',4): print repr(s),
...
'123xx678xx' 'Cxx_and so forth'
>>> for s in ireadlines(f,'xx',5): print repr(s),
...
''
oops
>>> f.seek(0)
>>> for s in ireadlines(f,'xx',5): print repr(s),
...
'123xx' '678xx' 'Cxx' '_and so forth'
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
27;final']
>
>>> a = Zbrxlist(list('abcde'))
>>> a
Zbrxlist(['a', 'b', 'c', 'd', 'e'])
Forgot to provide a __len__ method ;-)
>>> a[len(a.value):len(a.value)] = ['end']
>>> a
Zbrxlist(['a', 'b', 'c', 'd', 'e', 'end'])
lastx refers to the last items by zero-based reverse indexing
>>> a[lastx]
"[Zbrx(0)]: 'end'"
>>> a[lastx:lastx] = ['last']
>>> a
Zbrxlist(['a', 'b', 'c', 'd', 'e', 'last', 'end'])
As expected, or do you want to define different semantics?
You still need to spell len(a) in the slice somehow to indicate
beond the top. E.g.,
>>> a[lastx-1:lastx-1] = ['final']
>>> a
Zbrxlist(['a', 'b', 'c', 'd', 'e', 'last', 'end', 'final'])
Perhaps you can take the above toy and make something that works
they way you had in mind? Nothing like implementation to give
your ideas reality ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
On 31 Aug 2005 07:13:26 -0700, "Kay Schluehr" <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>
>> How about interpreting seq[i] as an abbreviation of seq[i%len(seq)] ?
>> That would give a consitent interpretation of seq[-1] and no errors
>> for any value
On 31 Aug 2005 07:26:48 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote:
>Op 2005-08-30, Bengt Richter schreef <[EMAIL PROTECTED]>:
>> On 30 Aug 2005 10:07:06 GMT, Antoon Pardon <[EMAIL PROTECTED]> wrote:
>>
>>>Op 2005-08-30, Terry Reedy schreef <[EMA
On Tue, 30 Aug 2005 21:23:39 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>> On Tue, 30 Aug 2005 23:12:35 +0200, Reinhold Birkenfeld <[EMAIL PROTECTED]>
>> wrote:
>>>Bengt Richter wrote:
>>>>Maybe
>>>>
On Tue, 30 Aug 2005 23:12:35 +0200, Reinhold Birkenfeld <[EMAIL PROTECTED]>
wrote:
>Bengt Richter wrote:
>> On Tue, 30 Aug 2005 12:18:59 GMT, Michael Hudson <[EMAIL PROTECTED]> wrote:
>>
>>>Talin <[EMAIL PROTECTED]> writes:
>>>
>>>
either
average brute force
or discard outlier timings and average, or return best-of. All these have
different error
properties, and depend on lots of stuff.
I'm wondering whats your application is. Maybe you need a real-time OS?
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
this. And if there isn't,
>
>Greenlets, perhaps? (for which, see google).
>
Maybe
yield in inner()
could be sugar for the above and become something optimized?
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
gt;can have a table that is indexed from e.g. -4 to +6. So how am
>I supposed to easily get at that last value?
Give it a handy property? E.g.,
table.as_python_list[-1]
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
__len__() by returning a type that supports the
>"Emulating numeric types" methods from the Python Language
>Reference 3.3.7, and also allows the class's methods to tell
>that it stands for the length of the dimension in question.
>
>
(OTTOMH ;-)
Perhaps the slice t
I think that would just be a tweak on the trailer syntax.
I just really dislike the semicolons ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
I keep explaining that concurrency
>systems have improved vastly in recent years. For a long time,
>the most sophisticated software services generally have used
>multiple lines of execution, and now that's mostly in the form
>of threads. No one actually disagrees, but they go right
at handles non-simple-name-target /= augassigns as
well,
but though it shows on google groups, I can't see it yet. Still some news server
problem, apparently. Or maybe it's just slogging to catch up after previous
problem...
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
e aspects of
classes,
your progammer.agility value can increase markedly with a little study ;-)
E.g., a name like monsters.random_elf could live right
alongside PIRATE and return one a randomly selected elf from a an internal list
of elves or via random selection from a list of elf names defined at the same
level as PIRATE, etc. etc. You could also dynamically configure these guys
according to distance to food and time since last meal, and if you are
carrying food, etc.
With suitable classes you could put instances in various "spaces" defined
by other classes, that define geometric or social or other interactions.
>
>instead of using stupid index numbers.
>
>But the loader seems to have a kind of perl-like odor to it,
>i.e., next week I won't understand what it does.
>
If you have to do something tricky, choose names wisely and
comment the non-obvious ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 28 Aug 2005 04:09:10 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
[... a response to the OP's apparent desire to "overload the divide operator"
with a call
to his safediv function ...]
The part that rewrote the the AugAssign could only work for plain name
Augassig
ttr(modsafe, 'test'): modsafe.test()
---
Result from running the above and specifying testdiv as the module
to import and enforce safediv on, and run test() on:
safediv(1.0, 2.0) => 0.5
0.5
safediv(12, 3) => 4
4
safediv(12, 3) => 4
4
safediv(4096, 4) => 1024
1024
print 1/0 =>
safediv(1, 0) => 0
0
print a/(b*(a-12)) =>
safediv(12, 0) => 0
0
def foo(x=1/(b-3)): return x =>
safediv(1, 0) => 0
print foo() =>
0
b /= (a-12) =>
safediv(3, 0) => 0
b after b/=(a-12): 0
Note that the exceptions went away ;-)
It was much messier than it should have been, and the code is not very
efficient,
but at least it's a kind of proof of concept ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
> sll
2>
>>> sll.insert('a')
'a' -> 2>
>>> sll.next
2>
>>> sll.next.insert('b')
'b' -> 2>
>>> sll
'a' -> 'b' -> 2>
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
On 26 Aug 2005 07:55:26 -0700, [EMAIL PROTECTED] wrote:
>In the '80's, Microsoft had a proprietary binary structure to handle
>floating point numbers, In a previous thread, Bengt Richter posted
>some example code in how to convert these to python floats;
>
>http:
odes found
anywhere, and
calling node-type-specific or default supplied callbacks to supply replacements
for original nodes
passed to them, but this will require a number of specialized visitors etc., so
I will have to get back
to this later. But at least the OP and you nudged me into thinking about AST
rewriting again ;-)
(also affects my @@sourcedeco ideas ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
("""\
... x = 555
... """)
>>> print '%s\n%s%s' %('-'*30, open('change.py').read(), '-'*30)
--
x = 555
------
>>> dir()
['__builtins__', '__doc__', '__name__']
>>> x = 111
>>> x
111
>>> def changevar():
... execfile('change.py', globals())
...
>>> x
111
>>> changevar()
>>> x
555
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
re thinking of turned out to be
straight IEEE double format, and I think this is not, though I think it looks
like one that was answered (by me ;-) quite a while ago (Dec 1 2003).
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
or instance to use for the property attribute magic
>>> a = Accessor()
Set obj.obj = 123 indirectly
>>> a.xobj = 123
Check
>>> vars(obj)
{'obj': 123}
Set up access to an object attribute in a different module
>>> import sys
>>> Accessor.sin = Indirect('stdin', sys)
>>> a.sin
', mode 'r' at 0x02E8E020>
>>> Accessor.pi = Indirect('pi', __import__('math'))
>>> a.pi
3.1415926535897931
>>> a.pi = 3
>>> a.pi
3
>>> import math
>>> math.pi
3
I'd say there's possibilities for shooting yourself in the foot. Maybe passing
a code to Indirect to enable get/set/del selectively would help.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
gt;Thanks in advance.
>
Not looking too closely, but I recall something similar (although I suspect
that the bit you
are "reversing" is a sign bit that shadows a known constant MSB 1 for non-zero
numbers, and
shouldn't just be reversed):
http://groups.google.com/group/comp.lang.python/browse_thread/thread/42150ccc20a1d8d5/4aadc71be8aeddbe#4aadc71be8aeddbe
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
some undprcified width
running through a speckled background is a different problem ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
line.split()) for line in in_file] # make lines as int
>>> lists
>>> for i, line in enumerate(lines):
... out = []
... for digit in line:
... out.append(digit)
... for followingline in lines[i+1:]:
... if digit in followingline:
... out.extend([x for x in followingline if x != digit])
... out_file.write(' '.join(map(str, out))+"\n")
...
0 1 5 9 2 1 4 3 3 2 4 4 1 2 3 6 7
1 0 5 9 12 10 2 3 4 3 6 7
2 3 4
3 4 6 7
0 1 12 10 5 9 10
1 12 10 9
4 6 7
10 9
(The output now has to have spaces as well, to delimit the numbers).
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
nged?
E.g., how would you have interpreted the same words rearranged as follows?
'''I'm looking for an easy way to update the modification time of a file
(to perform a UNIX-style "touch") without actually modifying it.'''
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
le = sys.stdout
>>>
>>> lines = [''.join(line.split()) for line in in_file] # clean out spaces and
>>> '\n'
>>> for i, line in enumerate(lines):
... for digit in line:
... out_file.write(digit)
... for followingline in lines[i+1:]:
... if digit not in followingline: continue
... line_sans_digit = followingline.replace(digit,'')
... out_file.write(line_sans_digit)
... out_file.write("\n")
...
021433244123
12343
234
34
Also note that I eliminated all duplicate digits from a selected line, rather
than just the
first match. Easy to change.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
ubsequent spelling e.g,
while c(f.read(1)):
# do stuff with c.x
though something more menmonic than c might be desirable in that case.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
nterests.
You're welcome to try again ;-)
(BTW, sorry if "James" doesn't mean English is your mother tongue, and I have
misinterpreted your manner of expression. If so, this may still be a useful
indication to you of how wording can determine response ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
ld save a lot of housekeeping.
>
Why do you need a name? Can you post an example snippet that shows
a callback function being used with Tkinter as you would wish?
I have a feeling there is a much simpler solution than you are imagining ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 19 Aug 2005 16:31:47 +1000, John Machin <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>> On 18 Aug 2005 22:21:53 -0700, "Greg McIntyre" <[EMAIL PROTECTED]> wrote:
>>
>>
>>>I have a Python snippet:
>>>
>>> f = op
>>> print id(c.meth1)
49219180
>>> print id(c.meth2)
49219180
But the ones we forced to persist by binding the expression values to cm1 and
cm2
above still have the same ids as before:
>>> print id(cm1)
49219020
>>> print id(cm2)
49219060
So the question would be, why do you (think you ;-) need ids for
these bound methods as such? I.e., what is the "situation" in your code?
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
7;s expression vs. statement syntactic
>separation? How can I be write this code more nicely?
>
Yes, it is related as you suspect. I'll leave it to you to make
a chunk-buffering one-liner for huge files that iterates by characters,
if one-liners turn you on. Otherwise it is easy to write a generator that will
do it.
Byt the time I post this, someone will probably have done it ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
>>> sys.path.insert(0,'foo2')
> >>> import blah as blah2
> >>> sys.modules['blah']
>
> >>> blah2.__file__
>'foo1/blah.py'
> >>>
>
How about (untested)
import new
blah1 = new.module('blah&
>>> class Base(object):
... x = property(lambda self: 'Base get_x')
...
>>> class Derv(Base):
... x = property(lambda self: 'Derv get_x')
...
>>> b = Base()
>>> d = Derv()
>>> b.x
'Base get_x'
>>> d.x
'Derv get_x'
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
', '\x02', ' ', 'A', 'B', 'C', ' ', '0', '1', '2']
The trick is to keep in mind that there is some abstraction that is
being represented in various ways, and make allowances for people's
saying "hex" when they mean the binary that the hex (characters
matching [0-9A-Fa-f]) representation is representing, and similarly
with other abstractions (e.g. binary ;-) and their representations (e.g.,
string representations of binary, or DRAM state representations of binary, etc.)
HTH
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
for persistence. Or maybe you could use zipfiles. The kind of data you are
creating above
would probably compress really well ;-)
[1] writing 314+ million identical bytes one by one is silly, of course ;-)
BTW, len is a built-in function, and using built-in names for variables
is frowned upon as a bug-prone practice.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
my game to use in a program?
>
How do I access the data behind your question?
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 16 Aug 2005 19:24:04 -0400, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
>
>"Bengt Richter" <[EMAIL PROTECTED]> wrote in message
>news:[EMAIL PROTECTED]
>> IOW, "...open the box and find the i'th item /in/ the box..." is not
>
File "k.py", line 17, in ?
>z.ala()
> File "k.py", line 14, in ala
>ludzik.l()
>TypeError: unbound method l() must be called with ludzik instance as
>first argument (got nothing instead)
>
>
>i would be gratefull for resolving this problem for me
>
HTH
Working through the tutorials is not a bad idea ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
ython
during standard time and retrieve altzone after 1AM (or whenever the official
switchover happens)? Lack of property would seem to make constants for both
altzone and timezone safer. But then daylight should probably be an accessor
function, if it can't be a property ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
;time.timezone gives you the timezone offset in minutes.
>
ITYM seconds?
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
#x27;t you at least try setpos, and fix it if there's a problem?
Or report on the problem you _actually_ encounter, which could be useful.
That much can't be much harder than looking for an alternative, and may
inspire others to help make/find a workable solution for you.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
uot;...open the box and find the i'th item /in/ the box..." is not really
finding the i'th item _itself_ "/in/" the box. It is finding one end of a string
tied to some point /in/ the box, but the actual item/object is at the other end
of the string, not /in/ the box, and many other strings may potentially also
be leading to the same object, whether originating from anonymous structural
binding points in other objects, or named binding points in name-tag-containing
objects/namespaces.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
know it effectively means 'modulescope'
and derives from a time where that was the only unqualified alternative
to local.
There's been a lot of discussion about this, periodically ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
thing()
... except Exception, e:
... print '%s: %s'% (e.__class__.__name__, e)
... except 'ugh':
... print 'Caught "ugh"'
... except:
... print sys.exc_info()
...
>>> import sys # forgot, will need when above executes ;-)
>>>
>>> test(lambda:strexraiser('ugh'))
Caught "ugh"
>>> test(lambda:strexraiser('gak'))
('gak', None, )
>>> test(lambda:1/0)
ZeroDivisionError: integer division or modulo by zero
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
repr(x) for x in (couch, price, sdate, city))
"'couch'; 32; '01/01/2004'; 'newyork'"
Note: if you want ';' appended to each item instead of just between items, you
can just add ';' to the whole thing
>>> '; '.join(str(x) for x in (couch, price, sdate, city)) + ';'
'couch; 32; 01/01/2004; newyork;'
Which avoids the trailing blank you would get if you appended '; ' to every item
before joining them, as in
>>> ''.join(('%s; '%x) for x in (couch, price, sdate, city))
'couch; 32; 01/01/2004; newyork; '
or
>>> ''.join((str(x) + '; ') for x in (couch, price, sdate, city))
'couch; 32; 01/01/2004; newyork; '
HTH
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
is depends on the extension being nicely splittable with a single '.', but
that
should be the case for you I think, if you make sure you eliminate directory
names
and file names that don't end that way. You can look before you leap or catch
the
conversion exceptions, but to do that, you'll need a loop instead of a
listcomprehension.
>>> [name for dec,name in sorted((int(nm.split('.')[1]),nm) for nm in namelist)]
['test.1', 'test.2', 'test.3', 'test.4', 'test.10', 'test.15', 'test.20']
>>> sorted(namelist)
['test.1', 'test.10', 'test.15', 'test.2', 'test.20', 'test.3', 'test.4']
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 11 Aug 2005 14:55:57 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>> Will/should an __init__.py in the current directory be required,
>> to control what happens (and lessen the probability of accidental
>> collision from a random wor
ways True.
BTW, if you have a dict d which might define 'bgcolor' as '#ee' or 'white'
you could check for either white something like (untested)
if d['bgcolor'] in ('#ee', 'white'): # put most common white code first
for
ious report with the current one, so I only use one line by the
>time the code is finished.
>
>I was also hoping that there was a set of tools out there for spinners,
>meters, etc...
The question with python for this kind of thing is usually, "Which will be
faster, googling for it, or writing it?" ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
I agree that the OP's proposal is not a core language matter.
Perhaps this is another PEEP candidate (i.e., a "Python Evironment Enhancement
Proposal"
to put in a "PEEP" application/tools/environment-oriented clone of the PEP
process).
Maybe a PEEP top page in the wiki with l
ista) mistakenly shadowing standard library modules with
>name-colliding local ones well after PEP 328 is fully implemented.
>Gotta keep people on their feet! :-)
>
Will/should an __init__.py in the current directory be required,
to control what happens (and lessen the probability of accidental
collision from a random working directory)?
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
sterable('banana')-clusterable('bananana')
0
i.e., resulting from
>>> abs(clusterable('banana'))-abs(clusterable('bananana'))
set([])
>>> abs(clusterable('banana'))
set(['na', 'ab', 'ba', 'an'])
>>> abs(clusterable('bananana'))
set(['na', 'ab', 'ba', 'an'])
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
tput whether v is '2' or 2.
>
>For this reason I tend to debug print statements like this now:
>
> if debug: print "v=%s" % (v,)
I usually prefer %r over %s for debug prints
if debug: print "v=%r" % (v,)
since it represents (repr's ;-) the v t
e file in order to get
the line of code, which an interactive session does not satisfy?
(Maybe a strategically located StringIO instance encapsulating the latest
interactive chunk as "source file" could solve it?)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
ect route ?
>ie. convert them to the double float directly from the byte values ?
Yes. Use struct.unpack ;-)
BTW, my second post was doing ''.join(chr(int(h[i:i+2],16)) for i in
xrange(0,16,2))
to undo the hexlify you had done (I'd forgotten that there's a
binascii.unhexlif
On Wed, 10 Aug 2005 03:47:06 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
>On Tue, 09 Aug 2005 21:50:06 -, Grant Edwards <[EMAIL PROTECTED]> wrote:
>
>>On 2005-08-09, Scott David Daniels <[EMAIL PROTECTED]> wrote:
>>> Grant Edwards wrote:
>>>>>
uot;)
... dhex = ''.join(reversed([dhex[i:i+2] for i in xrange(0,16,2)]))
... m = int(dhex, 16)
... x = ((m>>52)&0x7ff) - 0x3ff - 52
... s = (m>>63)&0x1
... f = (m & ((1<<52)-1))|((m and 1 or 0)<<52)
... return (1
to the namespace of a module by adding an object
whose class defines
the property, like
mod ..= objhavingproperty # same tuple ambiguity as with 'somestr' % x
something analogous to += on immutables would have to be done for builtin
objects I suppose.
Just adding more mulch/worms to the idea garden ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
OAD_DEREF 0 (TABLE)
9 CALL_FUNCTION1
12 RETURN_VALUE
I.e., the original globally bound translate replaces its global binding
with the closure it creates on first execution, and also uses that closure
to get the first result, which is a little tricky, I'd say ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
means, but taken at face value
would seem to warrant a further look into details.
This turned up also
http://eddie.sourceforge.net/txt/WP_1.0.html
which I hadn't seen before, and which looks interesting
though maybe stale?
I guess this is a home for erlang:
http://www.erlang.se/
Much
On Mon, 08 Aug 2005 21:24:15 -0400, Nicolas Fleury <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>> On Mon, 08 Aug 2005 16:18:50 -0400, Nicolas Fleury <[EMAIL PROTECTED]> wrote:
>>>I wrote the PEP to see if was the only one that would benefit from
>>>
On Tue, 09 Aug 2005 00:14:25 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote:
[...]
>Here is a decorator object to set up function call dispatch according to type.
>It only uses positional arguments, but could be fleshed out, I think.
>Not tested beyond what you see ;-)
>
><
On Mon, 08 Aug 2005 16:18:50 -0400, Nicolas Fleury <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>> On Sun, 07 Aug 2005 21:41:33 -0400, Nicolas Fleury <[EMAIL PROTECTED]> wrote:
>>>I mean should angle brackets <> like in C++, or another operator, be
>
On Sun, 7 Aug 2005 23:52:40 -0400, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
>
>"Bengt Richter" <[EMAIL PROTECTED]> wrote in message
>news:[EMAIL PROTECTED]
>> I think the relationship of abstract entities and their concrete
>> representat
On Sun, 07 Aug 2005 21:41:33 -0400, Nicolas Fleury <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
[...]
>> But here the problem is not in the __getitem__ method:
>>
>> >>> c.__getitem__(kw='key word arg')
>> (<__main__.C object at 0x
ded in their heroic coding effo=
>rt, goes to name their new module, package, or application with a "py" othe=
>r than to the right of the dot.
>
Probably better to have the PSF hire a patent/trademark lawyer to reserve rights
to py... names and the "py"-prefixing business process ;-/
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
it
can be looked
up somewhere by the name. The idea is that this form of decoration could
transform the
AST arbitrarily before code generation, and be a very flexible tool for
mischief of course,
but also useful tricky things IWT.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
= 0:
> a, b = b, a%b
>return a
>
>Even nicer.
>
what is the convention for handling signed arguments? E.g.,
>>> def gcd(a,b):
... while b != 0:
... a, b = b, a%b
... return a
...
>>> gcd(3, -12)
-3
>>> gcd(-12, 3)
3
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
t seems you could
>> do this today easily.
I agree with this, until I see some really persuasive use cases.
>
>The PEP validity is also very much influenced if optional static typing
>is planned to be added to the language. I realize defending this PEP is
>much harder without static typing and my use cases imply typing of some
>sort anyway.
>
I'll have to catch up with that. Have been very bogged down for a long while.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
C object at 0x02EF498C>, (slice(None, None, None),), {})
>>> c[kw='key word arg']
File "", line 1
c[kw='key word arg']
^
SyntaxError: invalid syntax
But here the problem is not in the __getitem__ method:
>>> c.__getitem__(kw='key word arg')
(<__main__.C object at 0x02EF498C>, (), {'kw': 'key word arg'})
It's just that square bracket expression trailer syntax does not
allow the same arg list syntax as parenthesis calling trailer syntax.
> method could be changed to allow additional signatures:
>
> def __getitem__(self, *args, **kwargs): ...
>
> Should other operators that square brackets be used for
> specialization?
Didn't quite parse that ;-) You mean list comprehensions? Or ??
>
>
>References
>
> [1] Adding Optional Static Typing to Python -- Part II,
> Guido van Rossum
> http://www.artima.com/weblogs/viewpost.jsp?thread=86641
>
> [2] Optional Static Typing -- Stop the Flames!, Guido van Rossum
> http://www.artima.com/weblogs/viewpost.jsp?thread=87182
>
>
>Copyright
>
> This document has been placed in the public domain.
>
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
;>> 'abc123cab'.strip('bca')
'123'
I.e., a strip argument as an unordered set of characters that
causes stripping so long as characters at the end(s) of the
string being stripped are found that are in the set.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
object nsofound with x attr in **=
object attribute name space sequence,
# and then do nsofound.x=456 -- where x could be a normal
property defined by type(nsofound)
The property possibility should be interesting ;-)
Be kind, I've suggested := for find-and-rebind before, but I haven't thought
very far about this combination
with extended function namespace ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
(1+0j)
(0.707106781187-0.707106781187j)
(1.5701957963e-016-1j)
(-0.707106781187-0.707106781187j)
(-1-3.1403915926e-016j)
(-0.707106781187+0.707106781187j)
(-4.71058738891e-016+1j)
(0.707106781187+0.707106781187j)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
>else:
>plot(xvalues, yvalues)
>
It seems like you are not changing the order or values of arguments,
so I'm wondering if this would work for you:
def makeplot(self, *args, **kwargs):
plot(*args, **kwargs)
and if not, why not.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
:
... @deco
... def foo(): pass
... @Base.deco
... def bar(x, y): print 'two args:', x, y
...
>>> TheClass.classvar
[('foo', 0), ('bar', 2)]
Incidentally, you can see that deco and classvar belong to the Base class,
though
accessible as instance and class attributes
>>> tc = TheClass()
>>> tc.classvar
[('foo', 0), ('bar', 2)]
>>> TheClass.mro()
[, , ]
>>> vars(tc)
{}
>>> vars(TheClass).keys()
['__module__', 'foo', 'bar', '__doc__']
>>> vars(Base).keys()
['__module__', 'deco', 'classvar', '__dict__', '__weakref__', '__doc__']
HTH. Add metaclasses and stir to taste ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
gate down to the spcific module docstring output quickly if you
have
a lot of them. Of course, I think I'd put styling in the header rather than hack
more raw html if I were to go another round.
I'll post the latest once I can see my postings in context with my own
newsreader again.
ch
function call. See the debugger chapter in the library manual.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
nction.foo
Traceback (most recent call last):
File "", line 1, in ?
AttributeError: 'function' object has no attribute 'foo'
>>> vars(function)
{}
Ok, to make the statement execute, execute function:
>>> function()
>>> a=function.foo
>>> a
'something'
>>> vars(function)
{'foo': 'something'}
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
e and all manner of
stuff.
Try typing spyxx.hlp and see if spy++ help comes up. Or possibly run an older
spy.exe for an
example of interactively selecting what to monitor. Then you could write a C
module to provide
a python interface to those capabilities. Have fun ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
t>python docstr2html.py docstr2html.py
doc strings as of Sun Jul 31 20:04:55
2005
C:\pywk\ut\docstr2html.py
Prints html to display docstrings of modules specified on command line,
with optional globbing and html page title default override.
Usage: [python] docstr2html.py [-title "some title"] (file_pattern)+
Note: If redirecting stdout, some windows versions require [python] to be
explicit.
You can use file specs like someplace\*.py (wild cards) and it should do all
the files
and put it all in tables in the html output. Note that is uses all file specs
as patterns,
and ignores without complaint any that don't match anything.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 31 Jul 2005 00:30:36 -0400, Mike Meyer <[EMAIL PROTECTED]> wrote:
>[EMAIL PROTECTED] (Bengt Richter) writes:
>
>> On Fri, 29 Jul 2005 18:07:31 -0400, Mike Meyer <[EMAIL PROTECTED]> wrote:
>>>I know, lambda bashing (and defending) in the group is one of
'classobj', ''), )
4294967296 | ((0,), 4294967296L)
-4294967296 | ((0,), -4294967296L)
--
Sorted:
-4294967296
-1.0
1
4294967296
2j
(1+0j)
at 0x02EE8E2C>
at 0x02EE8DF4>
<__main__.D object at 0x02F0044C>
__main__.C
<__main__.C instance at 0x02F004CC>
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 30 Jul 2005 08:14:16 +0100, [EMAIL PROTECTED] (phil hunt) wrote:
>On Fri, 29 Jul 2005 06:37:52 GMT, Bengt Richter <[EMAIL PROTECTED]> wrote:
>>
>>I suggested in a previous thread that one could support such a syntax by
>>supporting an invisible binary opera
t everyone else thought about it. As a
>result, the code examples tend to be ugly.
>
>As previously hinted, this feature is lifted from Oz.
try
http://groups-beta.google.com/groups?as_q=anonymous+def&as_ugroup=comp.lang.python
for much discussion of this ;-)
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
doc = "Just an example")
>
Again, the '@' is not necessary ;-)
>This looks like the abuse of lambda case, but these aren't
>assignments, they're keyword arguments. You could leave off the
>keywords, but it's not noticably prettier. fget can be done with a
>lambda, but the the others can't.
Well, they can, but it's not pretty ;-)
>
>Giving clases the same functionality seems to be the reasonable thing
>to do. It's symmetric. And if anonymous function objects are good,
>then anonymous class objects ought to be good as well.
I agree.
Regards,
Bengt Richter
--
http://mail.python.org/mailman/listinfo/python-list
401 - 500 of 974 matches
Mail list logo