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
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
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
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
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
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
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
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 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 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
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
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
g- ASCII to decode the
> utf8 encoded string 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 unic
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
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 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.
>>
>&
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 17:12:00 -0800, r wrote:
> Marc,
> Why move away from a concise and widely accepted way of sting
> formatting, just to supposedly make it a little easier for n00bs? (which
> i disagree this is easier) In turn, creating more syntactical clutter.
> (%s %f %d) is
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
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
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
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
mpile time and ``a % b``
returns an object 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 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
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
lest possible program that still has the problem.
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
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
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
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
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,
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
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
6raiz = Tk()
The problem is here…
> 27F = Frame(raiz)
> 28F.pack()
> 29hello = Label(F, text=resultado) 30hello.pack()
> 31F.mainloop()
…and here.
There is only one `Tk` instance and mainloop allowed per `Tkinter`
application. Otherwise really strange thi
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
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
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:
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
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
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
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
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(
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
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 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
re
crying for help.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
c files.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ht = size_tuple[1]
>
> square_length = 75
>
> x1 = (width / 2) - (square_length / 2) x2 = x1 + square_length
> y1 = (height / 2) - (square_length / 2) y2 = y1 + square_length
>
> image.crop((x1,y1,x2,y2))
This doesn't change `image` but creates and returns a new
On Wed, 08 Oct 2008 10:59:44 -0500, skip wrote:
> Marc> On Wed, 08 Oct 2008 09:18:47 -0600, Joe Strout wrote:
> >> We have a client who's paranoid about distributing the Python
> >> source to his commercial app. Is there some way I can distribute
> &g
gt;
> The little carrot points to the equal sign ('=') in 'file=stderr'
>
> What's the syntax problem?
That's Python 3.0 syntax where ``print`` is not a keyword anymore but a
function. Won't work with Python 2.5.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
in():
lines = ['foo1bar2',
'foo10bar10',
'foo2bar3',
'foo10bar2',
'fo',
'bar1000',
'777']
lines.sort(key=key_func)
print '\n'.join(lines)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
objects.
> However I am sure you will agree that explicit encoding conversions are
> cumbersome and error-prone.
But implicit conversions are impossible because the interpreter doesn't
know which encoding to use and refuses to guess. Implicit and guessed
conversions are error prone too.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
only *once* to ``counter['B']`` in every case.
`dict.setdefault()` is for situations where you really want to actually
put the initial value into the dictionary, like with the list example by
the OP.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ey accidentally share objects.
And this refactoring takes an indentation level from the old inline code,
making it easier to keep the lines in the 80 characters limit.
> Who can give me some hints to improve my code or arguments to switch of
> that warnings?
Try to write the code with less names and statements. Write functions
that do just "one thing" and split big functions into smaller ones.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 17 Oct 2008 11:42:05 -0400, Luis Zarrabeitia wrote:
> I need to parse a file, text file. The format is something like that:
>
> TYPE1 metadata
> data line 1
> data line 2
> ...
> data line N
> TYPE2 metadata
> data line 1
> ...
> TYPE3 metadata
> ...
> […]
> because when the parser iterat
t do you mean by "does not work"? And you are aware that the above
snipped doesn't involve any unicode characters!? You have a byte string
there -- type `str` not `unicode`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 17 Oct 2008 11:32:36 -0600, Joe Strout wrote:
> On Oct 17, 2008, at 11:24 AM, Marc 'BlackJack' Rintsch wrote:
>
>>> kw = 'генских'
>>>
>> What do you mean by "does not work"? And you are aware that the above
>> snipped d
start
> performing a little more optimizations, like turning that tiny lambda
> into inlined code.
How? The functions in `operator` are meant to be passed directly or to
to create other functions that are passed as HOFs into other functions.
So the compiler doesn't know in which funct
irectory? The `__init__.py` of which vendor
should live at the `com/` directory level? If you install them into two
different directories but want to import modules from both vendors -- how?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 20 Oct 2008 13:54:56 +0800, oyster wrote:
> but the pyparsing.py in pyparsing-1.5.1.tar.gz is marked as 2008-10-02 I
> think it is good too touch all the files' time up-to-date.
Why? This throws away information, such as "when was package/module xy
changed"
e call to `__del__()` is not guaranteed.
> can I somehow save my data from destructor?
Reliably? No! Change your design, it won't work this way.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
gt; column 1, pressing tab will move the equivalent of 8 spaces, which takes
> you column 9, not 8.
Ever noticed that computer freaks often start counting at 0? ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
gt;
>> if counter.has_key('B'):
>> counter['B'] += 1
>> else:
>> counter['B'] = 1
>
> Both those are slow. Better to use:
>
> if 'B' in counter:
> counter['B'] += 1
> else:
> counter['B'] = 1
>
> Or with a defaultdict:
>
> counter = defauldict(int)
> counter['B'] += 1
Or:
counter['B'] = counter.get('B', 0) + 1
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
000
> 000
> 000
> L
>>>>
This can be written more straigth forward as ``100**155`` or
``pow(100, 155)``. No need for `eval()`\ing a stri
* 73 * 20 * 8 bytes
You want: GiB
* 2.1146536
/ 0.47289069
Do you have a 32 bit system? Then 2 GiB is too much for a process.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
2com` module? It is not part of the standard library.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
s? Any chance
they are just 4 byte floats in your Fortran code i.e. C floats instead of
C doubles like the default in `numpy`?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 23 Oct 2008 13:56:22 -0700, John [H2O] wrote:
> I'm using zeros with type np.float, is there a way to define the data
> type to be 4 byte floats?
Yes:
In [13]: numpy.zeros(5, numpy.float32)
Out[13]: array([ 0., 0., 0., 0., 0.], dtype=float32)
Ciao,
Marc 'Bl
t;URL" lacks the protocol! Correct would be http://amazon.fr… (I
guess).
> [...]
>
> IOError: [Errno 2] The system cannot find the path specified:
> 'amazon.fr\\search\\index.php?url=search'
Without protocol it seems that the 'file://' protocol is used a
" + scan(ip,port,timeout)
…one of which is `None` and that will blow up here, regardless of
platform.
In [18]: " : " + None
---
Traceback (most recent call
last)
/home/bj/ in ()
: cannot con
hat functions
or methods and use the doctest module to check if my examples agree with
the actual implementation.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
The ``try``/``except`` structure can have an ``else`` branch. Maybe that
can be of use here.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
are not 100% interchangeably. Dictionaries as implemented need keys
to be hashable objects and sorted dictionaries need the keys to have an
order defined. So switching mapping types may fail unless the key
objects already have the needed magic methods implemented to do the right
thing.
Ciao,
Mar
ople with programming experience in other languages
`Dive into Python` is a recommended free Python text.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
=
> so my question is
> 1)why >>> abebe prints '\xe1\x8a\xa0\xe1\x89\xa0\xe1\x89\xa0
> \xe1\x89\xa0\xe1\x88\xb6 \xe1\x89\xa0\xe1\x88\x8b' instead of አበበ በሶ በላ
> 2) why >>> print abeba don't print the expected አበበ በሶ በላ string thanks
> a lot.
Because lists represent their content in the `repr()` form. So you, the
programmer, can see what's really in there.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
templates = [k.replace('{{ state }}',
> state.state).replace('{{ state_abbr }}', state.abbreviation) for k in
> templates]
It seems you are iterating over *all* accumulated templates so far, over
and over again, even those which don't have those place h
of those line raised the exception? Full traceback please.
I guess it is one of the ``print``\s because `BeatifulSoup` returns
`unicode` objects which may lead to that exception when printed and the
output encoding can not be determined.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
s encoded in three bytes. If you really want to
operate on characters instead of bytes, use `unicode` objects:
In [129]: u = abebe.decode('utf-8')
In [130]: len(u)
Out[130]: 9
In [131]: print u[0]
አ
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
nd surprising side effects.
So I ask for the use case too. What problem are you trying to solve?
There might be a better way than executing strings as code and trying to
inject names into the callers namespace.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
e without shadowing the built in `iter()` and without calling the
"magic method" directly:
iterator = iter([1, 2, 3, 4, 5])
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ts at the string '\t\n\x0b\x0c\r ' which doesn't occur in
`mytext`. The argument is a string not a set of characters.
> print string.split(mytext, sep=whitespace)
Same here.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.attribute
> return
> print "\n"
> return
>
> i want i.attribute to be treated as i._ward
Look at the `getattr()` function.
> I get a compile error "instance has no attribute 'attribute' " which i
> underst
ay, or any
(nested) sequence.
And `numpy.int32` instances have an `__array__()` method:
In [225]: ten = numpy.int32(10)
In [226]: ten.__array__()
Out[226]: array(10)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
here the generator code is allowed to run when `next()` is
called and stops itself when it ``yield``\s an object. Sort of
cooperative multitasking. The name "yield" is often used in concurrent
code like Java's or Io's `yield()` methods.
Ciao,
Marc 'BlackJack&
oest" was a typo!?) has no option
`'-f '"%s %s" name addr' `. And you should decide if you want to split
the arguments yourself or if you want to use the shell. Mixing both
doesn't make much sense.
If *you* split the arguments, the call should look like this:
p = subprocess.Popen(['goset', '-f', ' "%s %s" name addr ', 'file_name'])
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 03 Nov 2008 23:32:25 +, Paulo J. Matos wrote:
> What's then the reason for adding named tuples if they are not
> mutable...???
Names are more descriptive than "magic numbers" as indices. See for
example the "named tuple" returned by `os.stat()`.
27;t discussed this in
much detail in this group lately, but it applies to Python which does
call-by-object or call-by-sharing. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ject or call-by-sharing. Call-by-name "injects"
the expression used to call into the called function and evaluates it
every time the argument is accessed within the function.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
p = subprocess.Popen(["goest", "-f", "' \"%s %s\" name addr '",
> "file_name"], shell=True)
The argument after '-f' doesn't have the single quotes at both ends.
They tell the shell that it is just one argument and the shell removes
them before calling ``goset`` (or ``goest``).
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
an to explain the underlying machinery two
levels below (because the CPython-VM doesn't know pointers either).
Maybe not for people who know that low levels from older languages and
insist on explaining everything in the terms of those. Maybe that's the
reason for the Java folks to call their strategy call-by-value, because
they were afraid to confuse C++ programmers with "new" concepts.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 04 Nov 2008 16:52:17 -0800, 一首诗 wrote:
> Now I'm using the upack function of 'struct' module, but it's really
> annoying to write fmt strings for complicated structures.
>
> What will be your choice when handling binary structures?
http://construct.wik
in xrange(10)
^
: invalid syntax
In [271]: a = (x for x in xrange(10))
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 05 Nov 2008 13:18:27 +1100, Ben Finney wrote:
> Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
>
> Your example shows only that they're important for grouping the
> expression from surrounding syntax. As I said.
>
> They are *not* important f
On Wed, 05 Nov 2008 14:39:36 +1100, Ben Finney wrote:
> Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
>
>> On Wed, 05 Nov 2008 13:18:27 +1100, Ben Finney wrote:
>>
>> > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
&g
`bool`\s to `int`\s then.
Sometimes I write it as
sum(int(el == val) for el in iterable)
just for clarity what the intent is.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
ork. It just pretends until
you really *need* the backed up data. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
# ...
return cls(a, b, c)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
tiply(image,
Image.new('RGB', image.size, tint_color))
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
e immutable so the CPython
implementation caches small integers as an optimization.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
t.socket` because then you
would use the `recv()` method of that object.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
1401 - 1500 of 1811 matches
Mail list logo