On Tuesday, January 17, 2017 at 11:11:27 AM UTC, Peter Otten wrote:
> Rotwang wrote:
>
> > Here's something odd I've found with the tokenize module: tokenizing 'if
> > x:\ny' and then untokenizing the result adds '\\\n' to the end.
> > Attempting to tokenize the re
Here's something odd I've found with the tokenize module: tokenizing 'if x:\n
y' and then untokenizing the result adds '\\\n' to the end. Attempting to
tokenize the result again fails because of the backslash continuation with
nothing other than a newline after it. On the other hand, if the
On 24/06/2014 20:10, Rotwang wrote:
Hi all, I've found something weird with pdb and I don't understand it. I
want to define a function mydebugger() which starts the debugger in the
caller's frame. The following is copied from IDLE with Python 2.7.3
(I've since tried it with 3.3.0 and the same
Hi all, I've found something weird with pdb and I don't understand it. I
want to define a function mydebugger() which starts the debugger in the
caller's frame. The following is copied from IDLE with Python 2.7.3
(I've since tried it with 3.3.0 and the same thing happens):
Python 2.7.3
On 11/05/2014 04:11, Steven D'Aprano wrote:
[...]
And try running
this function in both 2.7 and 3.3 and see if you can explain the
difference:
def test():
if False: x = None
exec(x = 1)
return x
I must confess to being baffled by what happens in 3.3 with this
example. Neither
On 11/05/2014 19:40, Ned Batchelder wrote:
On 5/11/14 9:46 AM, Rotwang wrote:
On 11/05/2014 04:11, Steven D'Aprano wrote:
[...]
And try running
this function in both 2.7 and 3.3 and see if you can explain the
difference:
def test():
if False: x = None
exec(x = 1)
return x
I
On 04/05/2014 15:16, Steven D'Aprano wrote:
On Sun, 04 May 2014 20:03:35 +1200, Gregory Ewing wrote:
Steven D'Aprano wrote:
If it were a class method, you would call it by MyBaseClass.__new__()
rather than explicitly providing the cls argument.
But that wouldn't be any good, because the
On 04/04/2014 19:55, Ian Kelly wrote:
On Fri, Apr 4, 2014 at 12:37 PM, Rotwang sg...@hotmail.co.uk wrote:
Hi all. I thought I had a pretty good grasp of Python's scoping rules, but
today I noticed something that I don't understand. Can anyone explain to me
why this happens?
x = 'global'
def
Hi all. I thought I had a pretty good grasp of Python's scoping rules,
but today I noticed something that I don't understand. Can anyone
explain to me why this happens?
x = 'global'
def f1():
x = 'local'
class C:
y = x
return C.y
def f2():
x = 'local'
class C:
On 18/02/2014 23:28, Rotwang wrote:
[...]
I have music software that's a single 9K-line Python module, which I
edit using Notepad++ or gedit.
Incidentally, in the time since I wrote the above I've started using
Sublime Text 3, following somebody on c.l.p's recommendation (I
apologise that I
On 21/02/2014 18:58, K Richard Pixley wrote:
Could someone please explain to me why the two values at the bottom of
this example are different?
Python-3.3 if it makes any difference.
Is this a difference in evaluation between a class attribute and an
instance attribute?
Yes, see below.
On 18/02/2014 21:44, Rick Johnson wrote:
[...]
Are you telling me you're willing to search through a single
file containing 3,734 lines of code (yes, Tkinter) looking
for a method named destroy of a class named OptionMenu
(of which three other classes contain a method of the same
exact name!),
On 18/02/2014 23:41, Rick Johnson wrote:
On Tuesday, February 18, 2014 5:28:21 PM UTC-6, Rotwang wrote:
[snipped material restored for context]
On 18/02/2014 21:44, Rick Johnson wrote:
[...]
Are you telling me you're willing to search through a single
file containing 3,734 lines of code
On 17/02/2014 06:21, Steven D'Aprano wrote:
On Mon, 17 Feb 2014 11:54:45 +1300, Gregory Ewing wrote:
[...]
[1] Mathematicians tried this. Everything is a set! Yeah, right...
No, that's okay. You only get into trouble when you have self-referential
sets, like the set of all sets that don't
What's this? A discussion about angels dancing on a the head of a pin?
Great, I'm in.
On 13/02/2014 14:00, Marko Rauhamaa wrote:
Oscar Benjamin oscar.j.benja...@gmail.com:
This isn't even a question of resource constraints: a digital computer
with infinite memory and computing power would
On 13/02/2014 22:00, Marko Rauhamaa wrote:
Rotwang sg...@hotmail.co.uk:
for x in continuum(0, max(1, y)):
# Note: x is not traversed in the order but some other
# well-ordering, which has been proved to exist.
if x * x == y
On 10/02/2014 18:45, Rick Johnson wrote:
[...]
3. Implicit introspection is evil, i prefer all
references to a callable's names to result in a CALL
to that callable, not an introspection!
So, for example, none of
isinstance(x, myclass)
map(myfunc, range(10))
x =
On 03/02/2014 13:59, wxjmfa...@gmail.com wrote:
[...]
I noticed the same effect with the Python doc
since ? (long time).
Eg.
The Python Tutorial
appears as
The Python Tutorial¶
with a visible colored ¶, 'PILCROW SIGN',
blueish in Python 3, red in Python 2.7.6.
Hint: try clicking the ¶.
--
On 03/02/2014 18:37, wxjmfa...@gmail.com wrote:
[...]
Hint: try clicking the ¶.
I never was aware of this feature. Is it deliverate?
Do you mean deliberate? Of course it is.
It gives to me the feeling of a badly programmed
html page, especially if this sign does correspond
to an eol!
On 30/01/2014 06:33, Andrew Berg wrote:
On 2014.01.29 23:56, Jessica Ross wrote:
I found something like this in a StackOverflow discussion.
def paradox():
... try:
... raise Exception(Exception raised during try)
... except:
... print Except after try
...
On 30/01/2014 12:49, Dave Angel wrote:
[...]
For hysterical reasons, True and False are instances of class
bool, which is derived from int. So for comparison purposes
False==0 and True==1. But in my opinion, you should never take
advantage of this, except when entering obfuscation
On 30/01/2014 23:36, Joshua Landau wrote:
On 30 January 2014 20:38, Chris Angelico ros...@gmail.com wrote:
Why is tuple unpacking limited to the last argument? Is it just for
the parallel with the function definition, where anything following it
is keyword-only?
You're not the first person
On 31/01/2014 00:21, Ben Finney wrote:
Rotwang sg...@hotmail.co.uk writes:
On a vaguely-related note, does anyone know why iterable unpacking in
calls was removed in Python 3?
This is explained in the PEP which described its removal
URL:http://www.python.org/dev/peps/pep-3113/, especially
On 17/01/2014 18:43, Tim Chase wrote:
On 2014-01-17 09:10, Mark Lawrence wrote:
Slight aside, any chance of changing the subject of this thread, or
even ending the thread completely? Why? Every time I see it I
picture Inspector Clouseau, A BOM!!! :)
In discussions regarding BOMs, I
On 12/01/2014 05:58, Chris Angelico wrote:
[...]
(BTW, is there no better notation than six nested for/range for doing
6d6? I couldn't think of one off-hand, but it didn't really much
matter anyway.)
If you're willing to do an import, then how about this:
from itertools import product
On 08/01/2014 19:56, axis.of.wea...@gmail.com wrote:
can someone please explain why the following works, in contrast to the second
example?
def decorator(func):
def on_call(*args):
print args
return func(args)
return on_call
class Foo:
@decorator
def
On 07/12/2013 12:41, Jussi Piitulainen wrote:
[...]
if tracks is None:
tracks = []
Sorry to go off on a tangent, but in my code I often have stuff like
this at the start of functions:
tracks = something if tracks is None else tracks
or, in the case where I don't intend for
On 07/12/2013 16:08, Roy Smith wrote:
In article 31f1bb84-1432-446c-a7d4-79ce16f2a...@googlegroups.com,
wxjmfa...@gmail.com wrote:
It is on this level the FSR fails.
What is FSR? I apologize if this was explained earlier in the thread
and I can't find the reference.
It's the Flexible
On 07/12/2013 16:25, Steven D'Aprano wrote:
On Sat, 07 Dec 2013 16:13:09 +, Rotwang wrote:
On 07/12/2013 12:41, Jussi Piitulainen wrote:
[...]
if tracks is None:
tracks = []
Sorry to go off on a tangent, but in my code I often have stuff like
this at the start of functions
On 06/12/2013 16:51, Piotr Dobrogost wrote:
[...]
I thought of that argument later the next day. Your proposal does
unify access if the old obj.x syntax is removed.
As long as obj.x is a very concise way to get attribute named 'x' from
object obj it's somehow odd that identifier x is treated
On 04/12/2013 20:07, Piotr Dobrogost wrote:
[...]
Unless we compare with what we have now, which gives 9 (without space) or 10
(with space):
x = obj.'value-1'
x = getattr(obj, 'value-1')
That is not a significant enough savings to create new syntax.
Well, 9 characters is probably
On 27/11/2013 08:31, Antoon Pardon wrote:
Op 27-11-13 09:19, Chris Angelico schreef:
[...]
Do you mean standard British English, standard American English,
standard Australian English, or some other?
Does that significantly matter or are you just looking for details
you can use to disagree?
On 24/11/2013 14:27, Steven D'Aprano wrote:
On Sat, 23 Nov 2013 19:53:32 +, Rotwang wrote:
On 22/11/2013 11:26, Steven D'Aprano wrote:
A frequently missed feature is the ability to chain method calls:
[...]
chained([]).append(1).append(2).append(3).reverse().append(4) =
returns [3, 2, 1
On 22/11/2013 11:26, Steven D'Aprano wrote:
A frequently missed feature is the ability to chain method calls:
x = []
x.append(1).append(2).append(3).reverse().append(4)
= x now equals [3, 2, 1, 4]
This doesn't work with lists, as the methods return None rather than
self. The class needs to be
On 23/11/2013 19:53, Rotwang wrote:
[...]
That's pretty cool. However, I can imagine it would be nice for the
chained object to still be an instance of its original type. How about
something like this:
[crap code]
The above code isn't very good - it will only work on types whose
constructor
On 24/11/2013 00:28, Rotwang wrote:
[...]
This solves some of the problems in my earlier effort. It keeps a copy
of the original object,
Sorry, I meant that it keeps a reference to the original object.
--
https://mail.python.org/mailman/listinfo/python-list
On 11/11/2013 12:02, sg...@hotmail.co.uk wrote:
(Sorry for posting through GG, I'm at work.)
On Monday, November 11, 2013 11:25:42 AM UTC, Steven D'Aprano wrote:
Suppose I have a function that needs access to globals:
# module A.py
def spam():
g = globals() # this gets globals from A
On 12/11/2013 01:57, Terry Reedy wrote:
On 11/11/2013 7:02 AM, sg...@hotmail.co.uk wrote:
(Sorry for posting through GG, I'm at work.)
On Monday, November 11, 2013 11:25:42 AM UTC, Steven D'Aprano wrote:
Suppose I have a function that needs access to globals:
# module A.py
def spam():
g
On 14/10/2013 06:02, Steven D'Aprano wrote:
On Sun, 13 Oct 2013 20:13:32 -0700, Tim Roberts wrote:
def add(c1, c2):
% Decode
c1 = ord(c1) - 65
c2 = ord(c2) - 65
% Process
i1 = (c1 + c2) % 26
% Encode
return chr(i1+65)
Python uses # for comments, not
On 10/10/2013 16:51, Neil Cerutti wrote:
[...]
Mixed arithmetic always promotes to the wider type (except in
the case of complex numbers (Ha!)).
r == c is equivalent to r == abs(c), which returns the magintude
of the complex number.
What?
-1 == -1 + 0j
True
-1 == abs(-1 + 0j)
False
1 ==
On 02/10/2013 11:15, Oscar Benjamin wrote:
On 2 October 2013 00:45, Rotwang sg...@hotmail.co.uk wrote:
So the upside of duck-typing is clear. But as you've already discovered, so
is the downside: Python's dynamic nature means that there's no way for the
interpreter to know what kind
On 01/10/2013 23:54, Chris Friesen wrote:
I've got a fair bit of programming experience (mostly kernel/POSIX stuff in C).
I'm fairly new to python though, and was hoping for some advice.
Given the fact that function parameters do not specify types, when you're
looking at someone else's code
On 20/09/2013 16:21, Kasper Guldmann wrote:
I was playing around with lambda functions, but I cannot seem to fully grasp
them. I was running the script below in Python 2.7.5, and it doesn't do what
I want it to. Are lambda functions really supposed to work that way. How do
I make it work as I
On 20/09/2013 16:51, bab mis wrote:
Hi ,
I have a function as below:
def func(**kwargs):
...
...
args=a='b',c='d'
i want to call func(args) so that my function call will take a var as an
parameter.
it fails with an error typeError: fun() takes exactly 0 arguments (1 given)
.
On 16/09/2013 19:43, Serhiy Storchaka wrote:
16.09.13 19:28, Rotwang написав(ла):
On Windows 7 (sys.version is '3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012,
10:57:17) [MSC v.1600 64 bit (AMD64)]') there's no problem; f() works
fine in the first place. Does anybody know what's going on?
What
On 16/09/2013 23:34, Chris Angelico wrote:
On Tue, Sep 17, 2013 at 2:28 AM, Rotwang sg...@hotmail.co.uk wrote:
If I then uncomment those two lines, reload the module and call f() again
(by entering tkderp.reload(tkderp).f()), the function works like it was
supposed to in the first place: two
On 17/09/2013 12:32, Chris Angelico wrote:
[...]
If reloading and doing it again makes things different, what happens
if you simply trigger your code twice without reloading?
I've no idea if it'll help, it just seems like an attack vector on the
problem, so to speak.
Thanks for the
On 17/09/2013 15:35, Chris Angelico wrote:
On Wed, Sep 18, 2013 at 12:25 AM, Rotwang sg...@hotmail.co.uk wrote:
In fact, if I replace tkderp with this:
# begin tkderp.py
import tkinter as tk
_root = tk.Tk()
_root.withdraw()
# end tkderp.py
then simply importing tkderp before tkderp2
Hi all,
I've just started trying to learn how to use ttk, and I've discovered
something that I don't understand. I'm using Python 3.3.0 in Linux Mint
15. Suppose I create the following module:
# begin tkderp.py
import tkinter as tk
import tkinter.messagebox as _
from tkinter import ttk
from
On 12/08/2013 06:54, Dave Angel wrote:
[...]
This function makes no sense to me. A function should have three
well-defined pieces: what are its parameters, what does it do, what are
its side-effects, and what does it return.
No! A function should have *four* well-defined pieces: what are
On 06/08/2013 11:07, Rui Maciel wrote:
Joshua Landau wrote:
Unless you have a very good reason, don't do this [i.e. checking
arguments for type at runtime and raising TypeError]. It's a damn pain
when functions won't accept my custom types with equivalent
functionality -- Python's a duck-typed
On 31/07/2013 14:55, Chris Angelico wrote:
[...]
Since the braced version won't run anyway, how about a translation like this:
def foo():
print(Hello,
world!)
for i in range(5):
foo()
return 42
--
0-def foo():
4-print(Hello,
0-world!)
4-for i in range(5):
8-foo()
On 29/07/2013 17:40, Ian Kelly wrote:
On Mon, Jul 29, 2013 at 10:20 AM, Chris Angelico ros...@gmail.com wrote:
On Mon, Jul 29, 2013 at 5:09 PM, MRAB pyt...@mrabarnett.plus.com wrote:
I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats
are approximate anyway, and the float
On 29/07/2013 17:20, Chris Angelico wrote:
On Mon, Jul 29, 2013 at 5:09 PM, MRAB pyt...@mrabarnett.plus.com wrote:
I'm surprised that Fraction(1/3) != Fraction(1, 3); after all, floats
are approximate anyway, and the float value 1/3 is more likely to be
Fraction(1, 3) than
On 06/07/2013 20:38, Terry Reedy wrote:
rms has crippling RSI (anonymous, as quoted by Skip).
I suspect that 'rms' = Richard M Stallman (but why lower case? to insult
him?). I 'know' that RSI = Roberts Space Industries, a game company
whose Kickstarter project I supported. Whoops, wrong
On 06/07/2013 19:43, Joshua Landau wrote:
On 6 July 2013 13:59, Russel Walker russ.po...@gmail.com wrote:
Since I've already wasted a thread I might as well...
Does this serve as an acceptable solution?
def supersum(sequence, start=0):
result = type(start)()
for item in sequence:
On 06/07/2013 21:10, Rotwang wrote:
[...]
It's not quite clear to me what the OP's intentions are in the general
case, but calling supersum(item, start) seems odd - for example, is the
following desirable?
supersum([[1], [2], [3]], 4)
22
I would have thought that the correct answer would
On 06/07/2013 21:11, Stefan Behnel wrote:
Rotwang, 06.07.2013 21:51:
On 06/07/2013 20:38, Terry Reedy wrote:
rms has crippling RSI (anonymous, as quoted by Skip).
[...]
Let us try Google. Type in RSI and it offers 'RSI medications' as a
choice. Sound good, as it will eliminate all
On 05/07/2013 02:24, Steven D'Aprano wrote:
On Thu, 04 Jul 2013 17:54:20 +0100, Rotwang wrote:
[...]
Anyway, none of the calculations that has been given takes into account
the fact that names can be /less/ than one million characters long.
Not in *my* code they don't!!!
*wink
Sorry to be OT, but this is sending my pedantry glands haywire:
On 04/07/2013 08:06, Dave Angel wrote:
On 07/04/2013 01:32 AM, Steven D'Aprano wrote:
SNIP
Well, if I ever have more than 63,000,000 variables[1] in a function,
I'll keep that in mind.
SNIP
[1] Based on
On 25/06/2013 23:57, Chris Angelico wrote:
On Wed, Jun 26, 2013 at 8:38 AM, Mark Janssen dreamingforw...@gmail.com wrote:
Combining integers with sets I can make
a Rational class and have infinite-precision arithmetic, for example.
Combining two integers lets you make a Rational. Python
On 24/06/2013 07:31, Steven D'Aprano wrote:
On Mon, 24 Jun 2013 02:53:06 +0100, Rotwang wrote:
On 23/06/2013 18:29, Steven D'Aprano wrote:
On Sat, 22 Jun 2013 23:40:53 -0600, Ian Kelly wrote:
[...]
Can you elaborate or provide a link? I'm curious to know what other
reason there could
On 23/06/2013 18:29, Steven D'Aprano wrote:
On Sat, 22 Jun 2013 23:40:53 -0600, Ian Kelly wrote:
[...]
Can you elaborate or provide a link? I'm curious to know what other
reason there could be for magic methods to behave differently from
normal methods in this regard.
It's an efficiency
On 22/06/2013 03:01, I wrote:
On 22/06/2013 02:15, Rick Johnson wrote:
[...]
This is what should happen:
py def foo(arg=[]):
... arg.append(1)
... print(arg)
...
py foo()
[1]
py foo()
[1]
py foo()
[1]
Yes, Yes, YES! That is intuitive!
On 22/06/2013 19:49, Rick Johnson wrote:
On Saturday, June 22, 2013 12:19:31 PM UTC-5, Rotwang wrote:
On 22/06/2013 02:15, Rick Johnson wrote:
IS ALL THIS REGISTERING YET? DO YOU UNDERSTAND?
No, I don't. These two special cases are not sufficient
for me to determine what semantics you
On 21/06/2013 18:01, Rick Johnson wrote:
[stuff]
It isn't clear to me from your posts what exactly you're proposing as an
alternative to the way Python's default argument binding works. In your
version of Python, what exactly would happen when I passed a mutable
argument as a default value
On 21/06/2013 19:26, Rick Johnson wrote:
On Friday, June 21, 2013 12:47:56 PM UTC-5, Rotwang wrote:
It isn't clear to me from your posts what exactly you're
proposing as an alternative to the way Python's default
argument binding works. In your version of Python, what
exactly would happen when
On 22/06/2013 02:15, Rick Johnson wrote:
On Friday, June 21, 2013 6:40:51 PM UTC-5, Rotwang wrote:
On 21/06/2013 19:26, Rick Johnson wrote:
[...]
I didn't ask what alternative methods of handling default
argument binding exist (I can think of several, but none
of them strikes me as preferable
On 22/06/2013 03:18, Chris Angelico wrote:
On Sat, Jun 22, 2013 at 12:01 PM, Rotwang sg...@hotmail.co.uk wrote:
class hashablelist(list):
... def __hash__(self):
... return hash(tuple(self))
There's a vulnerability in that definition:
a=hashablelist((1,[],3))
a
[1, [], 3
On 13/05/2013 00:40, Ian Kelly wrote:
On Sun, May 12, 2013 at 5:23 PM, Mr. Joe titani...@gmail.com wrote:
I seem to stumble upon a situation where != operator misbehaves in
python2.x. Not sure if it's my misunderstanding or a bug in python
implementation. Here's a demo code to reproduce the
On 15/04/2013 22:13, Dave Angel wrote:
On 04/15/2013 01:43 PM, Antoon Pardon wrote:
[...]
I had gotten my hopes up after reading this but then I tried:
$ python3
Python 3.2.3 (default, Feb 20 2013, 17:02:41)
[GCC 4.7.2] on linux2
Type help, copyright, credits or license for more information.
On 15/04/2013 08:03, Steven D'Aprano wrote:
On Mon, 15 Apr 2013 03:19:43 +0100, Rotwang wrote:
[...]
(Sorry for linking to Google Groups. Does anyone know of a better c.l.p.
web archive?)
The canonical (although possibly not the best) archive for c.l.p. is the
python-list mailing list
On 15/04/2013 23:32, Chris Angelico wrote:
On Tue, Apr 16, 2013 at 8:12 AM, Rotwang sg...@hotmail.co.uk wrote:
Traceback (most recent call last):
File pyshell#2, line 1, in module
class C(type(lambda: None)):
TypeError: type 'function' is not an acceptable base type
and I don't think
On 15/04/2013 02:14, Steven D'Aprano wrote:
On Sun, 14 Apr 2013 17:44:28 -0700, Mark Janssen wrote:
On Sun, Apr 14, 2013 at 5:29 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Sun, 14 Apr 2013 12:06:12 -0700, Mark Janssen wrote:
cleaned=''
for c in myStringNumber:
if
On 04/04/2013 14:49, Jason Swails wrote:
I've added some comments about the code in question as well...
On Wed, Apr 3, 2013 at 11:45 PM, teslafreque...@aol.com
mailto:teslafreque...@aol.com wrote:
Hi, I am working with Tkinter, and I have set up some simple code to
run:
import
On 04/04/2013 20:00, Jason Swails wrote:
On Thu, Apr 4, 2013 at 1:30 PM, Rotwang sg...@hotmail.co.uk
mailto:sg...@hotmail.co.uk wrote:
[...]
I don't know whether this applies to the OP's code, but I can think
of at least one reason why one would want both import module and
from
On 03/04/2013 02:05, Rotwang wrote:
[...]
After thinking about it for a while I've come up with the following
abomination:
import inspect
def sigwrapper(sig):
if not isinstance(sig, inspect.Signature):
sig = inspect.signature(sig)
def wrapper(f):
ps = 'args = []\n\t\t'
ks
On 03/04/2013 05:15, Steven D'Aprano wrote:
On Wed, 03 Apr 2013 02:05:31 +0100, Rotwang wrote:
Hi all,
Here's a Python problem I've come up against and my crappy solution.
Hopefully someone here can suggest something better. I want to decorate
a bunch of functions with different signatures
On 04/04/2013 02:18, Michele Simionato wrote:
On Wednesday, April 3, 2013 3:05:31 AM UTC+2, Rotwang wrote:
After thinking about it for a while I've come up with the following
abomination
Alas, there is actually no good way to implement this feature in pure
Python without abominations
Hi all,
Here's a Python problem I've come up against and my crappy solution.
Hopefully someone here can suggest something better. I want to decorate
a bunch of functions with different signatures; for example, I might
want to add some keyword-only arguments to all functions that return
On 18/03/2013 15:50, Steven D'Aprano wrote:
[...]
Gnumeric is Linux-only
No it isn't. I use it on Windows 7 with no problem.
--
I have made a thing that superficially resembles music:
http://soundcloud.com/eroneity/we-berated-our-own-crapiness
--
On 26/02/2013 12:54, Steven D'Aprano wrote:
One week ago, JoePie91 wrote a blog post challenging the Python
community and the state of Python documentation, titled:
The Python documentation is bad, and you should feel bad.
On 20/02/2013 11:50, Steven D'Aprano wrote:
[...alternatives to Google...]
Or if your ISP provides Usenet access, you can use a News client to read it
via comp.lang.python, or gmane.comp.python.general.
And if it doesn't, you can get free Usenet access that includes most of
the text-only
On 20/02/2013 03:53, Barry W Brown wrote:
[...]
Homer Simpson put it accurately last night. I used to be with it when
I was younger. But it moved and now what I am with is no longer it.
Sorry to be pedantic, but the quote you're thinking of is from Abe Simpson:
Hi all,
the other day I 2to3'ed some code and found it ran much slower in 3.3.0
than 2.7.2. I fixed the problem but in the process of trying to diagnose
it I've stumbled upon something weird that I hope someone here can
explain to me. In what follows I'm using Python 2.7.2 on 64-bit Windows
On 11/01/2013 20:16, Ian Kelly wrote:
On Fri, Jan 11, 2013 at 12:03 PM, Rotwang sg...@hotmail.co.uk wrote:
Hi all,
the other day I 2to3'ed some code and found it ran much slower in 3.3.0 than
2.7.2. I fixed the problem but in the process of trying to diagnose it I've
stumbled upon something
On 06/12/2012 08:49, Bruno Dupuis wrote:
On Thu, Dec 06, 2012 at 04:32:34AM +, Steven D'Aprano wrote:
On Thu, 06 Dec 2012 03:22:53 +, Rotwang wrote:
On 06/12/2012 00:19, Bruno Dupuis wrote:
[...]
Another advice: never ever
except XXXError:
pass
at least log, or count
On 06/12/2012 04:32, Steven D'Aprano wrote:
On Thu, 06 Dec 2012 03:22:53 +, Rotwang wrote:
[...]
Is there a problem with either of the above? If so, what should I do
instead?
They're fine.
Never, ever say that people should never, ever do something.
*cough*
Thanks.
--
I have made
On 06/12/2012 00:19, Bruno Dupuis wrote:
[...]
Another advice: never ever
except XXXError:
pass
at least log, or count, or warn, or anything, but don't pass.
Really? I've used that kind of thing several times in my code. For
example, there's a point where I have a list of strings and
On 10/08/2012 10:59, Peter Otten wrote:
[...]
If you have understood the above here's a little brain teaser:
a = ([1,2,3],)
a[0] += [4, 5]
Traceback (most recent call last):
File stdin, line 1, in module
TypeError: 'tuple' object does not support item assignment
a[0]
What are the
On 06/08/2012 00:46, PeterSo wrote:
I am just starting to learn Python, and I like to use the editor
instead of the interactive shell. So I wrote the following little
program in IDLE
# calculating the mean
data1=[49, 66, 24, 98, 37, 64, 98, 27, 56, 93, 68, 78, 22, 25, 11]
def mean(data):
On 06/08/2012 02:01, Matthew Barnett wrote:
On 06/08/2012 01:58, MRAB wrote:
On 06/08/2012 01:09, Rotwang wrote:
On 06/08/2012 00:46, PeterSo wrote:
I am just starting to learn Python, and I like to use the editor
instead of the interactive shell. So I wrote the following little
program
On 21/07/2012 19:16, Rick Johnson wrote:
[...]
It's due to the new Google Groups interface. They started forcing everyone to
use the new buggy version about a week ago EVEN THOUGH the old interface is
just fine.
I disagree - the old interface was dreadful and needed fixing.
The new one is
On 12/07/2012 04:59, Steven D'Aprano wrote:
On Wed, 11 Jul 2012 08:41:57 +0200, Daniel Fetchinson wrote:
funcs = [ lambda x: x**i for i in range( 5 ) ]
Here's another solution:
from functools import partial
funcs = [partial(lambda i, x: x**i, i) for i in range(5)]
Notice that the
On 07/07/2012 19:26, Ask Solem wrote:
===
Celery 3.0 (Chiastic Slide) Released!
===
Does this have anything to do with the Autechre album?
--
I have made a thing that superficially resembles music:
On 24/06/2012 00:17, Steven D'Aprano wrote:
On Sat, 23 Jun 2012 19:14:43 +0100, Rotwang wrote:
The problem is that if the object was
pickled by the module run as a script and then unpickled by the imported
module, the unpickler looks in __main__ rather than mymodule for the
object's class
Hi all, I have a module that saves and loads data using cPickle, and
I've encountered a problem. Sometimes I want to import the module and
use it in the interactive Python interpreter, whereas sometimes I want
to run it as a script. But objects that have been pickled by running the
module as a
On 23/06/2012 17:13, Peter Otten wrote:
Rotwang wrote:
Hi all, I have a module that saves and loads data using cPickle, and
I've encountered a problem. Sometimes I want to import the module and
use it in the interactive Python interpreter, whereas sometimes I want
to run it as a script
On 23/06/2012 18:31, Dave Angel wrote:
On 06/23/2012 12:13 PM, Peter Otten wrote:
Rotwang wrote:
Hi all, I have a module that saves and loads data using cPickle, and
I've encountered a problem. Sometimes I want to import the module and
use it in the interactive Python interpreter, whereas
Hi all, I'm using Python 2.7.2 on Windows 7 and a module I've written is
acting strangely. I can reproduce the behaviour in question with the
following:
--- begin bugtest.py ---
import threading, Tkinter, os, pickle
class savethread(threading.Thread):
def __init__(self, value):
1 - 100 of 127 matches
Mail list logo