client for down-load -- 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
"untrigger_threshold"] )
>
> 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/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
ld return the widget, that
should get the focus, so maybe the author really wanted to return the
`Entry` instance here, instead of `None`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
a == b
> True
> >>> a is b
> False
What should 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
\n" in it, which atm I am getting rid 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
On Wed, 04 Mar 2009 09:04:50 -0800, chuck wrote:
> On Mar 3, 10:40 pm, Marc 'BlackJack' Rintsch 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
>&g
corrects this?
Learn how to copy code 1:1 from a web page or understand Python's import
and namespaces.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
d 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://mail.python.org/mailman/listinfo/python-list
y of
the code using that widget to decide how and where it should be placed.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
_file.writelines(islice(lines, 7, 12))
if __name__ == "__main__":
main()
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.2g/2048
>
> Could anyone please explain why this happens? It seems some memory are
> not freed.
It seems the memory 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 a
ms*.
A revision or version control system (VCS) lets you record the evolution
of your 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
m? If not then
`ctypes` might be the wrong tool.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
perative way (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
inteheritance
> situations. 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
rting 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' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
a class
> definition and see the declaration of a veryInterestingMember and forget
> that you're not supposed to access it. If you try to access it, the
> compiler will give you a diagnostic message at compile time.
I can't forget that because if I'm not supposed to acce
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__ ( s
t; return line
def __repr__(self):
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 16:10:11 +0100, Andreas Waldenburger wrote:
> On 26 Jan 2009 14:51:33 GMT Marc 'BlackJack' Rintsch
> wrote:
>
>> On Mon, 26 Jan 2009 12:22:18 +, Sion Arrowsmith wrote:
>>
>> > content = a.readlines()
>> >
>> >
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
gt;open("Chuck.S01E01.HDTV.XViD-YesTV.avi", "rb").read(1024)
> b'\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
ee IBQ too ... also weird is that he has Content-Type: text/plain;
> 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 newsrea
rom within the editor.
>
> I don't know 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
" by default and of course define
your own set of "value doesn't matter" names.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
__`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
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://mail.python.org/mailman/listinfo/python-list
gt; Why not? Just saying it isn't doesn't make it not.
Because "developer" means people who don't mess with implementation
details. 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
es" seems to be asking 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
vent adding attributes
dynamically. And it has some drawbacks when you inherit from such
classes.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
w I could solve
> this problem, as with a google search i didn't find the solution.
Look into the `email` package in the standard library.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
hat are all those line continuation characters ('\') for? You are aware
that they are unnecessary here?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
7;before'
>
> Here I can write all symbols, but not read. I've tested it with python
> 2.6, 2.5 and 2.2 and WinXP SP2.
>
> Why is it so and is it possible to fix it?
\x1a is treated 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
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 bl
d directly to machine 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 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
dx%d' % (width, height)
print 'Bytes per Pixel: %d' % blocksize
with open(filename, 'rb') as data_file:
blocks = iter(partial(data_file.read, blocksize), '')
pixel_values = imap(ord, iter_max_values(blocks, pixels))
write_pgm(
ictionary 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
On Fri, 09 Jan 2009 19:33:53 +1000, James Mills wrote:
> On Fri, Jan 9, 2009 at 7:15 PM, Marc 'BlackJack' Rintsch
> wrote:
>> Why parentheses around ``print``\s "argument"? In Python <3 ``print``
>> is a statement and not a function.
>
> N
pixels += 1
> if (havepixels % 1024) == 0:
> print("Progresss %s: %.1f%%" % (sys.argv[1], 100.0 *
havepixels /
> pixels))
>
> picture[(posx, posy)] = most
Why are you using a dictionary as "2d array"? In the C code 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
t;.
>
> Unfortunately I saw no warnings about print becoming a function 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.
C
o those who
>> want to support Israeli companies.
>
> Something like that web-service that publishes the names and addresses
> of doctors who perform abortions so that they can be assassinated?
Hey, it's about boycott, not killing them. Applied to the doctors
example:
which I have had happen. So if python does 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. +
raises a `KeyboardInterrupt`.
Ciao,
Marc
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
ngs can happen. Additional
windows have to be created as `Toplevel` instances.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
let`` is optional in Commodore BASIC.
But where is the difference to
x = 10
print x
? Wouldn't you have guessed what this Python program will do just the
same?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 04 Jan 2009 20:03:11 -0600, Derek Martin wrote:
> On Sat, Jan 03, 2009 at 10:15:51AM +0000, 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
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,
004
>> > Out[19]: u'004'
>>
>> What?
>
> That's the output got from ipython. 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
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
--
http://mail.python.org/mailman/listinfo/python-list
cff5937?hl=en&q=recycle+bin#97254d877903bbd
No you didn't "got" Steven, as unnecessary cross posting 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
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
lest possible program that still has the problem.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
btle point here :)
`keys()` creates a list in memory, `iterkeys()` does 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
On Sun, 21 Dec 2008 15:30:34 +, Duncan Booth wrote:
> Marc 'BlackJack' Rintsch 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
mpile time and ``a % b``
returns an object of ``type(a)``.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ou are not fast enough to elaborate on Python's slowness!? :-)
cm_gui is slow!
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
lems.
And even if nobody has problems with the limitations of ``%`` string
formatting why shouldn't 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
the language
whereas my ideas for "fixes" of the quirks wouldn't. "joe-python" most
often 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
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
all you need 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.
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
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.
>>
>&
ogramming for this
> student. Lets not forget how important C is!
To a Python "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 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
ode literals in that
very source file.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
max/min, is there something like average()?
No, but it's easy to implement with `sum()`, `len()` and ``/``.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ent.
No the program flow there is just some linear calls 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
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
t is the official, recommended Python way?
I'd make 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
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 _verif
t do others think?
> Which do you consider better design?
None of it. Why not simply:
class Parrot:
def __init__(self, *args):
print "Initialising instance..."
assert self.verify()
def _verify(self):
print "Verifying..."
return None
If you compile with -O the ``assert`` is optimized away. But you still
can call `_verify()` at specific points even in optimized code if you
want or need.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
but let the interpreter show the result
you get the `repr()` form of that character displayed, which always uses
escapes 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
cts? I use it very often
with number 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' Rintsc
e that may or may not raise that
exception, depending 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
uch an error in a post, I suggest to practice some time
> writing 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
def f(a, x):
.: a += x
.:
In [253]: dis.dis(f)
2 0 LOAD_FAST0 (a)
3 LOAD_FAST 1 (x)
6 INPLACE_ADD
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
you use 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
#x27;m usually using UTF-8 as default but offer the user ways, e.g. command
line switches, to change that.
If I have to display file names in a GUI I use a decoded 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
module named future_builtins
>
> Hmmm... does this mean 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
are year and
month 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
beep in X-Windows so every desktop environment implements
something like audio notifications.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
t; I agree that for newcomers to Python, 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
undocumented parts of the code anymore, because
now every "docable" 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
your `unicode` object
so you get bytes to feed to the MD5 algorithm.
Ciao,
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():
>>
lf if
those methods are really methods, because they don't use `self` so they
could be as well be functions or at least `staticmethod`\s.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
p, learned something new today. Naively, I 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
; guessed the wrong way. We have no way of knowing how 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 &#x
On Tue, 18 Nov 2008 00:18:51 +, Steven D'Aprano wrote:
> On Mon, 17 Nov 2008 12:32:35 +0000, 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 f
think it's called variable and works like variables work in
mathematics, i.e. you can assign only once. 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. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
you can't decode properly
with one encoding anymore.
A clean solution would be just one ``print`` with a call of `encode()`
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 data again
because sooner or later you will come across a `stdout` where Python
can't determine what 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
uot;break 2" in shell bash # In C, I would set j=i-1
>and i=4
># In Python, 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
bytes to a bunch of (unicode)characters before you concatenate the
strings.
BTW: ``line.strip()`` removes all whitespace at both ends *including
newlines*, so there are no '\n' to replace anymore. And functions 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
h element I might do 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 16:32:47 +, Robin Becker wrote:
> on the other hand I find it odd that
>
> cmp(None,None) fails in Python 3 when None==None returns True.
That's because there is no order defined for `NoneType` but equality is.
Ciao,
Marc 'BlackJa
less straightforward C manner.
Then you might 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
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
1 - 100 of 1508 matches
Mail list logo