e many others, but frankly I don't think there is a "best of
breed" that stands far ahead of the rest.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
y reasonable code like this?
tmp = obj.member
x = tmp.another_member
> So the first method "detects" that we only need a simple value and
> returns that.
Fortunately that is impossible without nasty bytecode or AST hacks. Thank
the stars that Python doesn't allow anything as bad
are stuck with it nearly forever, or
at least for many years. So better to not add it than to be stuck with a
bad feature.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ter name='junk'>
py> open('junk', 'wb', buffering=0)
<_io.FileIO name='junk' mode='wb'>
The open() function now can return three (or more?) types instead of
having a single built-in type handle all cases.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
I believe that is a bug.
(Tested using Python 3.2.2 and Python 3.3.0a1)
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
8 -- that's FOURTEEN YEARS
since the last version of C++. And Java hasn't had a major feature update
since 2006.
For a programming language with a lot of corporate use, Python already
seems like it changes at the drop of a hat.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
nanosecond per number, it will take over 200 days.)
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 21 Sep 2012 13:26:32 -0400, Dave Angel wrote:
> On 09/21/2012 11:54 AM, Steven D'Aprano wrote:
>> Python's release cycle is actually closer to 18 months for minor
>> releases (3.2 -> 3.3, for example), and 10 years for major releases
>> (2.x -> 3.x
eful result.
Tongue-firmly-in-cheek-ly y'rs,
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
dral, if you're not a bot, you can go a long way towards
proving that by telling us what colour a purple elephant is.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
xtIndex, data], and accidently removing a node
> from that list).
Writing Fortran77 in Python!
:)
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 21 Sep 2012 15:23:41 -0700, Paul Rubin wrote:
> Steven D'Aprano writes:
>> Have I got this right? Is there a way to work out the gap between one
>> float and the next?
>
> Yes, 53-bit mantissa as people have mentioned. That tells you what ints
> can
all of malware?
> I know this is not a python question
But you asked anyway. Why don't you ask your car mechanic to fix your
plumbing, or go to the doctor to ask advice on how to cook pizza?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 22 Sep 2012 03:44:55 +1000, Chris Angelico wrote:
> On Sat, Sep 22, 2012 at 1:54 AM, Steven D'Aprano
> wrote:
>> But consider, C and C++ don't have minor releases *at all*. The last
>> versions of those two languages are C99 and C+98 -- that's FOURTEEN
&
shell), perl, gcc, Python.
Numerical work?
C, Fortran, numpy, scipy, mathematics.
Integration with Java frameworks and applications?
Java :-P
> (Please don't say Java, please don't say Java, please don't say... ;)
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ent to release OS/2 version 3, and
instead re-badged it as Windows NT. One might say there was a little bit
of bad blood over this, especially as IBM had good reason to think that
Microsoft had been spending IBM's money on NT.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
;ll
be hacked again, and again, and again.
Why are we discussing this? It has nothing to do with Python and is
completely off-topic for this list.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
dropped. Even if I'm misremembering, it is the case that the
Python 3.3 will find and run a .pyc file, but not a .pyo file. There's a
new candidate release of 3.3 due out over the next couple of days. If it
shows the same behaviour, it should be reported as a bug.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
any of thousands of different languages, your question is about Joomla.
Please ask it on a Joomla forum.
And when you are there, don't ask them to fix your Python bugs.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
the programmer's intention. I would go with:
[aclass() for aclass in MyClasses]
to emphasise that aclass is intended as a temporary loop variable and not
a long-lasting class definition.
So I guess I'm agreeing with Chris.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
nd (2) you
can probably redesign your code to avoid so many copies.
By the way, instead of dumping lots of irrelevant code on us, please take
the time to narrow your problem down to the smallest possible piece of
code. We're volunteers here, and you are not paying us to wade through
your
p with too many hits for Inkscape's
plugin system to be much help to me.
Thanks in advance.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
t
>> find anything in the documentation.
>
> Ya, they should really give a better way, but for now, enumerate works
> pretty well.
Define "a better way". What did you have in mind that would work better?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
not just store the value, instead of key, value and mapping?
value = calculate(key)
# later
process(value)
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
(Technically, they are in a third scope, the builtins, but that's
equivalent to being global.)
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ct to get the same result, for the simple and obvious reason that
arithmetic doesn't perform the same bounds checking as actual seeking and
indexing.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
n "see to EOF", say, None.
if p is None:
self.seek(0, 2)
although I don't know if I like that.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
for)
tens of thousands of users a day, and sqlite probably won't cut it. If
your web app is only used by you, then you might not care.
I think it is perfectly reasonable to assume a web app and a desktop app
might use different backends.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 25 Sep 2012 07:25:48 +0200, Thomas Rachel wrote:
> Am 25.09.2012 04:28 schrieb Steven D'Aprano:
>
>> By the way, the implementation of this is probably trivial in Python
>> 2.x. Untested:
>>
>> class MyFile(file):
>> @property
>>
vironment or language offers before reinventing the wheel with four
sides.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
community, but other
times you display an incoherent, rambling, aggressive style that
indicates that you are posting while high or drunk.
For your own sake, I suggest you stay off the Internet (including email
and usenet) unless sober.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 25 Sep 2012 11:16:40 +0100, Mark Lawrence wrote:
> On 25/09/2012 10:53, Chris Rebert wrote:
>
> [snip]
>
>> Well, the PSU might, except they emphatically do not exist...
>
> I know that they exist
You are delusional. The PSU certainly do not exist and it is a myth that
they
--
ht
value 20.
This instance attribute masks the method with the same name. We can see
that it is only hidden, not gone, by creating a new instance:
py> u = Test()
py> u.f
>
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
igs are at least as intelligent as dogs, and in their natural
state nowhere near as filthy as the stereotype of the pig in a sty, that
isn't as big an insult as it was intended.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
anguages are self-hosted, that is,
they are written in themselves, using some clever bootstrapping
techniques. C is neither the most powerful, the oldest, the best, or the
most fundamental language around.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
considered, it's a good trade.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ing Cobol. But Cobol only gets used for such boring stuff as
keeping your money safe in the bank. All the real innovation is in, well,
everything except Cobol. The imminent demise of Cobol is predicted for
1975^W 1980^W 1985^W 1990^W 1995^W 2005^W 2010^W 2015.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
r or trivially slower. The real saving is in
memory.
According to wxjmfauth, this has "killed" unicode. Judge for yourself his
credibility. The best I can determine, he believes this because Americans
aren't made to suffer for using mostly ASCII strings.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 26 Sep 2012 09:30:19 -0400, Kevin Walzer wrote:
> On 9/25/12 11:35 AM, Steven D'Aprano wrote:
>> IronPython in C#. Jython is written in Java. CLPython is written in
>> Lisp. Berp and HoPe are written in Haskell. Nuitka is written in C++.
>> Skulpt is writt
On Wed, 26 Sep 2012 10:01:11 +0100, Mark Lawrence wrote:
> You remind me of the opening to the song Plaistow Patricia by Ian Dury
> and the Blockheads.
While I always appreciate a good reference to Ian Dury, please stop
feeding D.H.'s ego by responding to his taunts.
--
Stev
his is why testing and reporting bugs to beta and rc versions is
so useful. You can often get them fixed quite quickly.)
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 27 Sep 2012 15:37:35 +1000, Chris Angelico wrote:
> On Thu, Sep 27, 2012 at 10:44 AM, Steven D'Aprano
> wrote:
>> While PyPy is still a work in progress, and is not anywhere near as
>> mature as (say) gcc or clang, it should be considered production-ready.
>
&
My google-foo is failing me. Is the #python chatroom on freenode archived
anywhere on the web?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 25 Sep 2012 09:15:00 +0100, Mark Lawrence wrote:
> Hi all,
>
> I though this might be of interest.
>
> http://www.ironfroggy.com/software/i-am-worried-about-the-future-of-
python
And a response:
http://data.geek.nz/python-is-doing-just-fine
--
Steven
--
http://
27;a')"
1 loops, best of 3: 65.6 usec per loop
[steve@ando ~]$ python3.2 -m timeit -s "s = '你'*1000" "s.replace('你', 'a')"
10 loops, best of 3: 2.79 usec per loop
[steve@ando ~]$ python3.3 -m timeit -s "s = '你'*1000&quo
run a disk check
on the file server and see if it comes up with any errors.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 27 Sep 2012 08:11:13 -0400, Devin Jeanpierre wrote:
> On Thu, Sep 27, 2012 at 2:13 AM, Steven D'Aprano
> wrote:
>> On Tue, 25 Sep 2012 09:15:00 +0100, Mark Lawrence wrote: And a
>> response:
>>
>> http://data.geek.nz/python-is-doing-just-fine
>
>
ewsgroup, comp.lang.python.
Otherwise you should send test posts to dedicated testing newsgroups like
alabama.test, alt.binaries.test or be.test.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 28 Sep 2012 05:08:24 -0700, rusi wrote:
> On Sep 27, 5:11 pm, Devin Jeanpierre wrote:
>> On Thu, Sep 27, 2012 at 2:13 AM, Steven D'Aprano
>>
>> wrote:
>> > On Tue, 25 Sep 2012 09:15:00 +0100, Mark Lawrence wrote: And a
>> > response:
>>
ve it or not, this appears FIRST on the
> sort!!!
I think you are mistaken.
py> sorted(['a', 'b', ''])
['a', 'b', '']
But really, I don't understand what problem you are trying to solve.
Perhaps if you explain the purpose of this, we can suggest a solution.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
rengths) without
turning it into fuel for the haters:
http://news.ycombinator.com/item?id=4567023
But when you give a blog post an inflammatory title like "I am worried
about the future of Python", what do you expect?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
bypasses steps 1) and 2) as a speed optimization. For the
common case where an instance's class directly defines a __len__ method,
that saves about 10-15% of the overhead of calling a special method,
compared to old-style classes.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 28 Sep 2012 21:25:35 -0600, Ian Kelly wrote:
> Mine is simpler and faster.
>
> r = re.compile("")
The OP doesn't say that you have to compile it, so just:
''
wins.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
in
File "", line 4, in __init__
TypeError: object.__init__() takes no parameters
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ng.
There is no difference between super(Class, self).__init__ and
super().__init__ except that the second version only works in Python 3.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 30 Sep 2012 04:31:48 +1000, Chris Angelico wrote:
> On Sun, Sep 30, 2012 at 3:17 AM, Steven D'Aprano
> wrote:
>> No. Only add code that works and that you need. Arbitrarily adding
>> calls to the superclasses "just in case" may not work:
>>
&g
r B, the MRO of C will change. That is not
actually the case as far as I can see.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 30 Sep 2012 00:08:03 -0600, Ian Kelly wrote:
> On Sat, Sep 29, 2012 at 10:40 PM, Steven D'Aprano
> wrote:
>> On Sat, 29 Sep 2012 17:51:29 -0400, Piet van Oostrum wrote:
>>
>>> It is not necesarily calling the parent class. It calls the
>>> initi
would only pay attention
to it:
* it is a TYPE error, not an import error;
* modules cannot be called as if they were a function
Does this solve your problem?
If not, please:
* show us the ACTUAL code you are using
* show us the full traceback, not just the error message
* and don't expect us to guess what you are doing
Thank you.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
would only pay attention
to it:
* it is a TYPE error, not an import error;
* modules cannot be called as if they were a function
Does this solve your problem?
If not, please:
* show us the ACTUAL code you are using
* show us the full traceback, not just the error message
* and don't expect us to guess what you are doing
Thank you.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
quite *nothing*, arguably there is a *tiny* bit of magic
in that Python bypasses the instance when looking up __dunder__ methods
as a speed optimization. But that's more like a sprinkle of fairy dust
than real magic.
[2] Or at least tricky and messy.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ID of a process, you may be able to see
that process' environment variables by reading the /proc//environ
virtual file, which is a NULL-delimited list of environment variables.
As usual, permissions apply. In general, you can read your own processes,
but not those of other users.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
I could be wrong.
Other than that, my advice is to check with a dedicated VPython mailing
list. Oh, and if you do find the solution, please consider reporting what
the solution is back here, for the benefit of the next person who runs
into this issue.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
I was hoping it was a common error that newbies encounter.
Trying to run Python 2.x code in 3.x? Yes, that's common. Trying to run
VPython? Not so much.
Good luck!
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
I was hoping it was a common error that newbies encounter.
Trying to run Python 2.x code in 3.x? Yes, that's common. Trying to run
VPython? Not so much.
Good luck!
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, 02 Oct 2012 18:11:20 -0700, 8 Dihedral wrote:
> Steven D'Aprano於 2012年10月3日星期三UTC+8上午8時57分20秒寫道:
>> Oh, I'm convinced that it's a bot.
>> The fact that Dihedral never responds to conversations about him/it is
>> a give away: nearly all
ehaviour(unittest.TestCase):
cls = D1
class TestD2CommonBehaviour(unittest.TestCase):
cls = D2
D1 and D2 specific tests remain the same.
Either way, each class gets tested for the full set of expected
functionality.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
;],
> ['aB', 'aB', 'bA', 'bA']]
>
> (the order of the results does not matter i.e. ['aA', 'aA', 'bB', 'bB']
> and ['aA', 'bB', 'aA', 'bB'] are considered the same)
gt;
> Well, I do. Like this:
>
> eval("tempmes." + language + " = row[1]")
setattr(tempmes, language, row[1])
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
lmost) emulate C++ namespaces:
http://code.activestate.com/recipes/578279/
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
r lookups in a dict or a
list are faster, I can't imagine why you think you can intuit what the
fastest way to retrieve the nearest neighbours would be.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
/peps/pep-0397/
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 04 Oct 2012 01:58:16 +, Steven D'Aprano wrote:
> adict: 24712
> alist: 23127324
[...]
> So in this situation, a list of lists uses about 100 times
> more memory than a dict, but look-ups are about 6% faster.
Correction: about 1000 times more memory. Sorry for the ty
ou have to write "self" in method declarations, why aren't they
complaining that Java isn't OO enough because ints are unboxed primitive
types?
[1] Emphasis on the *thing* part. Control structures aren't things in
that sense, they aren't values at all, they are actions that takes place
during execution.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
following it, you can
optimize *any* Python program to this:
# === start code ===
pass # this line is optional
# === end code ===
There you go. The most heavily optimized, fastest Python program in
existence. Sure, it has a few bugs, but boy is it fast!!!
--
Steven
--
http://mail.python.or
but since I don't know what you
think you are testing, I can't tell you whether you are doing it wrong or
not.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
rts of complications, it is usually better to have a
single module import both world and player and then combine them as
needed.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 04 Oct 2012 18:11:28 +0200, Thomas Rachel wrote:
> Am 04.10.2012 03:58 schrieb Steven D'Aprano:
>> alist = [[None]*2400 for i in range(2400)] from random import randrange
>> for i in range(1000):
>> x = randrange(2400)
>> y = randrange(2400)
&g
27;t even understand what step 1 means.
What's a Python-provided attribute, and how is it different from other
attributes?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
is so easy to avoid even this tiny risk, why not use
the try...except version and avoid it completely?
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
no attribute '__log__'
Because importing a module does not magically add new methods to classes.
Floats do not have a __log__ method, because they don't need one.
Importing math doesn't create such a method. Why would it? What is the
purpose of __log__? math.log doesn't need it.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
thon3.3 -m timeit -s "from decimal import Decimal"
> -s "x, y = Decimal(1001), Decimal(978)" "x+y-(x/y)**4"
10 loops, best of 3: 3.58 usec per loop
Without hardware support, Decimal will probably never be quite as fast as
binary floats, but its fast enough for all but the most demanding needs.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ip
for item in i:
yield item
Then call it like this:
py> list(mux(itertools.repeat("insert me"), range(5)))
['insert me', 0, 'insert me', 1, 'insert me', 2, 'insert me', 3, 'insert
me', 4]
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
that 'Facility', 'facility',
'FACILITY' and 'FaCiLiTy' are all different.
To have multiple values assigned to a key, use a list:
d['Facility'] = ['ham', 'spam', 'cheese', 'eggs']
d['Facility'].append('tomato')
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ance structures than for
> designating names as private.
Really? I tend to view name mangling as a waste of time, and complex
inheritance structures as something to avoid.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
>>
>> I don't know what the alternative is though.
>
> Components.
Composition. Delegation. Traits. Prototypes.
Inheritance is great, but it is not a solution to everything.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
.
If this were my code base, I would probably go for weighted_sample
without mentioning "random" in the name, the reasoning being that samples
are almost always random so explicitly saying so doesn't help much.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
using a a
hundred or so items, then some day you'll pass it a list with ten million
items and it will take 36 hours to complete.
I'm serious by the way. By my tests, increasing the number of items in
the list by a factor of ten increases the time taken by between 30 and
300 times.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
pect it to be named "choice".
And I wouldn't. But what do I care? I'm never going to use the code
you're talking about, so call it "sasquatch" if you like, it's no skin
off my nose.
:)
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
nt("hello");
time.sleep(2)'
hello
hello
hello
Traceback (most recent call last):
File "", line 3, in
KeyboardInterrupt
In this example I just hit the Enter key to insert a newline, and let the
shell deal with it. The ">" marks are part of the shell's
segmentation fault, which is a little less helpful than
I had expected.
This Stackoverflow question suggests that what I want is not possible in
vanilla Python:
http://stackoverflow.com/questions/11680356
but I'm a stubborn guy and I have not given up yet. Any suggestions?
good as Perl
which gives you "more freedom" (to write unreadable, unmaintainable code).
It simply isn't true that Python only gives you "only one way". The
acronym OOWTDI stands for *one obvious way to do it*.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
s have their own styles. The alternative isn't "many styles" but
"one style": an unstylish mess.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 14 Oct 2012 01:58:57 -0700, nepaul wrote:
> Something good framwork?
http://duckduckgo.com/?q=python+%2Bgame+frameworks
http://duckduckgo.com/?q=python+%2Bgame+libraries
http://blekko.com/ws/?q=python%20game%20framework
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
ng but attachments. The
vast volume of all these attachments are such that it is getting hard to
find ISPs that provide free access to binary newsgroups, but some still
do, and dedicated for-fee Usenet providers do too.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
You can now use u'' to create Unicode literals in both 2.x and 3.3 or
better. This is a feature only designed for porting code though: you
shouldn't use u'' in new code not intended for 2.x.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, 15 Oct 2012 19:25:38 +0530, Debashish Saha wrote:
> how to insert random error in a programming?
While editing the source code, have your cat walk across the keyboard.
I really think you need to explain your question better.
--
Steven
--
http://mail.python.org/mailman/listi
]
self.msg = msg
[1] If you're using Python 3, you can abbreviate the super call to:
super().__init__(self, msg, *args)
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
here has been a right-royal mess made of
the codecs system:
http://bugs.python.org/issue7475
So I expect that in Python 3.4 this will work:
"a piece of string".transform('rot13')
or this:
import codecs
codecs.encode('a piece of string', 'rot13')
but wh
On Tue, 16 Oct 2012 10:30:01 +0200, Peter Otten wrote:
> Steven D'Aprano wrote:
>
>> I'm working with the readline module, and I'm trying to set a key
>> combination to process the current command line by calling a known
>> function, *and* enter the command
801 - 900 of 15563 matches
Mail list logo