Dear all,
I've stumbled over a problem with Windows Locale ID information and
codepages. I'm writing a Python application that parses a CSV file,
the format of a line in this file is "LCID;Text1;Text2". Each line can
contain a different locale id (LCID) and the text fields contain data
that is
Steven D'Aprano wrote:
class A:
def bar(self):
print "A"
Alas, you've chosen the worst-possible example to "clarify" matters,
because old-style classic classes are *not* unified with types, and will
disappear in the future:
Of course I wanted to write `class A(objec
That would imply that I cannot create instances of a type, only of
a class that implements the type, wouldn't it?
But Python denotes 'int' as a type *and* I can instantiate it.
Now I start getting confused also ;-)
>>> a=5
>>> a.__class__
>>> a.__class__.__class__
>>> dir(a)
['__abs__', '__a
Can someone explain to me the difference between a type and a class?
If your confusion is of a more general nature I suggest reading the
introduction of `Design Patterns' (ISBN-10: 0201633612), under
`Specifying Object Interfaces'.
In short: A type denotes a certain interface, i.e. a set of
Lawrence D'Oliveiro wrote:
Specified by whom? The most common setting these days is 4 columns.
Where? I've randomly seen code snipplets that indent using spaces or,
worse, tabstop != 8, but most code I've come across uses tabstop width
8, which is how it was meant to be from the beginning of
ptn wrote:
Hi everybody,
I have a weird problem. Say I have a .py file with some functions in
it, like this:
[...]
Could someone provide some pointers?
Thanks,
Pablo Torres N.
Have you enabled the `list' option to see which characters are acutally
on the lines of interest? Try out `:se
Carl Banks wrote:
On Jul 17, 9:57 am, Thomas Troeger <[EMAIL PROTECTED]>
wrote:
I'd say that PyGame could be a solution.
Or otherwise you could do your own audio/graphics programming (you don't
tell us which OS you use, but there exist python modules that allow you
to do ba
C Martin wrote:
How do you setup a Tcl extension to be accessible through Python? I
understand that I'll have to use native Tcl calls to use it (tk.call()
etc), but I can't figure out where to put the files or how to
initialize them so I can call them.
The package I would like to use is TkPNG:
I'd say that PyGame could be a solution.
Or otherwise you could do your own audio/graphics programming (you don't
tell us which OS you use, but there exist python modules that allow you
to do barebones graphics & sound programming on linux...).
After some more reading I've stumbled over pygle
Jan Claeys wrote:
I'd say that PyGame could be a solution.
Or otherwise you could do your own audio/graphics programming (you don't
tell us which OS you use, but there exist python modules that allow you
to do barebones graphics & sound programming on linux...).
Yes, I'm using a very small L
Alex Marandon wrote:
Alexnb wrote:
I am wondering, is there a simple way to test for Internet connection? If
not, what is the hard way :p
Trying to fetch the homepage from a few major websites (Yahoo, Google,
etc.)? If all of them are failing, it's very likely that the connection
is down. Yo
Kay Schluehr wrote:
On 15 Jul., 11:51, Thomas Troeger <[EMAIL PROTECTED]>
wrote:
I've really looked at a lot of places but haven't found a suitable
solutions yet, so I'm asking here in hope that someone has experience
with that topic.
Which solutions did you rule
Hi,
Sorry I've posted a similar question some weeks ago, but I got no
answers. I want to embed a Python application on a device with limited
resources, esp. storage limitations. Is there a way to reduce the Python
interpreter to a set of modules that's urgently needed? Or is there a
method to
Bruno Desthuilliers wrote:
return "%s(%d,%d)" % (type(self).__name__, self.a, self.b)
Er, yes exactly! I noticed it a few seconds after I had sent the message ;-(
I want to have a list of such classes instantiated automatically on
Of course I meant class instances ... sorry :) It'
Hello,
I have a class that looks like this:
class A(object):
def __init__(self, a=0, b=1):
self.a, self.b=a, b
def __str__(self):
return "%s(%d,%d)" % (type(a).__name__, self.a, self.b)
I want to have a list of such classes instantiated a
Hi,
I'd like to put the python library and interpreter on a small embedded
Linux x86 compatible device where disk space is an issue. I played
around with the minimal Python interpreters, but was not entirely happy
with them, so my question is, is there an (preferably easy) way to put
the inte
[EMAIL PROTECTED] wrote:
I have Heard About "Python" its a OOD Language. i have to Learn it
where from i should start it.
i have python compiler at linux Platform.
anyone can suggest me about it.
Thanks In advance.
How about http://docs.python.org/tut/tut.html?
--
http://mail.python.org/mailma
Paul Rubin wrote:
I have a lot of short English strings I'd like to compress in order to
reduce the size of a database. That is, I'd like a compression
function that takes a string like (for example) "George Washington"
[...]
Thanks.
I think your idea is good, maybe you'd want to build an
Dear all,
I've successfully embedded the Python interpreter into a set of C/C++
application programs that use a larger library project with information
from http://docs.python.org/api/api.html and
http://docs.python.org/ext/ext.html. Now I want to wrap classes and
functions from the associate
You can execute cleanup code if the interpreter exits:
http://docs.python.org/lib/module-atexit.html
This will only cover the `Python's exit' part of your question, not the
module reloading stuff. On the other hand, if you load a module you
could set a global variable and check for it on reload
Thanks guys, you've helped me very much :) Cheers & happy new year!
--
http://mail.python.org/mailman/listinfo/python-list
Ok I've written a small example program to clarify matters:
[SNIP]
#!/usr/bin/python
import os, sys, time
def template(src, dst, sep):
"""
Copy file from src to dst, executing embedded python code.
"""
try:
#
Dear all,
I've written a program that parses a string or file for embedded python
commands, executes them and fills in the returned value. The input might
look like this:
process id: $$return os.getpid()$$
current date: $$return time.ctime()$$
superuser: $$
if os.geteuid():
return "Yes"
23 matches
Mail list logo