On Wednesday, June 27, 2012 2:00:03 PM UTC-7, David Thomas wrote:
> Hi I know that this is a group about Python. But I am just wondering if
> anybody can recommend any introductory/good books on Conputer Science.
>
> Kind regards
I recommend "Python Programming: An Introduction to Computer Scie
I downloaded and installed the auto version of the software.
I go to the director C:\google-python-exercises> *python hello.py*
I am running Windows.
What am I doing incorrectly?
I had the zip file installed under my One Drive and then moved it to my C
drive
Patiently waiting,
G
I am trying to get Hello World to appear under my directory. The files of
*C:\Users\gd752>cd C:\google-python-exercises> python hello.py*
*The system cannot find the path specified.*
*C:\Users\gd752>cd C:\google-python-exercises>*
*The syntax of the command is incorrect.*
I installed version 3.1
Forgive me, and be kind, as I am just a newby learning this language
out of M.L. Hetland's book. The following behavior of 2.4.1 seems very
strange
>>> x = ['aardvark', 'abalone', 'acme', 'add',
'aerate']
>>> x.sort(key=len)
>>> x
['add', 'acme', 'aerate', 'abalone', 'aardvark']
>>> x.sort(re
number, next 16 bits represent the imaginary.
I've looked at the "unpack" command, but from what I can tell it isn't
really efficient for a large data sample.
Is there a command or method around to read in large amounts of 16 bit
complex data?
Thanks in advance for your help,
That worked, thanks a lot.
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Hi, I am having some encoding problems when I first parse stuff from a
non-english website using BeautifulSoup and then write the results to
a txt file.
I have the text both as a normal (text) and as a unicode string
(utext):
print repr(text)
'Branie zak\xc2\xb3adnik\xc3\xb3w'
print repr(utext)
u
teven D'Aprano wrote:
> On Wed, 05 Oct 2011 16:35:59 -0700, Greg wrote:
> > Hi, I am having some encoding problems when I first parse stuff from a
> > non-english website using BeautifulSoup and then write the results to a
> > txt file.
>
> If you haven't alrea
Carl Banks wrote:
> Greg Ewing wrote:
> > The characters come out slightly
> > higglety-pigglety -- randomly displaced up or down
> > a pixel or so from the baseline.
> It would depend on how you're displaying them, I would think.
I've seen the same thing happ
e
anywhere near to succeeding.
http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
ed to the directory containing the test
program.
The moral is not to put your test program in the
same directory as your package files. (Or if you
must, have it delete sys.path[0] before importing
anything.)
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
be one selection visible at a time, so
that it's always clear what you're operating on.
(They seem to be breaking that now in MacOSX, which
I think is a backward step...)
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
#x27;ll be interesting to see whether
you *still* want to switch back to Ruby after getting
to know Python for two years!
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Carl Banks wrote:
> Think of it this way: an array with n-dimensions of length 3 would have
> 3**n total entries. How many entries would a 0-dimensional array have?
> 3**0 == 1.
Er, hang on a minute. Along which dimension of this
0-dimensional array does it have a length of 3? :-)
cfile);
Py_XDECREF(py_funcname);
Py_XDECREF(empty_tuple);
Py_XDECREF(empty_string);
Py_XDECREF(py_code);
Py_XDECREF(py_frame);
}
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
PyGUI 1.7.2 is now available:
http://www.cosc.canterbury.ac.nz/~greg/python_gui/
This version adds support for multiple mouse buttons,
mouse enter and leave events, enhancements to the BlobEdit
example application, and a big pile of other enhancements
and bug fixes. See the CHANGES.txt file
I have uploaded a new PyGUI 1.7.2 package to correct
a couple of errors in the setup.py file.
http://www.cosc.canterbury.ac.nz/~greg/python_gui/
-
What is PyGUI?
--
PyGUI is an experimental highly-Pythonic cross-platform
GUI API
at. It appears that you've encountered another
one.
I'm using a different method of dealing with
this now, which will probably fix your problem as
well. I've attached a replacement for
GUI/Cocoa/Applications.py. Let me know if it
works for you.
--
Greg
#
# Pyth
ALBOW - A Little Bit of Widgetry for PyGame
---
Version 1.0
This is a very basic, no-frills widget set for creating a GUI using
PyGame. It was originally developed for my PyWeek 3 competition entry,
Sneak. I am documenting and releasing it as a separate pac
Bill Atkins wrote:
> And mistakes in nesting show up as mistakes in
> indenting.
Er, hang on a moment... how do you *know* when you've
got a mistake in indending? You must be visually
verifying the indentation... rather like one does
with Python code...
--
Greg
--
http://mail.python.
reason being that the assignment is modifying
the dictionary holding the namespace of the main
module, which is referred to by the main module
itself. So you are "changing an object that is
being referred to by a living object".
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
acro expansion. You'd also need
some very heavy-duty type inferencing.
Python is extremely dynamic, even more so than Lisp.
That's why compiling Python is hard, not because it
doesn't have macros.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
On the plus side, Python makes less demands on the
capabilities of the editor. All you really need
is block-shifting commands. Bracket matching is
handy for expressions but not vital, and you
certainly don't need bracket-based auto-indenting.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
such as adding two
vectors, produces a new vector holding the result.
In that case, two vectors could happily share a
reference to a list of values (as long as there is
nothing else that might modify the contents of the
list).
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
lines of Python, I
would estimate.
Seeing as you asked, how much Python code have
you or Ken edited?
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
ouldn't be Python any
more, it'd be Lisp. And then all those great
libraries wouldn't work with it, because they're
for Python, not Lisp. :-(
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Bill Atkins wrote:
> greg <[EMAIL PROTECTED]> writes:
>
> > There's no way you could compile Python to efficient
> > machine code just by macro expansion. You'd also need
> > some very heavy-duty type inferencing.
>
> A compiler shifts a lot of deci
[EMAIL PROTECTED] wrote:
> Does the word "TRONDANT" hold some special meaning for you?
Er, no, in fact my brain raises a KeyError on it.
Is it supposed to mean anything?
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
atically
determine what the + operator needs to do here.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
think "kludgy" is a bit unfair, since this is a
result of doing things in a very simple and uniform
way -- rather a Lispy concept, I would have thought. :-)
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
ed
as "pathologically dynamic". All that dynamism
is handy sometimes, but it does get in the
way of improving efficiency.
Often discussions take place on python-dev
about ways to selectively limit the dynamism
to make some optimisation possible.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
p would probably have required
using macros.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
icitly
if you need. This gives you exactly the same
capabilities as symbols in Lisp.
For example, due to the automatic interning, the
string comparison in the following is just a pointer
comparison:
fred = 'hello'
if fred == 'hello':
print 'Greetings
George Sakkis wrote:
> I'm sure there should be more convincing examples for macros, but
> neither this nor the 'unless' syntax sugar cuts it.
Also, the new 'with' statement and associated
protocol covers much of the ground that was left
out by the existin
at Python *doesn't* have this. :-)
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Skill()
skill.title = title
skill.annotations = annotations
skill.hints = hints
skills[name] = skill
This gives you a dictionary of Skill instances indexed by name,
each one having a title and lists of annotation and hint strings.
The rest of the system can process this however required.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
at wrote:
> It is not the addional line containing 'if x > 0:' that bothers me, but the
> additional indentation.
I don't find the additional indentation bothersome.
In fact I think it's helpful, because it makes it
obvious that there is something else going on
u can only do that for one
base class at a time.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
a line or two, this is not usually much of
a problem, and is arguably more readable anyway.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
at wrote:
> I think by approving
>
> a = b if condition else c
Again, this allows something to be written as an
expression that formerly could only be written as
a statement, which is a much bigger gain than just
crunching two statements into one.
--
Greg
--
http://mail.python.or
ry slightly to
give another statement, and opinions differ on whether
it would improve or hurt readability.
Furthermore, Guido has considered this exact idea
before, promoted using the same arguments, and rejected
it, so it's unlikely he would change his mind this
time around.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
ng that they have
comparable performance.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
e various ways of specifying additional places
to look for imported modules, but that should be enough
to get you going.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
by some chance you've got "Hide filename
extensions" turned on in your View options, TURN
IT OFF. It'll cause no end of confusion when you're
trying to program.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
time with the odd feature that capacitance came
out in units of length.
Picture the scene: Hobbyist walks into Dick Smith
store and says "I'd like a 5cm capacitor, please."
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
skill.reverse(resx, opnds)
There's no need to macro-expand this code into every
reversal function, when it can be done once as part of
the framework that calls the reversal functions.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
e and ordinary functions
and methods operating on that data structure.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
oes a manual correction process come out as simple as "don't
> bother fixing the indentation if you don't care."?
I think the point is that correcting indentation in Python
is the equivalent of fixing misplaced parentheses in Lisp,
and that they're about equally difficult.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
n some people assume it will be without ever
having tried it.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
that the Lisp way is superior to the Python way in
all respects, based on my experience with both.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Python demonstrating
the gist of what could be done.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
ing. Although I think I'd rather target Scheme
than CL if I were doing it -- cleaner language, small
yet still extremely good implementations available.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
hon as it is in Lisp, but that doesn't mean it
can't be done.
(I agree that the proffered example was not an instance
of "code is data", though.)
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
.signed_value, or whatever else is required.
If this still doesn't cover the requirements, please
explain and I'll try to adapt it accordingly.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
in what looks like a
procedural style, even though it's still purely
functional. Read about "monads" if you want to
know more -- it's truly mind-expanding (and
possibly head-exploding:-) stuff...
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
ction.
This is even more evident in Smalltalk, where
*all* control structures, without exception, are
expressed in terms of code blocks, possibly
with parameters. And Smalltalk has no macros,
either, btw.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
fine your own infix operators. And
it doesn't even require a macro. :-)
(Finding the trick to implementing this is left as an
exercise for the googler.)
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
this disease from C).
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
ype "help", "copyright", "credits" or "license" for more information.
>>> cmp("hello", "world")
-1
>>> cmp([1,3], [1,2])
1
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
ght be able to handle this using a general method
that searches the tree for a specified tag, e.g.
env.find_tag("signed_value")
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
y it, for example,
C. A Python tuple is like a C struct, and a Python list
is like a C array.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
ys in which C structs are
different from Python tuples, and C arrays are different
from Python lists. But they're not the aspects I'm
drawing an analogy between.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
the way they're used.
This is the kind of thing for which Python tuples
are mainly designed -- use as a struct whose
members happen to be named by integers rather
than strings.
If you still don't understand, then I'm afraid
I've run out of ideas on how to explain it.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
x27;, 'refresh', 'delete'))
],
title = 'Barebones RSS Reader v1.0')
self.channels = [
parse_rss_from_url(url) for url in [
'http://planet.lisp.org/rss20.xml',
'http://feeds.theonion.com/theonion/daily']]
def add_feed(self):
...
def delete_feed(self):
...
# etc.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
ot that they're shutting down existing ones.
Unless *my* reading comprehension skills have completely
abandoned me.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
of these accounts letting them know what you've done and how
to get it re-enabled. Just shutting it down without any word
could be seen as a bit rude.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Richard Jones wrote:
> Actually, to clarify the DEFAULT configuration for Trac is to leave it open
> to spam.
That sounds like a really bad choice of default.
A bit like the way Windows comes with all the
"let anyone in the world send me a virus"
options turned on...
se them that way, but if
you use them differently, you're on your own
and can't complain if they don't have all the
features you want.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
d size *and* immutable -- and the list, for
everything else.
So it's not really that lists are intended *only* for
homogeneous collections, but for anything that can't be
represented as a tuple for whichever reason.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
ist affects is what order
the strings and agents are processed in.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
PyGUI 1.6 is now available:
http://www.cosc.canterbury.ac.nz/~greg/python_gui/
The major change in this version is that the Mac version
is based on Cocoa instead of Carbon. This should provide a
much better base for future development, but it does mean
that MacOSX will now be required. (This
ption of the project
goals, see the PyGUI web page at the above address.
The current version is available from:
http://www.cosc.canterbury.ac.nz/~greg/python_gui/
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
> You can't shell an egg that isn't there.
Yesterday upon the stair
I shelled an egg that wasn't there.
I'd shell the thing again today
If only I could find a way.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
but that looks too much like
'e-number' rather than 'enum-ber'.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
t relies
on them being integers or having those integer
values.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
write the name twice,
making the construct far less elegant.
Maybe *this* is a good argument for making the enum
object a class?
Or maybe it's an argument for allowing decorators
to operate on things other than functions, so you
could write something like
@enum
Weekdays = ('mon', 'tue', etc...)
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
m these should wrap around.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
of arbitrary ordering would be to provide
an ordering for all objects, whatever they might be.
Greg
--
http://mail.python.org/mailman/listinfo/python-list
add to it over time
to cover any bugs that turn up.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
Roy Smith wrote:
> greg <[EMAIL PROTECTED]> wrote:
> > Then you get a bug report, you fix it, and you add a test
> > for it so that particular bug can't happen again.
> The TDD zealots would tell you you've got the order wrong. Instead of
> "fix,
ontained -- Aqua buttons just don't
scale down like that. :-(
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
James Harris wrote:
> With that the time would range to +/- 9000
> quintillion years (18 digits)
Use the Big Bang as the epoch, and you won't have
to worry about negative timestamps.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
y of today's desktop unix systems.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
self' and
a reference to the underlying function. This is known
as a "bound method".
(You also get an instancemethod if you look the method
up in the class, i.e.
A.method
but in that case the instancemethod doesn't contain
a value for 'self', and is known as an
point was that using native widgets is not in itself
enough to ensure a native experience. There are conventions
about *how* the widgets are used, and other things about
the behaviour that don't relate to widgets at all.
Native widgets are certainly a better thing to start
from, though
decide if
and when the Big Crunch is going to happen, we may be
able to figure out once and for all how many bits we
need in the timestamp.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
e requirement.
It seems like this would have been an even more important
issue in the timesharing environments where unix originated.
You wouldn't want everyone's text editors suddenly starting
to take half a second to respond to keystrokes just because
someone launched "cc -O4 foo.
Nicola Musatti wrote:
> It's in *commercial* projects that
> features nobody really needs are not implemented. Profit is
> fundamental in convincing you that you really need the features.
In Soviet Russia, you don't need features, features need *you*.
--
Greg
--
http://mail
ght be safer to do
while pids:
...
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
(lambda x,y: x and (y>=10), counts):
break
continue
print "Child Process %d (%d) terminated, restarting" % (i, pid),
p[i] = Popen('sleep 1', shell=True)
pids[p[i].pid] = i
print "(%d)" % p[i].pid
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
ne in the file
needs to be re-written, one way or another.
If you're doing this sort of thing a lot, and
need it to be faster than reading and rewriting the
file, you may need to look into using a more
sophisticated format on disk than a plain file.
--
Greg
--
http://mail.python.org/ma
every module that uses it. Importing something more than
once does no harm.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
ry.ac.nz/greg.ewing/python/Snobol.tar.gz
There's no manual yet, but there's a fairly complete
set of docstrings and some test cases to figure it
out from.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
a different data structure.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
7;,
not the one in os). Then your revertStderr
function will work.
BTW I'd arrange for the reversion to be done
in a try-finally, e.g.
nullStderr()
try:
do_something()
finally:
revertStderr()
so you won't get stuck with a redirected stderr
if an exception occurs, and thereby not be able
to see the traceback!
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
hasn't been
imported before, it has to be loaded into memory, which
is expensive. If it has been imported before, then
you're just creating another reference to the same
module object, which is very cheap. An import *
just does the cheap part, and leaves you to explicitly
ask for the expensive
lowing version:
def f(x, y = []):
y = []
y.append(x)
print y
f(17)
f(42)
Try to work out what it will do, then try it, and
see if you understand why it does what it does.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
an HTTP one. It persists throughout the entire use
session of the application, for one thing, and there
is heaps of state being kept on both sides of the
connection. There's also a very high communication
bandwidth between them. There's really no comparison.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
r interface.
In fact, the more state is kept, the *less* bandwidth
you need, because communication can make use of shared
context to compress the messages.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
"assignment", mean the same thing to the person
on the other end. The interpreter always interprets
things unambiguously.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
1 - 100 of 1194 matches
Mail list logo