Re: A difficulty with lists

2012-08-15 Thread Terry Reedy
-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

Re: [ANNC] pybotwar-0.8

2012-08-16 Thread Terry Reedy
ntext comments are harder to understand. I mostly do not read them. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: How do I display unicode value stored in a string variable using ord()

2012-08-16 Thread Terry Reedy
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

Re: Crashes always on Windows 7

2012-08-17 Thread Terry Reedy
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

Re: Crashes always on Windows 7

2012-08-18 Thread Terry Reedy
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

Re: How do I display unicode value stored in a string variable using ord()

2012-08-18 Thread Terry Reedy
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

Re: How do I display unicode value stored in a string variable using ord()

2012-08-18 Thread Terry Reedy
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

Re: How do I display unicode value stored in a string variable using ord()

2012-08-19 Thread Terry Reedy
. 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

Re: How do I display unicode value stored in a string variable using ord()

2012-08-19 Thread Terry Reedy
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

Re: New internal string format in 3.3

2012-08-19 Thread Terry Reedy
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

Re: New internal string format in 3.3

2012-08-19 Thread Terry Reedy
* 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

Re: Branch and Bound Algorithm / Module for Python?

2012-08-19 Thread Terry Reedy
. 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

Re: How do I display unicode value stored in a string variable using ord()

2012-08-19 Thread Terry Reedy
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

Re: How do I display unicode value stored in a string variable using ord()

2012-08-19 Thread Terry Reedy
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

Re: How do I display unicode value stored in a string variable using ord()

2012-08-19 Thread Terry Reedy
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

Re: unittest - sort cases to be run

2012-08-21 Thread Terry Reedy
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

Re: asking

2012-08-21 Thread Terry Reedy
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

Re: something about split()???

2012-08-21 Thread Terry Reedy
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

Filter versus comprehension (was Re: something about split()???)

2012-08-22 Thread Terry Reedy
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.

Re: Objects in Python

2012-08-22 Thread Terry Reedy
'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.

Re: help me debug my "word capitalizer" script

2012-08-22 Thread Terry Reedy
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 = '

Re: Objects in Python

2012-08-23 Thread Terry Reedy
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

Re: Unittest - testing for filenames and filesize

2012-08-23 Thread Terry Reedy
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

Re: Filter versus comprehension (was Re: something about split()???)

2012-08-24 Thread Terry Reedy
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

Re: Filter versus comprehension (was Re: something about split()???)

2012-08-24 Thread Terry Reedy
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

Re: Flexible string representation, unicode, typography, ...

2012-08-25 Thread Terry Reedy
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

Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting?

2012-08-25 Thread Terry Reedy
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

Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting?

2012-08-25 Thread Terry Reedy
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

Re: How to program test(expr) ?

2012-08-29 Thread Terry Reedy
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

Re: Basic Question. Deploy new Master/Slave (M/S) datastore

2012-08-30 Thread Terry Reedy
king above Deploying Your New ... . -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Beginners question

2012-08-30 Thread Terry Reedy
gt;> type(1) -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Flexible string representation, unicode, typography, ...

2012-08-30 Thread Terry Reedy
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

Re: Accessing AST at runtime

2012-09-01 Thread Terry Reedy
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

Re: [2.5.1] Read each line from txt file, replace, and save?

2012-09-02 Thread Terry Reedy
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

Re: Changing a Value in List of lists

2012-09-02 Thread Terry Reedy
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

Re: newbie ``print`` question

2012-09-02 Thread Terry Reedy
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

Re: Flexible string representation, unicode, typography, ...

2012-09-02 Thread Terry Reedy
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

Re: newbie ``print`` question

2012-09-02 Thread Terry Reedy
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

Re: Flexible string representation, unicode, typography, ...

2012-09-02 Thread Terry Reedy
\u or \U). The consequences fall under the 'consenting adults' policy. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Flexible string representation, unicode, typography, ...

2012-09-03 Thread Terry Reedy
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

Re: Comparing strings from the back?

2012-09-03 Thread Terry Reedy
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

Re: The opener parameter of Python 3 open() built-in

2012-09-04 Thread Terry Reedy
from os.open -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: C Python: Running Python code within function scope

2012-09-04 Thread Terry Reedy
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

Re: python docs search for 'print'

2012-09-04 Thread Terry Reedy
cially a common one like print, brings in lots of junk. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: python docs search for 'print'

2012-09-04 Thread Terry Reedy
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

Re: The opener parameter of Python 3 open() built-in

2012-09-04 Thread Terry Reedy
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

Re: python docs search for 'print'

2012-09-04 Thread Terry Reedy
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

Re: python docs search for 'print'

2012-09-05 Thread Terry Reedy
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

Re: is implemented with id ?

2012-09-05 Thread Terry Reedy
= 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

Re: is implemented with id ?

2012-09-05 Thread Terry Reedy
does 0 have an address? -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: python docs search for 'print'

2012-09-05 Thread Terry Reedy
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

Re: A Python class

2012-09-06 Thread Terry Reedy
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

Re: Is there a way to configure IDLE to use spaces instead of tabs for indenting?

2012-09-06 Thread Terry Reedy
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

Re: python docs search for 'print'

2012-09-06 Thread Terry Reedy
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

Re: How to print something only if it exists?

2012-09-06 Thread Terry Reedy
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

Re: Bitshifts and "And" vs Floor-division and Modular

2012-09-06 Thread Terry Reedy
u in the context. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: os.stat() distorts filenames that end with period (nt.stat())

2012-09-06 Thread Terry Reedy
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

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Terry Reedy
example formats. An example for ISO might be a good one. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Raw Data in NLTK

2012-09-07 Thread Terry Reedy
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

Re: Is there any difference between print 3 and print '3' in Python ?

2012-09-10 Thread Terry Reedy
or more information. >>> import __future__ >>> x = 3 >>> y = '3' >>> print(x) 3 >>> print(y) 3 >>> >>> type(x) >>> type(y) >>> z = '%i' % (3) >>> type(z) >>>

Re: Compile python code into a dll

2012-09-10 Thread Terry Reedy
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

Re: Standard Asynchronous Python

2012-09-10 Thread Terry Reedy
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

Re: Comparing strings from the back?

2012-09-11 Thread Terry Reedy
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

Re: a python license problem?

2012-09-11 Thread Terry Reedy
#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

Re: Single leading dash in member variable names?

2012-09-11 Thread Terry Reedy
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

Re: avoid the redefinition of a function

2012-09-12 Thread Terry Reedy
ay that should have made it fail, but it didn't.) -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: forked processes and testing

2012-09-12 Thread Terry Reedy
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

Re: using text file to get ip address from hostname

2012-09-12 Thread Terry Reedy
So your top level structure is... for line in open(): -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: pythonOCC examples doesn't work?

2012-09-12 Thread Terry Reedy
. 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

Re: Some questions about atexit

2012-09-12 Thread Terry Reedy
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 --

Re: datetime

2012-09-13 Thread Terry 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

Re: datetime

2012-09-13 Thread Terry Reedy
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

Re: Least-lossy string.encode to us-ascii?

2012-09-13 Thread Terry Reedy
' 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

Re: Decorators not worth the effort

2012-09-14 Thread Terry Reedy
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

Re: Decorators not worth the effort

2012-09-14 Thread Terry Reedy
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). --

Re: Decorators not worth the effort

2012-09-14 Thread Terry Reedy
ad of decorator syntax. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Least-lossy string.encode to us-ascii?

2012-09-14 Thread Terry Reedy
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

Re: Decorators not worth the effort

2012-09-14 Thread Terry Reedy
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

Re: Least-lossy string.encode to us-ascii?

2012-09-14 Thread Terry Reedy
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. {: '

Re: Obnoxious postings from Google Groups

2012-09-16 Thread Terry Reedy
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

Re: how to use property?

2012-09-17 Thread Terry Reedy
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

Re: Docstring parsing and formatting

2012-09-17 Thread Terry Reedy
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

Re: 'indent'ing Python in windows bat

2012-09-17 Thread Terry Reedy
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

Re: reportlab and python 3

2012-09-18 Thread Terry Reedy
. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: User defined lexical scoping... can I do this?

2012-09-18 Thread Terry Reedy
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

Re: 'indent'ing Python in windows bat

2012-09-19 Thread Terry Reedy
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

Re: sum works in sequences (Python 3)

2012-09-19 Thread Terry Reedy
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

Re: [Q] How to exec code object with local variables specified?

2012-09-20 Thread Terry Reedy
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

Re: How to limit CPU usage in Python

2012-09-20 Thread Terry Reedy
. 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

Re: How to limit CPU usage in Python

2012-09-20 Thread Terry Reedy
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

Re: Fool Python class with imaginary members (serious guru stuff inside)

2012-09-20 Thread Terry Reedy
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

Re: Python 3.3 and .pyo files

2012-09-21 Thread Terry Reedy
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

Re: Python 3.3 and .pyo files

2012-09-22 Thread Terry Reedy
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

Re: Invalid identifier claimed to be valid by docs (methinks)

2012-09-23 Thread Terry Reedy
. 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

Re: Pass numeric arrays from C extensions to Python

2012-09-23 Thread Terry Reedy
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

Re: Does python have built command for package skeleton creation?

2012-09-23 Thread Terry 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

Re: Who's laughing at my responses, and who's not?

2012-09-24 Thread Terry Reedy
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

Re: which a is used?

2012-09-24 Thread Terry Reedy
necessary, learn to wait a few minutes before hitting send. -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Who's laughing at my responses, and who's not?

2012-09-24 Thread Terry Reedy
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

Re: data attributes override method attributes?

2012-09-25 Thread Terry Reedy
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:

<    1   2   3   4   5   6   7   8   9   10   >