wxpython book

J

johna

I have seen some brief mention of the new book by Robin Dunn in one or
two posts. But none that highlight that the book is to be published
sometime at then end of Jan 2006.

I hope that turns out to be an accurate date.

It has been long-awaited so I thought it ought to get a proper mention.

I must admit that I've been waiting a long time for some solid
documentation that is up to date with the current release of wxwidgets.

I hope this list will be the right one to post to since there are
always posts about what gui tool to use.

The link is

http://www.manning.com

The front page of the site has a brief outline of the book. What would
be good is if it had a list of contents so we could be clearer as to
what subjects were covered and in what depth.

I can't thank Robin and his colleague enough for the effort to produce
the book. So I hope it proves very popular.

John Aherne
 
I

invitro81

Which one is better w.r.t. memory allocation but also w.r.t. speed:

## 1.1 ##

def forloop(a,b):

for idx in range(a,b):
## ..
## do something
## ..

## 1.2 ##

def whileloop(a,b):

idx = a
while idx < b:
## ..
## do something
## ..
idx += 1

#########

I mean what I really would like is to have something C++ - like "for
(int idx = a; idx < b; i++) { .. }" where no internal vector or
something like that is allocated but only a few op's on registers are
performed; in the whileloop in python the picture is roughly the same
behind the scenes I guess.. but what about in the forloop? Is python
smart enough not to generate an internal vector as it does usually for
lists or do I have to apply some modifications (xrange..)? What happens
further if I do the following:

## 2.1 ##

def forloop(a,b,lst):

for idx in lst.sort():
## ..
## do something
## ..

#######

Is the sorting function called in every iteration just to detect that
(after the first sorting) it is useless comming back to the loop or does
this happen:

## 2.2 ##

def forloop(a,b,lst):

lst.sort()
for idx in lst:
## ..
## do something
## ..

#######
 
D

Diez B. Roggisch

I mean what I really would like is to have something C++ - like "for
(int idx = a; idx < b; i++) { .. }" where no internal vector or
something like that is allocated but only a few op's on registers are
performed; in the whileloop in python the picture is roughly the same

Use xrange instead - as it is customary for at least python2.1, if not even earlier.

behind the scenes I guess.. but what about in the forloop? Is python
smart enough not to generate an internal vector as it does usually for
lists or do I have to apply some modifications (xrange..)? What happens
further if I do the following:

## 2.1 ##

def forloop(a,b,lst):

for idx in lst.sort():
## ..
## do something
## ..

#######

Is the sorting function called in every iteration just to detect that
(after the first sorting) it is useless comming back to the loop or does
this happen:

## 2.2 ##

def forloop(a,b,lst):

lst.sort()
for idx in lst:
## ..
## do something
## ..

#######

The iterable-expression of a for _ in _: is always only evaluated once.

Diez
 
S

Scott David Daniels

invitro81 said:
Which one is better w.r.t. memory allocation but also w.r.t. speed:
## 1.1 ##
def forloop(a,b):
for idx in range(a,b):
...
Above preferred to next (for readability) using xrange may help speed
depending.
## 1.2 ##
def whileloop(a,b):
idx = a
while idx < b:
...
idx += 1
def forloop(a,b,lst):
for idx in lst.sort():
...
This one just doesn't work. the sort method on a list causes a
side-effect of sorting the list, and then returns None to remind you.

def forloop(a,b,lst):
lst = list(lst) # if you don't want to mangle the original)
lst.sort()
for idx in lst:
...

With the new-fangled (2.4 or greater) Python, you could use sorted:
def forloop(a,b,lst):
for idx in sorted(lst):
...

Your other questions were correctly answered elsewhere


--Scott David Daniels
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,285
Messages
2,571,416
Members
48,107
Latest member
AmeliaAmad

Latest Threads

Top