-- yet have nothing worthy of 500 lines!
Could this be the reason why I cannot see his messages on Google Groups?
I don't see them either. My news server provider filters spam too.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
] )
return frame_delay
Then he did it consequently wrong. `frame_delay` is always `None` here
so the ``return`` is useless.
You asked what this code means and now you don't like the answer that
it's somewhat useless code!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 09 Mar 2009 04:22:57 -0700, W. eWatson wrote:
Marc 'BlackJack' Rintsch wrote:
On Sun, 08 Mar 2009 22:20:09 -0700, W. eWatson wrote:
You didn't answer my question why entry is necessary at all. The
original author thought it was necessary to return entry. I'll give
you a peek
this example show? And where's the singleton here? BTW:
In [367]: a = 2 ^ 100
In [368]: b = 2 ^ 100
In [369]: a == b
Out[369]: True
In [370]: a is b
Out[370]: True
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of
with strip(), is that the best way?
At which point do you get rid of it and why?
BTW the last line of the code snippet needs parenthesis to actually
*call* the `conn.close` method.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
`StringVar`.
Why have two ways of doing this?
Convenience. Setting a `Variable` that is used in a widget,
automatically updates the display of the widget. And `Variable`\s have a
method to add callbacks that get called when the content changes.
Ciao,
Marc 'BlackJack' Rintsch
--
http
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 04 Mar 2009 09:04:50 -0800, chuck wrote:
On Mar 3, 10:40 pm, Marc 'BlackJack' Rintsch bj_...@gmx.net wrote:
On Tue, 03 Mar 2009 18:06:56 -0800, chuck wrote:
I am learning python right now. In the lesson on tkinter I see this
piece of code
from Tkinter import *
class MyFrame
.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
:
main()
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
is not given back to the operating system. This
doesn't mean that it is not freed by Python and can't be used again by
Python. Create the dictionary again and see if the memory usage rises
again or if it stays stable.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
software. You can tag versions with symbolic names like Dev4
or Release-1.0 and can ask the VCS for a copy of the sources with a
given tag or even date.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
? If not then
`ctypes` might be the wrong tool.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
. For the simple case, though, like that presented by the OP,
I believe super() is perfect.
But for the simple cases it is unnecessary because it was invented to
deal with multiple inheritance problems.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
(this is not polite).
So I'm impolite. :-) I'm using multiple inheritance only for mixin
classes and even that quite seldom. No `super()` in my code.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
without any
getters or setters through the reflection API. See the article
`Subverting Java Access Protection for Unit Testing`_ for examples.
.. _Subverting Java Access Protection for Unit Testing:
http://www.onjava.com/pub/a/onjava/2003/11/12/reflection.html
Ciao,
Marc 'BlackJack
On Fri, 30 Jan 2009 21:59:34 +0100, Stef Mientki wrote:
Marc 'BlackJack' Rintsch wrote:
On Fri, 30 Jan 2009 00:25:03 +0100, Stef Mientki wrote:
try this:
class MyRegClass ( int ) :
def __init__ ( self, value ) :
self.Value = value
def __repr__ ( self ) :
line = hex
to access it, its name
would be `_very_interesting_member`. I don't have to wait till compile
time to see that, it is really obvious at the time I write the code to
access it, or decide not to because it is not part of the API.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
):
return '0x%X' % self.value
__str__ = __repr__
This is unnecessary, the fallback of `__str__` is `__repr__` already.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 26 Jan 2009 12:22:18 +, Sion Arrowsmith wrote:
content = a.readlines()
(Just because we can now write for line in file doesn't mean that
readlines() is *totally* redundant.)
But ``content = list(a)`` is shorter. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http
On Mon, 26 Jan 2009 16:10:11 +0100, Andreas Waldenburger wrote:
On 26 Jan 2009 14:51:33 GMT Marc 'BlackJack' Rintsch bj_...@gmx.net
wrote:
On Mon, 26 Jan 2009 12:22:18 +, Sion Arrowsmith wrote:
content = a.readlines()
(Just because we can now write for line in file doesn't mean
;
charset=utf-7
Why weird? Makes perfect sense:
In [98]: print '+IBQ-'.decode('utf-7')
—
In [99]: unicodedata.name('+IBQ-'.decode('utf-7'))
Out[99]: 'EM DASH'
So there are newsreaders out there that can't or at least don't decode
UTF-7.
Ciao,
Marc 'BlackJack' Rintsch
--
http
'\x00\x00\x00\x00\x00\x00\x00'
As MRAB says, maybe the first 1024 actually *are* all zero bytes. Wild
guess: That's a file created by a bittorrent client which preallocates
the files and that file above isn't downloaded completely yet!?
Ciao,
Marc 'BlackJack' Rintsch
--
http
what an IBQ is.
+IBQ- seems to be the way your newsreader displays the dashes that where
in Ben's posting. I see em dash characters there:
In [84]: unicodedata.name(u'—')
Out[84]: 'EM DASH'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
to avoid such code
duplication.
if date == currentDate:
inc += 1
elif date currentDate:
inc = 1
else:
assert False # Should never happen.
return %s%02d % (date, inc)
That's it.
Ciao,
Marc 'BlackJack' Rintsch
--
http
. So they respect the leading underscore convention. No use case
for enforced access restriction.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
for trouble to me.
That's why those regions are usually write protected and no execution
allowed from the code in the user area of the virtual address space.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
find the solution.
Look into the `email` package in the standard library.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
as end of text character in text files by Windows. So
if you want all, unaltered data, open the file in binary mode ('rb' and
'wb').
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
you simply
write the values sequentially, why can't you just use a flat list and
append here?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 09 Jan 2009 19:33:53 +1000, James Mills wrote:
On Fri, Jan 9, 2009 at 7:15 PM, Marc 'BlackJack' Rintsch
bj_...@gmx.net wrote:
Why parentheses around ``print``\s argument? In Python 3 ``print``
is a statement and not a function.
Not true as of 2.6+ and 3.0+
print is now
are mapped to ones after the
loop which gives a pretty boring PGM. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
') as data_file:
blocks = iter(partial(data_file.read, blocksize), '')
pixel_values = imap(ord, iter_max_values(blocks, pixels))
write_pgm(filename + '.pgm', width, height, pixel_values)
if __name__ == '__main__':
main()
Ciao,
Marc 'BlackJack' Rintsch
--
http
On Fri, 09 Jan 2009 12:39:22 -0800, Leland wrote:
It seems work this way, but is there more elegant way to do this?
Yes, the `csv` module in the standard library.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
code. And for some
very generic functions that are called with lots of different types, the
memory consumption is high because of all the specialized code that will
be compiled.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 09 Jan 2009 15:34:17 +, MRAB wrote:
Marc 'BlackJack' Rintsch wrote:
def iter_max_values(blocks, block_count):
for i, block in enumerate(blocks):
histogram = defaultdict(int)
for byte in block:
histogram[byte] += 1
yield max
in
Python 3 (print()). Where is the problem?
There is no problem. ``print``\s are handled fine by the 2to3.py
script. The option warns about stuff that is not easily automatically
converted.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
that. Using reference counting for
memory management is an implementation detail. It's possible to use
other garbage collectors without the need of reference counting.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
not get a chance to take
care of those, what is a good way to do so? Does a try/finally or a
with statement address that? Thanks!
If you clean up the mess in the ``finally`` branch: yes. Ctrl+C
raises a `KeyboardInterrupt`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
=resultado) 30hello.pack()
31F.mainloop()
…and here.
There is only one `Tk` instance and mainloop allowed per `Tkinter`
application. Otherwise really strange things can happen. Additional
windows have to be created as `Toplevel` instances.
Ciao,
Marc 'BlackJack' Rintsch
--
http
On Sun, 04 Jan 2009 20:03:11 -0600, Derek Martin wrote:
On Sat, Jan 03, 2009 at 10:15:51AM +, Marc 'BlackJack' Rintsch
wrote:
On Fri, 02 Jan 2009 04:39:15 -0600, Derek Martin wrote:
What's the difference between Python and Java or C# here!? Or are they
also BIZARRE!?
I am happily
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 04 Jan 2009 10:55:17 +, Steven D'Aprano wrote:
I thought there was an iterator in itertools for taking the first n
items of an iterator, then halting, but I can't find it. Did I imagine
such a tool, or am I missing something?
`itertools.islice()`
Ciao,
Marc 'BlackJack
is something
different than answering a question that should have been a new thread
start.
Oh, and: *plonk* for your childish annoying behaviour…
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
the named bins model from the majority
of other languages people are likely to have been exposed to is simple
and sensible.
I think the bin model is more complex because you don't just have a
name and an object but always that indirection of the bin.
Ciao,
Marc 'BlackJack' Rintsch
. As you can see, it prints
'Afghanistan' but it can not returns it. In change, the another strings
are returned.
Maybe you should show the *input* too…
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 01 Jan 2009 04:28:21 -0800, koranthala wrote:
Please let me know if you need any more information.
Where does `videocapture.py` coming from? It's not part of the standard
library. And which operating system are we talking about?
Ciao,
Marc 'BlackJack' Rintsch
--
http
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
not. With
``set(dict.keys())`` there is a point in time where the dictionary, the
list, and the set co-exist in memory. With ``set(dict.iterkeys())`` only
the set and the dictionary exist in memory.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
doesn't see the whole picture and demands changes that look easy at
first sight, but are hard to implement right and efficient or just shifts
the problem somewhere else where the next joe-python trips over it.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python
they add a more flexible and powerful way!?
Python 3.0 is not a bug fix release.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
!? :-)
cm_gui is slow!
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of ``type(a)``.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 21 Dec 2008 15:30:34 +, Duncan Booth wrote:
Marc 'BlackJack' Rintsch bj_...@gmx.net wrote:
a+b+c+d might execute a.__add__(b,c,d) allowing more efficient string
concatenations or matrix operations, and a%b%c%d might execute as
a.__mod__(b,c,d).
But that needs special casing
to remember. If people can't understand that,
i fear for the future of Humans as a species!
Yeah, doomsday is near. Curly brackets and a number instead of a percent
sign followed by an 's' is a sure sign of the end…
You're a funny little troll, Sir.
Ciao,
Marc 'BlackJack' Rintsch
--
http
On Fri, 19 Dec 2008 16:50:39 -0700, Joe Strout wrote:
Marc 'BlackJack' Rintsch wrote:
And does REALbasic really use byte strings plus an encoding!?
You betcha! Works like a dream.
IMHO a strange design decision.
I get that you don't grok it, but I think that's because you haven't
()` and ``/``.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
literal, and thus generates the error.
The question is why the Python interpreter use the default encoding
instead of utf-8, which I explicitly declared in the source.
Because the declaration is only for decoding unicode literals in that
very source file.
Ciao,
Marc 'BlackJack' Rintsch
On Fri, 19 Dec 2008 04:26:16 -0800, bearophileHUGS wrote:
Peter Otten:
The problem is that list comprehensions do not introduce a new
namespace.
I think Python3 fixes this bug.
Or removes that feature. ;-)
--
http://mail.python.org/mailman/listinfo/python-list
n00b? Not important at all. Beside the point that '%s' is
still possible -- someone who knows C but struggles with replacing '%s'
by '{0}' has far greater problems.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 19 Dec 2008 08:20:07 -0700, Joe Strout wrote:
Marc 'BlackJack' Rintsch wrote:
The question is why the Python interpreter use the default encoding
instead of utf-8, which I explicitly declared in the source.
Because the declaration is only for decoding unicode literals
On Fri, 19 Dec 2008 15:20:08 -0700, Joe Strout wrote:
Marc 'BlackJack' Rintsch wrote:
And because strings in Python, unlike in (say) REALbasic, do not know
their encoding -- they're just a string of bytes. If they were a
string of bytes PLUS an encoding, then every string would know what
On Mon, 15 Dec 2008 13:12:08 -0800, silverburgh.me...@gmail.com wrote:
How can I return a non-zero status result from the script? Just do a
return 1? at the end?
``sys.exit(42)``
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
to methods. It's the
XML structure that is not reflected by the indentation, the program flow
is represented just fine here.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
()` at specific points even in optimized code if you
want or need.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 14 Dec 2008 09:19:45 +, Marc 'BlackJack' Rintsch wrote:
class Parrot:
def __init__(self, *args):
print Initialising instance...
assert self.verify()
Here I meant ``assert self._verify()`` of course.
def _verify(self):
print Verifying
that first line:
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
Why is it even more cumbersome to execute that line *once* instead
encoding at every ``print`` statement?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
types and sometimes with tuples, and there rebinding is
necessary. If I couldn't use it in this way: ``x = 0; x += z``, I'd
call that a bad design decision. It would be a quite useless operator
then.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
for bytes that are non-printable or not within the ASCII range
for strings.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
version of the
byte string file name, but keep the byte string for operations on the
file.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
to look at the text how many spaces will be
displayed. Better use four real spaces to indent one level so it looks
the same everywhere.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
7 STORE_FAST 0 (a)
10 LOAD_CONST 0 (None)
13 RETURN_VALUE
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
correct code before having one-liner contests with your
perl-loving friends :)
If you call something an error, make sure it really is one. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
on implementation details:
t = (1, 2)
t[0] = 1 # Maybe okay -- maybe not.
t[1] += 0 # Same here.
I'd find that quite odd.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
that Python3 has no future? :-)
It is just not built in. So it is easier to change the future by
replacing the module. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of release. So this year's releases have version 8 and the
latest is from october so it is 8.10.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
notifications.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
, the class method definition might
seem strange.
And after the change it continues to because they will run into *both*
variants in tutorials, code, and books, so it might be even more
confusing.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
object has documentation like this just to make the
compiler happy:
def spam(foo, bar):
:param foo: a foo object.
:param bar: a bar object.
Which basically tells the same as no documentation at all.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
algorithm.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 25 Nov 2008 10:48:01 +, John O'Hagan wrote:
On Tue, 25 Nov 2008, Marc 'BlackJack' Rintsch wrote:
On Tue, 25 Nov 2008 07:27:41 +, John O'Hagan wrote:
Is it better to do this:
class Class_a():
def __init__(self, args):
self.a = args.a
self.b
though a list was
index=value, where value=a single piece of data.
Your thought was correct, each value is a single piece of data: *one*
tuple.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
many people guessed
the right way.
Or how many worked through the tutorial, stumbled across the warning
about that behavior and got that question answered before they have even
known there's something to guess.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
like
``a = a + 1`` which must be obviously false unless 1 is defined as the
neutral element for the definition of ``+`` here. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 18 Nov 2008 00:18:51 +, Steven D'Aprano wrote:
On Mon, 17 Nov 2008 12:32:35 +, Marc 'BlackJack' Rintsch wrote:
Not such illogical crap like
``a = a + 1`` which must be obviously false unless 1 is defined as the
neutral element for the definition of ``+`` here.
I don't
()`
and an explicit encoding. I'd use 'utf-8' as default but give the user
of the program a possibility to make another choice.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
the process at the other end expects, for example if
output is redirected to a file.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
, is this possible to affect the two iterators?
Or the only means is to use exception?
You could put the code into its own, maybe local, function and use
``return``.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
in the
`string` module that are also implemented as method on `str` or `unicode`
are deprecated.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
something like this:
b = a([1 5 8]);
I can't seem to figure out a similar Python construct for selecting
specific indices. Any suggestions?
b = [a[i] for i in [1, 5, 8]]
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 10 Nov 2008 05:36:58 -0800, [EMAIL PROTECTED] wrote:
On Nov 10, 1:16 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
On Mon, 10 Nov 2008 03:11:06 -0800, [EMAIL PROTECTED] wrote:
1. How can I pass a file-like object into the C part? The PyArg_*
functions can convert objects
it in and out? Simply use the C module level to store the
information.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
considering the `ctypes` module to call your C stuff.
This way it is easier to build the extension and it is also independent
from the Python version.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 1496 matches
Mail list logo