. However, i'd like to
assign these values to the button so it
always stays the same width as the frame.
Don't do it yourself, pack with the `fill` argument set to `Tkinter.X`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
()
b1= o.someattr
reload( o )
b2= o.someattr
b1 is b2
?
You are really a bit thick, a troll, or a bot.
*plonk*
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
. The end will be signaled by an
`IndexError`.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
as ISO-8859-1. Sou you should
decode `content` to unicode before searching the chinese characters.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 02 Mar 2008 14:15:09 +, Steve Turner wrote:
Apart from doing something like
a=[0,0,0]
b=[0,0,0]
c=[0,0,0]
d=[a,b,c]
is there a better way of creating d??
a = [[0] * 3 for dummy in xrange(3)]
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
On Sun, 02 Mar 2008 21:58:31 +0100, Christoph Zwerschke wrote:
Marc 'BlackJack' Rintsch schrieb:
On Sun, 02 Mar 2008 14:15:09 +, Steve Turner wrote:
Apart from doing something like
a=[0,0,0]
b=[0,0,0]
c=[0,0,0]
d=[a,b,c]
is there a better way of creating d??
a = [[0] * 3
what you expected and what you
get instead.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
? Where does the program fail? With
what exception(s)?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
thinks `x` must
be a `Fractional`, a subclass of `Num`.
Then comes the third line with `length` returning an `Int` and the
`Fractional` `x` but there is no implementation for a `+` function on
those types.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
: the rights to create a file at `file_path`. Remember
that web servers usually have their own user.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
language against C#, D,
or Java. ;-)
What's the relevance of C#, D, or Java to the OP's post?
The same as C++ to the OP's post if he would have talked about C. :-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
the tutorial in the docs, at least until
section 8.3 Handling Exceptions:
http://docs.python.org/tut/node10.html#SECTION001030
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
is to learn about the
computer and that basically everything is a number in the end, then C is a
good choice. More portable than assembler but nearly as close to the
metal.
To the OP: If you try C++, don't hold that crappy language against C#, D,
or Java. ;-)
Ciao,
Marc 'BlackJack' Rintsch
to the
top level and ending the program.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
it to a float or not. Or you make Python into a
statically typed language like Haskell. But then it's not Python anymore
IMHO.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
to think about it and to write in that value style, because that
goes against my expectations/picture of OOP -- a graph of
independent/loosely coupled objects communicating with each other. In
this sense C++ looks like a quite crippled and fragile OOP language to me.
Ciao,
Marc 'BlackJack
holds a
CS degree.
So why is it creepy then!? ``3 // 4`` is for the people knowing about
integer division and ``3 / 4`` gives the expected result for those who
don't. Those who don't know ``//`` can write ``int(3 / 4)`` to get the
same effect.
Ciao,
Marc 'BlackJack' Rintsch
--
http
On Tue, 26 Feb 2008 06:33:01 -0800, castironpi wrote:
On Feb 26, 8:14 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
On Tue, 26 Feb 2008 06:02:12 -0800, bearophileHUGS wrote:
This is a real difference, that has real impact on the programs I
write, so I often use the if/else approach
, credits or license for more information.
3 / 4
0.75
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 26 Feb 2008 09:13:35 -0800, castironpi wrote:
Back home, the original post would be interesting, so I wrote it.
So you think of this group as your personal notepad. That explains a lot. :-/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 23 Feb 2008 22:44:30 +, Tim Roberts wrote:
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
On Fri, 22 Feb 2008 11:00:17 -0800, Aahz wrote:
It's just too convenient to be able to write
L += ['foo']
without rebinding L.
nitpickBut ``+=`` does rebind./nitpick
Usually
and it's rebound to the
instance, or if they tried it on a list in a tuple. Extending a list
that's a read only property doesn't work either.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
(although that's debatable), but it always
traverses the entire list.
The ``not in`` stops if the element is found.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
. In
Python both belong to the value.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
that it could use some loops to
refactor it into a **much** shorter piece of code.
Then get rid of the asterisk import, ``except``\s without a specific
exception to handle, and the``global`` statement before you repost the
problem.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
language!?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 22 Feb 2008 12:32:10 +, Steven D'Aprano wrote:
On Fri, 22 Feb 2008 08:12:56 +, Marc 'BlackJack' Rintsch wrote:
A variable in programming languages is composed of a name, a memory
location, possibly a type and a value. In C-like languages, where you
put values in named
++. ;-)
But somehow you still manage memory by writing in a style that favors
value types.
SCNR,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
learning phase. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
effects.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
()` is called at all! So if you think this clean
up is necessary to leave a usable console then don't put it into a
`__del__()` method!
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 15 Feb 2008 15:10:12 +, Sion Arrowsmith wrote:
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
When the interpreter shuts down it has to remove objects. Everything you
need in a `__del__()` method must be referenced by that object to be sure
that it is still there and not already
, arg):
: return func(arg)
:
In [19]: f(int, '42')
Out[19]: 42
In [20]: f(str.split, 'a b c')
Out[20]: ['a', 'b', 'c']
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 12 Feb 2008 14:45:43 +0100, Sun wrote:
then the question is how can I declare a empty set variable as a 'var= []'
do to a list variable?
You don't declare variables in Python. Just create an instance of `set`
and bind it to a name:
var = set()
Ciao,
Marc 'BlackJack' Rintsch
and I
didn't find answers on the net...
So the real question is, why you see 'math' in `__builtins__`. It should
not be there.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
defense. :-)
http://en.wikipedia.org/wiki/Chewbacca_defense
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 08 Feb 2008 05:12:29 -0800, Ryszard Szopa wrote:
Expressing simple loops as C for loops...
You mean simple loops like ``for i in xrange(1000):``? How should the
compiler know what object is bound to the name `xrange` when that loop is
executed?
Ciao,
Marc 'BlackJack' Rintsch
. Is either of these examples supposed to work
as shown? Is it clear that either example is obviously wrong?
The second is wrong. The first should work if `self` and `PIPE` are bound
to appropriate objects.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python
?
No and there can't be since the attributes you seem to be interested in
don't exist until an instance is created.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
at the `inspect` module.
What's the use case?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 05 Feb 2008 06:19:12 +, Odysseus wrote:
In article [EMAIL PROTECTED],
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
Another issue is testing. If you rely on global names it's harder to test
individual functions. [...]
In programs without such global names you see quite
On Mon, 04 Feb 2008 09:43:04 +, Odysseus wrote:
In article [EMAIL PROTECTED],
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
def extract_data(names, na, cells):
found = dict()
The problem with initializing the 'super-dictionary' within this
function is that I want
time. That's what I meant by people
going through the doors. Maybe it was more clear in my head.
But my timing shows that method two is slower on my computer. So there is
no obvious winner.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
: 18.085366010665894
I guess it's really all about the disk IO as my system monitor applet
shows that almost all of the time is spend in the kernel and very little
in user space.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
success or failure? All the
data I want should all have been stored in the found dictionary by the
time the function finishes traversing the list of names.
Then create the `found` dictionary in that function and return it at the
end.
Ciao,
Marc 'BlackJack' Rintsch
--
http
door; push him through the door; close his door
vs.
for every person:
open his door
for every person:
push him through the door
for every person:
close his door
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
change syntax.
Why not simply writing a function?
def execute_parallel(f, A):
for args in A:
start_new_thread(target=f, args=args)
def f(x):
normal_suit(x)
parallel(f, A)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
memory.
To the OP: Since Python 2.5 the `ctypes` module is another way to
interface with native code in dynamic libraries from the standard
library.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 04 Feb 2008 21:58:46 +, Steven D'Aprano wrote:
On Mon, 04 Feb 2008 17:08:02 +, Marc 'BlackJack' Rintsch wrote:
Surprisingly, Method 2 is a smidgen faster, by about half a second over
500,000 open-write-close cycles. It's not much faster, but it's
consistent, over many tests
] = m_abbrevs.index(dlist[1]) + 1``.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
`psyco.unbind()`?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
`range` vs. `xrange` but the arguments (1,n) vs. (n).
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
... return True
...
while go(3):
... print 'hello'
...
hello
hello
hello
Please try:
while go(3):
while go(3):
print 'Think about it...'
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'.decode('unicode-escape')
Out[388]: u'Fr\xf8ya'
In [389]: print 'Fr\u00f8ya'.decode('unicode-escape')
Frøya
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
the way you wrote
it with parentheses is a bit misleading.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
is the hash of the identity of an object:
In [415]: class A(object): pass
.:
In [416]: a = A()
In [417]: hash(a)
Out[417]: 161029068
In [418]: hash(id(a))
Out[418]: 161029068
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
the `pexpect` module might be a solution.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
be used for other
things as well.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of the second
call. IIRC psyco needs at least one call to analyze the function, so the
first call is not speed up.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
. Are you sure you are qualified to ask
such a question in the first place!? :-þ
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
.
That was an allusion to a quote misattributed to Bill Gates about DOS:
640K ought to be enough for anybody.
http://en.wikiquote.org/wiki/Bill_Gates#Misattributed
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
to unicode string, what
should I do to make SAX work?
Decode it and then encode it to utf-8 before feeding it to the parser.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
, not compiled to assembler. If you want to know how this
happens get the C source code of the interpreter and don't waste your time
with disassembling `python.exe`. C is much easier to read and there are
useful comments too.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
On Sun, 27 Jan 2008 11:23:20 +, over wrote:
Don't fucking tell me about assembler, you asshole. I can read
disassembled code in my sleep.
Yes you can read it, but obviously you don't understand it.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python
Kruger and David Dunning, then both of Cornell University. Their
results were published in the Journal of Personality and Social
Psychology in December 1999.
http://en.wikipedia.org/wiki/Dunning-Kruger_effect
See, there's almost always a rational explanation. ;-)
Ciao,
Marc 'BlackJack
On Sun, 27 Jan 2008 16:00:42 +, Peter Pei wrote:
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On Sun, 27 Jan 2008 05:32:40 +, Peter Pei wrote:
You didn't understand my question, but thanks any way.
Yes, it is true that %s already support
(), but apparently not.
Maybe `bytecodehacks`_ + `psyco`, or PyPy!?
.. _bytecodehacks: http://sourceforge.net/projects/bytecodehacks/
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
more input?
The subprocess in a purely passive position: it is an interpreter: I
send it commands and I read the answers. The python side is in charge.
This doesn't answer if the interpreter doesn't flush its output buffer
after every line.
Ciao,
Marc 'BlackJack' Rintsch
--
http
are unordered.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
, not a decoded string. Don't decode it
yourself.
However, I use another text editor to convert the file to utf-8 and
SAX will parse the content successfully.
Because now you feed SAX with bytes instead of a unicode string.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman
of: read from stdin.
So the interface if `fui.py` would be:
1. ./fui.py *.a
2. ls *.a | ./fui.py -
3. ls *.a | ./fui.py *.b -
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
shoot down the idiomatic answer I guess. That's what most people
do.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
``lala.split()``:
In [97]: lala = 'LNAME PASTA ZONE'
In [98]: lala.split()
Out[98]: ['LNAME', 'PASTA', 'ZONE']
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
? where is it
coming from? I'm totally confused on it.thanks.
`oops` is bound to the `ValueError` or `TypError` object if `float()`
raises such an exception.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
, then
foo = func;
and
foo = func();
have different meanings. It's just the same in Python. First is the
function itself, second *calls* the function.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
in a source file.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
of the text is not read.
You have to open the file in binary mode ('rb'/'wb') instead of text mode
('r'/'w') to stop Windows from interpreting the EOF character this way.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
() and .__str__. Do you maybe know what's the
rationale behind not following that convention by getattr?
I think you are confusing `__getattr__` and `__getattribute__` here!
`getattr()` maps to `__getattr__()`, it's `__getattribute__` that's
different.
Ciao,
Marc 'BlackJack' Rintsch
--
http
to
the clients for execution. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
would be: use one of the many already existing templating
systems.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
self as parameter.
You are not adding a method but a function. Take a look at
`types.MethodType()` to create a method from a function, instance, and
class.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
=employee','meaningless']
In [103]: mydict={}
In [104]: for i in mylist[1:-1]:
.: a=i.split('=')
.: mydict[a[0]]=a[1]
.:
In [105]: mydict
Out[105]: {'mike': 'manager', 'paul': 'employee', 'tom': 'boss'}
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org
,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
``slow``
unbuffered or line buffered.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
), str(results))
subprocess.Popen([s])
Here you are trying to start a program named gmmscore -i ... with no
arguments. That fails (unless you really have a program with that name. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
that they match.
The right direction would be the tutorial in the docs I guess:
http://docs.python.org/tut/tut.html
What do you mean by the hexadecimal form? `id()` returns ordinary
`int`\s and not strings.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
On Wed, 02 Jan 2008 03:24:56 -0800, vedrandekovic wrote:
Here is sample of my simple script with wxpython and modules:
subprocess,threading, directpython...
Are you accessing the GUI from threads?
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python
.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
are considered equal.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
),
lines))
Maybe these functions usually don't turn up in code that can be called
recipes so often but are useful for themselves.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
not be a class. Maybe a function returning
`Article`\s would be enough. This is not Java, not everything has to be
stuffed into classes.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
. ;-)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
define it as
person.is_appropriate_sex = True
And sometimes it's not that simple but a property and connected with the
caller's history of `champagne.drink()` calls. The `person.is_pretty`
property is most definitely linked to that call history in many instances.
Ciao,
Marc 'BlackJack
characters.
Just differently encoded as bytes.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
you need the parenthesis, otherwise you are just
referencing it without any effect.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
does the constructor make the array of strings available to the
tokenize() method?
Assuming the `__init__()` above belongs to the `Toker` class then the
`tokenize()` method can access it via `self.text` of course.
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo
On Mon, 17 Dec 2007 06:20:23 -0800, vimal wrote:
i have a list of numbers
say a = [1,-1,3,-2,4,-6]
how should i check for negative values in the list
In [6]: a = [1, -1, 3, -2, 4, -6]
In [7]: any(n 0 for n in a)
Out[7]: True
Ciao,
Marc 'BlackJack' Rintsch
--
http
401 - 500 of 1496 matches
Mail list logo