On Sunday, February 3, 2013 10:35:30 PM UTC-6, Steven D'Aprano wrote:
On Sun, 03 Feb 2013 17:08:47 -0800, Saul Spatz wrote:
I don't understand what's going on at all. Can't I dynamically define
__getattr__? How should I go about it?
Special dunder methods (DoubleUNDERscore
(self, name):
print(name)
raise AttributeError
like a sensible person.
Saul
On Monday, February 4, 2013 8:15:47 AM UTC-6, Peter Otten wrote:
Saul Spatz wrote:
Now I have another question. If dunder methods are looked up only in the
class, not the instance, why did defining
To the good people on comp.lang.python:
I have the following Tkinter class (python 2.7.3):
from Tkinter import *
class ScrolledCanvas(Frame):
def __init__(self, master, width, height, bg, cursor):
Frame.__init__(self, master)
self.__nonzero__ = lambda: True
canv = self.canvas =
New submission from Saul Spatz:
In trying to build a SWING module on Windows with 64-bit python, I get the
linker errors listed at the bottom of this message.
I have this problem with both python 2.7 and 3.2. I have built the project
without problems on Windows with 32-bit python
Saul Spatz saul.sp...@gmail.com added the comment:
b'\xe0\x80'.decode('utf-8', 'replace') returns one U+FFFD and not two. I
don't think that is right.
I think that one U+FFFD is correct. The on;y error is a premature end of
data.
On Thu, May 17, 2012 at 12:31 PM, Serhiy Storchaka
rep
I've been using pymysql to connect to a database, and it has suddenly stopped
working on the one machine (a virtual server) where I really need it to work.
I have a function with hard-coded parameters to do the connection, and now I'm
getting an error that says, Can't connect to MySQL server
Thanks a lot; I didn't know about sys.executable. For the record, IDLE is
running pythonw.exe. I won't have a chance to test if this helps till
tomorrow, unfortunately.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks so much, this is great. I want to validate that the user is entering a
string appropriate for bytes.fromhex. Here's how I modified your validate
funtion:
def validate(before, after):
print(before, --, after)
#return after.isdigit()
return after[-1] in
That doesn't work, I'm being stupid, The user might type anywhere in the
string, not just at the end. I need
return all([c in '1234567890abcdefABCDEF ' for c in after])
--
http://mail.python.org/mailman/listinfo/python-list
Yes, the tuple is certainly easier to read.
Thanks again.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks, that a great link.
--
http://mail.python.org/mailman/listinfo/python-list
In tcl/tk an Entry widget can be set to validate its contents with the validate
option. You have to give it a validatecommand (vcmd), which is a tcl script
that runs when some action triggers validation. Usually, the script would use
percent substitutions so the script would be something like
I want to interface to the native validation of tk. If you don't know what
that is, you're unlikely to be able to help me.
--
http://mail.python.org/mailman/listinfo/python-list
Changes by Saul Spatz saul.sp...@gmail.com:
--
nosy: +spatz123
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8271
___
___
Python-bugs-list mailing
New submission from Saul Spatz saul.sp...@gmail.com:
The attached script produces the output
'A\ufffdBC\ufffd'
'A\ufffdBC'
although it seems to me that both lines should be the same. The first line is
correct, I think, since the F4 at the end is a maximal subpart of an
ill-formed
Thanks. I agree with you about the generator. Using your first suggestion,
code points above U+ get separated into two surrogate pair characters
fron UTF-16. So instead of U=10 I get U+DBFF and U+DFFF.
--
http://mail.python.org/mailman/listinfo/python-list
Thanks very much. This is the elegant kind of solution I was looking for. I
had hoped there was a way to do it without even addressing the matter of
surrogates, but apparently not. The reason I don't like this is that it
depends on knowing that python internally stores strings in UTF-16. I
Hi,
I'm just starting to learn a bit about Unicode. I want to be able to read a
utf-8 encoded file, and print out the codepoints it encodes. After many false
starts, here's a script that seems to work, but it strikes me as awfully
awkward and unpythonic. Have you a better way?
def
It works if you change it like so:
from tkinter import *
class ShowList(Frame):
def __init__(self, root):
Frame.__init__(self, root)
self.grid()
self.draw_widgets()
def draw_widgets(self):
cframe = Frame(self)
This is the third time I've tried to post this reply. If you see multiple
answers from me, that's why.
Your script will work if you change it like so:
from tkinter import *
class ShowList(Frame):
def __init__(self, root):
Frame.__init__(self, root)
It works if you change it like so:
from tkinter import *
class ShowList(Frame):
def __init__(self, root):
Frame.__init__(self, root)
self.grid()
self.draw_widgets()
def draw_widgets(self):
cframe = Frame(self)
The documentation refers to the Demo directory in the source. I've downloaded
the source tarball for python 3.2 and there's no such directory. I downloaded
the source for python 2.7 to check, and the Demo directory is present. Has the
directory been moved, renamed or eliminated in 3.2?
On Nov 25, 8:40 am, Jean-Michel Pichavant jeanmic...@sequans.com
wrote:
Hy guys,
I'm struggling matching patterns ending with a comma ',' or an end of
line '$'.
import re
ex1 = 'sumthin,'
ex2 = 'sumthin'
m1 = re.match('(?Psomething\S+),', ex1)
m2 = re.match('(?Psomething\S+)$', ex2)
m3
Hi,
I've been trying to install PyQt on Windows XP Pro so that I can try
out eric ide. I used the binary windows installer for PyQt. I can
run eric as administrator, but not with my ordinary user account. By
running eric.bat with the --debug flag, I found that he crux of the
problem is that if
When I double-click on a file with a .pyw extension, nothing appears to
happen. Control panel shows that pythonw is associated with this extension,
and if I right-click on the filename, the program suggested to open it is
pythonw.exe. If I make a desktop shortcut with the target pythonw.exe
W. eWatson wrote:
I'm looking a program that I'm not real familiar with that uses an
after_cancel method and after_id variable. Are they related to some
particular widget and what is there function? Perhaps they are related
to a Cancel button on a widget?
I'm running python 2.5.x on Windows XP, and I installed 3.0, just to get
familiar with it. I have a directory with all my python projects in my
PYTHONPATH variable. When I try to run python 3.0, it detects a syntax
error (a print statement) in the first file in this directory, and
crashes.
Dietrich Bollmann wrote:
Hi,
I am trying to write a simple shell loop in Python.
My simple approach works fine - but the first output line after entering
something is always indented by one blank.
Is there any logic explanation for this?
How can I get rid of the blank?
Is there a smarter
defn noob wrote:
if start == end:
return path
if not self.dictionary.has_key(start):
if start not in self.dictionnary:
return None
for node in self.dictionary[start]:
if node not in path:
newpath =
format the strings:
http://www.python.org/doc/2.1.3/lib/typesseq-strings.html
[EMAIL PROTECTED] wrote:
Hi All,
How do I format printed data in python?
I could not find this in the Python Reference Manual:
http://docs.python.org/ref/print.html
Nor could I find it in Matloff's great tutorial:
macoovacany wrote:
http://macoovacany.wordpress.com/
When I tried to run it, I got all kinds of syntax errors because of
non-ASCII characters; namely, you have fancy left and right single
and double quotes. Once I replaced these with the ASCII equivalents,
it worked fine. I suggest you use a
Hi,
I'm making a project into my first package, mainly for organization, but
also to learn how to do it. I have a number of data files, both
experimental results and PNG files. My project is organized as a root
directory, with two subdirectories, src and data, and directory trees
below
Cédric Lucantis wrote:
Le Sunday 22 June 2008 16:07:37 Saul Spatz, vous avez écrit :
Hi,
I'm making a project into my first package, mainly for organization, but
also to learn how to do it. I have a number of data files, both
experimental results and PNG files. My project is organized
33 matches
Mail list logo