-1] don't modify u - but if you modify
nlist in place before doing that, such as by using +=, then it's still
pointing to u, and so u gets modified as well.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ntext comments are harder to understand. I mostly do not
read them.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
a = '…'
print(ord(a))
>>>
8230
Most things with unicode are easier in 3.x, and some are even better in
3.3. The current beta is good enough for most informal work. 3.3.0 will
be out in a month.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
known issue
that this does not work on Win 7 and it seems to be a bug in tcl/tk or
Windows that we have no control or responsibility for. Opening via a
normal directory works fine. If the above is *not* what you are doing,
please be exactly specific.
--
Terry Jan Reedy
--
http://mail.python.org
On 8/18/2012 2:18 AM, zmagi...@gmail.com wrote:
Open using File>Open on the Shell
The important question, as I said in my previous post, is *exactly* what
you do in the OpenFile dialog. Some things work, others do not.
And we (Python) have no control.
--
Terry Jan Reedy
--
h
t;>> timeit.timeit("('ab…' * 10).replace('…', 'œ…')")
> 1.2918679017971044
I do not see the point of changing both length and replacement. For me,
the time is about the same for either replacement. I do see about the
same slowdown ratio for 3.3 ve
On 8/18/2012 4:09 PM, Terry Reedy wrote:
print(timeit("c in a", "c = '…'; a = 'a'*1000+c"))
# .6 in 3.2.3, 1.2 in 3.3.0
This does not make sense to me and I will ask about it.
I did ask on pydef list and paraphrased responses include:
1. 'My syst
. Two people
on pydev claim that 3.3 is *faster* on their systems (one unspecified,
one OSX10.8).
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
any.
That makes access O(1) if there are none and O(log(k)), where k is the
number of extended chars in the string, if there are some.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
their sy
stems (OSX 10.8, and unspecified). To talk about speed sensibly, one
must run the full stringbench.py benchmark and real applications on
multiple Windows, *nix, and Mac systems. Python is not optimized for
your particular current computer.
--
Terry Jan Reedy
--
http://mail.python.org
* reason
why I tested it). Where the problems are coming from, I have no
idea.
If go can display all unicode chars on a Windows console, perhaps you
can do some research and find out how they do so. Then we could consider
copying it.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo
.
Now I want to solve them using Python.
Is there a module / methods that I can download or a ready-made
program text that you know about, where I can put my constraints and
minimization function in?
Search 'Python constraint solver' and you should find at least two programs.
--
Terry
independent of the 393 unicode change. The same test in
stringbench for bytes is twice as fast in 3.3 as 3.2, but only 2x, not
7x. In fact, it may have been the bytes/unicode comparison in 3.2 that
suggested that unicode case conversion of ascii chrs might be made faster.
The sum of the 3.3 unicode times is 109 versus 110 for 3.3 bytes and 125
for 3.2 unicode. This unweighted sum is not really fair since the raw
times vary by a factor of at least 100. But is does suggest that anyone
claiming that 3.3 unicode is overall 'slower' than 3.2 unicode has some
work to do.
There is also this. On my machine, the lowest bytes-time/unicode-time
for 3.3 is .71. This suggests that there is not a lot of fluff left in
the unicode code, and that not much is lost by the bytes to unicode
switch for strings.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
s that documents advertised as ISO-8859-1
actually be parsed with the Windows-1252 encoding.[1]"
Lots of fun. Too bad Microsoft won't push utf-8 so we can all
communicate text with much less chance of ambiguity.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 8/19/2012 6:42 PM, Chris Angelico wrote:
On Mon, Aug 20, 2012 at 3:34 AM, Terry Reedy wrote:
Python has often copied or borrowed, with adjustments. This time it is the
first.
I should have added 'that I know of' ;-)
Maybe it wasn't consciously borrowed, but whatever inn
lt-in ordering for strings."
s.addTest(BTest())
s.addTest(ATest())
TextTestRunner().run(ts)
I need BTest() to be run prior to ATest(), is there any
natural/beautiful way to achieve this? Thanks,
Rename it @BTest.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
bject at 0x03251098>
# multichar strings
>>> print(re.search('ab|ha]', 'defgha'))
None
>>> print(re.search('ab|ha', 'defgha'))
<_sre.SRE_Match object at 0x03251098>
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 8/21/2012 11:43 PM, mingqiang hu wrote:
why filter is bad when use lambda ?
Inefficient, not 'bad'. Because the equivalent comprehension or
generator expression does not require a function call.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 8/22/2012 3:30 AM, Mark Lawrence wrote:
On 22/08/2012 06:46, Terry Reedy wrote:
On 8/21/2012 11:43 PM, mingqiang hu wrote:
why filter is bad when use lambda ?
Inefficient, not 'bad'. Because the equivalent comprehension or
generator expression does not require a function call.
'information object'.) And
Python objects are more stfongly typed than in some other languages.
Names are only dynamically and indirectly typed when they are bound to
an object. Except for the few keyword names like None, True, etc, names
can be rebound to another object of another type.
pper(): s = s.capitalize()
>>> s
'Camelcase'
use "if not word[0].isupper:..."
or "if word[0].islower
This will still .capitalize() 'weirdWord' to 'Weirdword'.
If you do not want that, only change the first letter.
>>> s = '
k may give
a user access to other blocks if one is not careful. The other is that
the typing is in the code and compiler, but not in the runtime memory.
So text input can be read as code and a return jump address to the bytes
interpreted as code.
--
Terry Jan Reedy
--
http://mail.python.org/ma
in filenames:
f = open(filename, "w")
f.write("Some text\n")
f.close()
self.assertTrue(f.closed)
dir_names = set(os.listdir())
self.assertEqual(dir_names, filenames)
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 8/24/2012 10:44 AM, Ramchandra Apte wrote:
On Wednesday, 22 August 2012 22:13:04 UTC+5:30, Terry Reedy wrote:
>>> timeit.timeit("list(i for i in ranger if False)", "ranger=range(0)")
>>
0.91
>>> timeit.timeit("list(i for
cause their ISP doesn't offer a free server
Python lists are available on the free gmane mail-to-news server.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 8/25/2012 7:05 AM, Mark Lawrence wrote:
I thought Terry Reedy had shot down any claims about performance
overhead, and that the memory savings in many cases must be substantial
and therefore worthwhile. Or have I misread something?
No, you have correctly read what I and others have said
space in the appropriate place
deletes 4 space characters.
width, sometimes IDLE's "smart" indentation insists upon using width-8
tabs.
Only for the simulated interpreter. There is a tracker issue about
changing that but no consensus.
--
Terry Jan Reedy
--
http://mai
de in January of this year, so I
should have realized it's an ongoing issue.
There have also been a few posts this year on the idle-sig mail list.
There are only a few people working on IDLE and we have concentrated
this calendar year on fixing crashers, not semi-aesthetic issues.
--
Terry
ould 'process'
interactive input looking for (untested) re pattern something like
'test\((.*)\)'. Given a match, it prints the captured .* part and passes
it on to the Python interpreter, and prefixes output with '-->'.
(I have not yet looked at how to wri
king above Deploying Your New ... .
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
gt;> type(1)
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
the slowdown
mentioned in the PEP has mostly disappeared. The things that are still
slower are somewhat balanced by things that are faster.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
not be possible at all; maybe after the def statement is
processed by the Python interpreter the AST information is discarded.
Yes, it is.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
to use with and we have the following
simple code:
with open('input.txt', 'r') as inp, open('output.txt', 'w') as out:
for line in inp:
out.write(process(line))
where for your example, process(line) == 'just a test\n'
(you need exp
as it often destroys the context,
thanks.
In this particular case, OP could and should have trimmed off everything
other than the top post, as it stands alone. Then it would not have been
a top post ;-).
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
end=''); print(2, end='')
12
In 2.6 or 2.7, you can add
from __future__ import print_function
but I recommend using 3.2 or 3.3 unless you have a reason to use older
Python.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
d a length of 2 rather than 1 for
extended plane characters. 3.3 corrects this.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
e list (when needed).
Print was designed as a quick and easy way to put lines of text on the
screen. Then people asked for a way to use with with other streams,
hence the >> hack. Then people wanted ways to control the separator and
terminator. As that point, Guido realized that it neede
\u or \U). The consequences fall under the
'consenting adults' policy.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
identifiers, all the global, local,
and attribute names are present as ascii-only strings. Now multiply that
by some reasonable average, keeping in mind that __builtins__ alone has
148 names.
Former narrow build users gain less space but also gain the elimination
of buggy behavior.
--
Terry Jan
then kind, then the actual bytes in whatever chunks.
If the latter uses the C/system mem compare, that is faster than
anything coded in Python or even C.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
from os.open
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
the nonlocal names.
In any case, this complexity requires the presence of an outer function
when the code is compiled. There is no way to simulate it after the fact
by fiddling with just locals and globals when the compiled code is
exec'ed. Class statement, on the other hand, simply in
cially a common
one like print, brings in lots of junk.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 9/4/2012 6:32 PM, Terry Reedy wrote:
On Tue, Sep 4, 2012 at 1:58 PM, David Hoese wrote:
A friend made me aware of this:
When a python beginner (2.x) quick searches for "print" on
docs.python.org,
the print function doesn't even come up in the top 20 results.
In the Windo
On 9/4/2012 6:18 PM, Chris Angelico wrote:
On Wed, Sep 5, 2012 at 5:16 AM, Terry Reedy wrote:
io.open depends on a function the returns an open file descriptor. opener
exposes that dependency so it can be replaced.
I skimmed the bug report comments but didn't find an answer to this:
Wh
right place, you should contribute something to an
improvement. The current search performance is not a secret, so mere
complaints are useless.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 9/5/2012 1:22 AM, Ramchandra Apte wrote:
On Wednesday, 5 September 2012 09:35:43 UTC+5:30, Terry Reedy wrote:
If you do find the right place, you should contribute something to an
improvement. The current search performance is not a secret, so mere
complaints are useless.
I was
=
id(internal-tem1) == id(internal-tem2)
in order to ensure that the two objects exist simultaneously,
so that the id comparison is valid.
> and "a==True" should be automatically changed into memory comparison.
I have no idea what that means.
--
Terry Jan Reedy
--
http://ma
does 0
have an address?
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 9/5/2012 8:45 AM, Ramchandra Apte wrote:
On Wednesday, 5 September 2012 15:03:56 UTC+5:30, Terry Reedy wrote:
On 9/5/2012 1:22 AM, Ramchandra Apte wrote:
On Wednesday, 5 September 2012 09:35:43 UTC+5:30, Terry Reedy wrote:
If you do find the right place, you should contribute
ing-spring-2011/
If you wanted to do one of those, you might find a partner by asking
here. There might be a matchmaking site, but I could not find one.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
yway to actually exercise the definition. Hitting F5 to run is as easy
as putting the cursor at the end of the statement and hitting Enter. And
it runs multiple statements at once, not just one.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
x27;ll see what happens.
I opened a tracker issue for a different solution.
http://bugs.python.org/issue15871
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
t fails is the indexing operation. You can prevent that by slicing
rather than indexing: fld[1:2], fld[2:3]. These will give '' if there is
no fld[1], fld[2]. Whether or not this is sensible depends on what you
want the output to look like in these cases.
--
Terry Jan Reedy
--
ht
u in the context.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
rts of Windows will let you make names that
other parts do not recognize or regard as illegal. I ran into this some
years ago and there may be a discussion on the tracker, but I have
forgetten the details except that one of the 'parts' was Windows
Explorer. This *might* be what you are running into.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
example formats. An example for ISO might be a good one.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
guide me up.
from mypack import mydata
The important thing is that mydata have the proper format.
I would think that the nltk docs have instructions for and examples of
using personal data
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
or more information.
>>> import __future__
>>> x = 3
>>> y = '3'
>>> print(x)
3
>>> print(y)
3
>>>
>>> type(x)
>>> type(y)
>>> z = '%i' % (3)
>>> type(z)
>>>
ython into
existing applications, ". I think the latter is what you want to do.
http:cython.org
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
m interested
to know whether this is an appropriate use of a design PEP.
I think so.
> That's why I posted my old and flawed PEP text, rather than re-drafting
first.
I think you should do a bit of editing now, even if not a full redraft.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
nd
attributes. Since the dict lookup code needs hash values anyway, to find
slots with possible conflicts, I am sure it does not use the generic
comparison operators but starts with hash comparisons.
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
#x27; is the license for the Python
x.y.z software and documentation distributed by the Python Software
Foundation. Other implementations have their own copyright and licenses.
Code is copyrighted and licensed by the author or assignee.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ecific statement you want commented. The stdlib
routinely uses _names for internal implementation objects. __ugh is
perhaps never used.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ay that
should have made it fail, but it didn't.)
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
doing.
def run_in_fork(func)
def f(): pass
run_in_fork(f)
would let you test run_in_fork with simple test oriented functions and
separately test your real functions without the complication of the fork
process.
My 2 cents anyway.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo
So your top level structure is...
for line in open():
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
. One can put python-code-dir.pth in the
site-packages directories of both.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
rong place should be
corrected.
Also, it's not clear how atexit handlers interact with threading. Do
all handlers get called in the main thread? What if some other thread
registers a handler? Does it get called in that thread?
Don't know about this.
--
Terry Jan Reedy
--
o I'm hoping Python happens to
have the magic needed to do the job for me.
The above should be well under a second.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 9/13/2012 3:06 PM, readmax wrote:
Terry Reedy udel.edu> writes:
You did not specify *which* time to set, but ...
If you mean time.clock_shift(clk_id, shift_seconds), no.
time.clock_settime(clk_id, time.clock_gettime(clk_id) + delta_seconds)
I am talking about the system-wide cl
' would mean an effectively
lossless transliteration, which you could do with a dict.
{: 'o', : 'c,' (or pick something that would
never occur in normal text of the sort you are transmitting), ...}
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
return wrapper
return make_inner
@make_outer(2)
def f(x): print(x)
f('complex')
Is the gain of not repeating the wrapped function name twice in the
post-def wrapping call, and the gain of knowing the function will be
wrapped before reading the def, worth the pain of currying th
On 9/14/2012 5:28 AM, Jean-Michel Pichavant wrote:
Decorators are very popular so I kinda already know that the fault is mine. Now
to the reason why I have troubles writing them, I don't know. Every time I did
use decorators, I spent way too much time writing it (and debugging it).
--
ad of decorator syntax.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 9/14/2012 12:15 PM, wxjmfa...@gmail.com wrote:
PS Avoid Py3.3 :-)
pps Start using 3.3 as soon as possible. It has Python's first fully
portable non-buggy Unicode implementation. The second release candidate
is already out.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/lis
On 9/14/2012 4:29 PM, Terry Reedy wrote:
On 9/13/2012 10:12 PM, Cameron Simpson wrote:
On 13Sep2012 18:58, alex23 wrote:
| On Sep 14, 3:54 am, Jean-Michel Pichavant
| wrote:
| > I don't like decorators, I think they're not worth the mental effort.
|
| Because passing a function
On 9/13/2012 10:09 PM, Mark Tolonen wrote:
On Thursday, September 13, 2012 4:53:13 PM UTC-7, Tim Chase wrote:
On 09/13/12 18:36, Terry Reedy wrote:
'keep as much information as possible' would mean an effectively
lossless transliteration, which you could do with a dict.
{: '
ist is gmane.comp.python.general. There are 100s of
other gmane.comp.python.* groups.
I use Thunderbird on Win7 because it does both mail and news. I
previously used Outlook Express for same. There are others.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
vide a setter. If you do not like
"AttributeError: can't set attribute", provide one with a customized error.
But I think most of the data attributes in stdlib classes are straight
attributes.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 9/17/2012 10:03 PM, Ben Finney wrote:
Howdy all,
Where can I find a standard implementation of the docstring parsing and
splitting algorithm from PEP 257?
I presume there is something in the code behind help().
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
putting \n
followed by spaces or \t in the quoted string should work. It does for exec.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
I tried it, it does within a class -- in cpython at least.
That locals dict usually becomes the __dict__ of the class. But not to
be depended on indefinitely and across implmentations.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
t the outer quotes must be the double
quote characters recognized by windows.
C:\Programs\Python33>python -c "exec('print(1)\nif 1: print(2)')"
1
2
I did check that windows % interpolation of .bat args works within ''
quoted strings. Change tem.bat to
python -c "exec('print(%1)\nif 1: print(2)')"
and calling 'tem 3' prints
3
2
That said, if you have many multiline statements, putting them in a
separate file or files may be a good idea.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
onential place value notation that enables
more efficient addition and other operations. When not, other tricks are
needed to avoid so much copying that an inherently O(N) operation
balloons into an O(N*N) operation.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ion context. If you ran
def fn(): x = 1
class dummy:
fn()
dummy.x would not be defined and I presume you would not expect it to.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
. Some people recommend to use nice and cpulimit unix
tools, but those are external to python and I prefer a python solution.
I am working with Linux (Ubuntu 10.04).
Call the external tools with subprocess.open.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 9/20/2012 12:46 PM, Terry Reedy wrote:
On 9/20/2012 11:12 AM, Rolando Cañer Roblejo wrote:
Hi all,
Is it possible for me to put a limit in the amount of processor usage (%
CPU) that my current python script is using? Is there any module useful
for this task? I saw Resource module but I
int):
def __getattr__(self, name): return 'attribute'
y = AttrInt(3)
print(y, y.a)
###
3 attribute
If x.y returns an AttrInt, it will act like an int for most purposes,
while x.y.z will return whatever AttrInt.__getattr__ does and the
temporary AttrInt y disappears.
--
Terry Jan R
are
version-dependent implementation details. Being able to execute from
such caches without source present is also an implementation detail, and
for CPython, it gets secondary support at best. (This is a compromise
between full support and no support.)"
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
On 9/22/2012 9:21 AM, Steven D'Aprano wrote:
On Fri, 21 Sep 2012 22:46:08 -0400, Terry Reedy wrote:
On 9/21/2012 5:10 AM, Marco wrote:
I was trying to import a pyo module in Python 3.3, but Python does not
find it:
You appear to be trying to *run*, not *import* a .pyo module.
Mar
. However,
>>> exec("x\u00b9 = None")
...
x¹ = None
^
SyntaxError: invalid character in identifier
this is correct.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
exists an
official C library to read/create/edit such data, and you want to do
data analysis in python. The problem comes down to how to feed the
data into python.
I did some googling, but so far no luck. Can anyone help me? Thank
you very much.
I would look into numpy and scipy.
--
Terry Jan Reedy
atch your itch for
you, you're going to be waiting for a long, _long_ time.
Batteries are batteries, not flashlights, phone, radios, toys, clickers,
etc.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
I am not laughing. Looking back, some of your responses seem sensible. I
mostly skip over single word responses, and others that seems content
free, whether from you or others.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
necessary, learn to wait a few minutes before hitting send.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
t them, or if it's my netiquette.
A 1000 line post with a one line response is not polite. Context free
posts are disconcerting, but easier to ignore. Keep at least one
sentence of context and cut the potty mouth stuff.
--
Terry Jan Reedy
--
http://mail.python.org/mailman/listinfo/python-list
ns, so it's not inherently wrong,
The suggestion to Capitalize method names and prefix data names with '_'
are wrong with respect to the style guide.
but perhaps just needs a
comment about methods not usually being attached to the instance.
ChrisA
--
Terry Jan Reedy
--
http:
201 - 300 of 8120 matches
Mail list logo