On Tue, Feb 5, 2013 at 12:41 PM, Terry Reedy wrote:
> [comment about a double post]
>> He must have hit the send button too early by mistake.
>
> I used to do that occasionally. The reason is that the default position of
> [send] was on the left, under [File] and [Edit], and sometimes I did not
>
On Tue, Feb 5, 2013 at 3:59 PM, Grant Edwards wrote:
> On 2013-02-05, Neil Cerutti wrote:
>> On 2013-02-05, Walter Hurry wrote:
Sorry, I'm a Linux guy. I have no clue what that means.
>>>
>>> Hooray for common sense! Python is great, but it's silly to use
>>> Python (unless there is good r
On Thu, Feb 7, 2013 at 5:55 PM, Ian Kelly wrote:
> Whatever caching is being done by re.compile, that's still a 24%
> savings by moving the compile calls into the setup.
On the other hand, if you add an re.purge() call to the start of t1 to
clear the cache:
>>> t3 = Ti
On Thu, Feb 7, 2013 at 10:57 PM, rh wrote:
> On Thu, 7 Feb 2013 18:08:00 -0700
> Ian Kelly wrote:
>
>> Which is approximately 30 times slower, so clearly the regular
>> expression *is* being cached. I think what we're seeing here is that
>> the time needed
On Fri, Feb 8, 2013 at 4:43 AM, Steven D'Aprano
wrote:
> Ian Kelly wrote:
> Surely that depends on the size of the pattern, and the size of the data
> being worked on.
Natually.
> Compiling the pattern "s[ai]t" doesn't take that much work, it's only six
>
On Fri, Feb 8, 2013 at 12:58 PM, Rick Johnson
wrote:
> I'm a bit unnerved by the sum function. Summing a sequence only makes sense
> if the sequence in question contains /only/ numeric types. For that reason i
> decided to create a special type for holding Numerics. This will probably
> result
On Fri, Feb 8, 2013 at 5:49 PM, Rick Johnson
wrote:
> On Friday, February 8, 2013 6:05:54 PM UTC-6, Chris Angelico wrote:
>> The sum builtin works happily on any sequence of objects
>> that can be added together. It works as an excellent
>> flatten() method:
>>
>> >>> nested_list = [["q"], ["w","e
On Tue, Feb 12, 2013 at 8:01 PM, Rick Johnson
wrote:
> On Tuesday, February 12, 2013 12:01:45 PM UTC-6, Zero Piraeus wrote:
>
>> You could call them PyW00ts.
>
> +1 on the name
> -INFINITY on the execution
>
> Actually i am happy that DeAprano used the unintuitive tag now. Bad enough to
> use an
On Thu, Feb 14, 2013 at 10:03 AM, Philipp Hagemeister wrote:
> So any implementation has to choose one of the following:
>
> 1. Ignore invariants and postconditions of inherited classes - defeats
> the purpose.
> 2. Only respect definitions in classes and methods in the original
> definition, whic
On Thu, Feb 14, 2013 at 10:48 AM, Chris Hinsley wrote:
> Is a Python list as fast as a bytearray ? I didn't copy a C prog BTW !
>>> from timeit import Timer
>>> t1 = Timer("board[36] = board[20]; board[20] = ' '", "board =
>>> bytearray('RNBQKBNR
>>> p
On Thu, Feb 14, 2013 at 1:03 AM, Steven D'Aprano
wrote:
> E.g.:
>
> if x:
> pass
>
>
> Is that intended as "if slice(x, None, None)" with a missing colon, or
> "if x" with colon supplied?
That's not ambiguous, because the former is simply invalid syntax.
However, consider the following.
if 1
On Tue, Feb 12, 2013 at 10:48 AM, Rick Johnson
wrote:
> On Monday, February 11, 2013 11:55:19 PM UTC-6, Chris Angelico wrote:
>> On Tue, Feb 12, 2013 at 12:06 PM, 8 Dihedral wrote:
>> > A permanently mutated list is a tuple of constant objects.
>>
>> I nominate this line as "bemusing head-scra
On Mon, Feb 18, 2013 at 12:13 PM, John Immarino wrote:
> I coded a Python solution for Problem #14 on the Project Euler website. I was
> very surprised to find that it took 107 sec. to run even though it's a pretty
> simple program. I also coded an equivalent solution for the problem in the
>
On Mon, Feb 18, 2013 at 3:01 PM, Chris Angelico wrote:
> On Tue, Feb 19, 2013 at 8:54 AM, Ian Kelly wrote:
>> Well, I don't see anything that looks especially slow in that code,
>> but the algorithm that you're using is not very efficient. I rewrote
>> it using dy
On Tue, Feb 19, 2013 at 7:46 AM, Tim Daneliuk wrote:
> Are you sure you wouldn't like to share with the class? I'd be interested
> in seeing your approach...
Very well:
def collatz(n, memo):
if n not in memo:
if n % 2 == 0:
next_n = n // 2
else:
next_
On Mon, Feb 18, 2013 at 9:15 PM, Tim Roberts wrote:
> Chris Hinsley wrote:
>>
>>Is a Python list as fast as a bytearray ?
>
> Python does not actually have a native array type. Everything in your
> program that looked like an array was actually a list.
How do you mean?
>>> isinstance(bytearray
On Tue, Feb 19, 2013 at 1:50 PM, Morten Engvoldsen wrote:
> Here is my code:
> def calc_checkdigit(isbn):
> isbn = isbn.replace(".", "")
> check_digit = int(isbn[-1])
> isbn = isbn[:-1]
> if len(isbn) != 10:
>return False
> result = sum((10
On Tue, Feb 19, 2013 at 3:19 PM, Rex Macey wrote:
> I'm new to Python and only a hobbyist programmer. A long time ago I used
> Microsoft's Visual Basic which had a nice (graphical) facility for creating
> GUIs which was part of the development environment. I'm wondering if there's
> a utility
On Tue, Feb 19, 2013 at 3:59 PM, Morten Engvoldsen wrote:
> But can you tell me how could i implement below
>
> "If digits 5 and 6 of the account number are zeros, the check digit is
> calculated on the 7, 8, 9 and 10th digit of the account number."
>
> which means if account number is "8601.00.17
On Tue, Feb 19, 2013 at 5:23 PM, Alexander Blinne wrote:
> If changed into
>
> signed int n;
>
> there is a veeery long, perhaps infinite loop.
Yes, infinite. Here's the first such sequence encountered with a
signed 32-bit int.
[113383, 340150, 170075, 510226, 255113, 765340, 382670, 191335,
57
On Wed, Feb 20, 2013 at 7:21 AM, Tim Daneliuk wrote:
> Thanks. I was specifically curious about your use of dynamic programming.
> What about this algorithm makes it particularly an example of this? Is
> it your use of memoization or something other than this?
In retrospect, I was using the ter
On Thu, Feb 21, 2013 at 12:33 PM, Schizoid Man
wrote:
> Hi there,
>
> I run the following code in Python 3.3.0 (on a Windows 7 machine) and Python
> 2.7.3 on a Mac and I get two different results:
>
> result1 = []
> result2 = []
> for a in range(2,101):
>for b in range(2,101):
>result1
On Thu, Feb 21, 2013 at 2:26 PM, Piterrr wrote:
> I am a long time C sharp dev, just learning Python now due to job
> requirements. My initial impression is that Python has got to be the most
> ambiguous and vague language I have seen to date. I have major issues with
> the fact that white spac
On Thu, Feb 21, 2013 at 3:40 PM, wrote:
> I am nervous about using variables "out of the blue", without having to
> declare them. For example, when I write "i = 0" it is perfectly OK to Python
> without 'i' being declared earlier. How do I know that I haven't used this
> variable earlier and I
On Thu, Feb 21, 2013 at 4:41 PM, Schizoid Man wrote:
> So how is operator.pow() different from just pow()?
math.pow() is a wrapper around the C library function.
** and operator.pow() are the same thing; the latter is just a
function version of the former.
The built-in pow() is a mutant version
On Fri, Feb 22, 2013 at 11:27 AM, Morten Engvoldsen
wrote:
> Hi,
> Just to make it more clear: I am looking for how to generate the weight in :
> 1, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7.. format for any
> length of number instead of
>
> weights = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2, 1]
On Fri, Feb 22, 2013 at 4:41 AM, Chris Angelico wrote:
> That's not artificial intelligence, though. It's artificial program
> generation based on a known target output. The "Fitness" calculation
> is based on a specific target string. This is fine for devising a
> program that will produce the en
On Fri, Feb 22, 2013 at 5:09 AM, Andrew Robinson
wrote:
> On 02/22/2013 07:21 PM, Ian Kelly wrote:
>> I am curious about how he deals with infinite loops in the generated
>> programs. Probably he just kills the threads after they pass some
>> time threshold?
>
> I&
On Fri, Feb 22, 2013 at 6:04 AM, Andrew Robinson
wrote:
> It's still surprising that even C# would allow a killing of threads.
>
> Resources can be allocated by a thread and tied up was one of the comments
> made on the site I linked; so those resources could be permanently tied up
> until process
On Fri, Feb 22, 2013 at 2:37 PM, wrote:
> There seems to be a "heated" argument about Python's apparently intentional
> ambiguity in conditional statements. Specifically, the issue is, is it more
> appropriate to write (as an example)
>
> if (some statement):# short form
>
> rather
On Sat, Feb 23, 2013 at 11:44 AM, jmfauth wrote:
> Until you realize this:
>
> Py32:
>
timeit.timeit("'abc需'")
> 0.032749386495456466
sys.getsizeof('abc需')
> 42
>
> Py33:
>
timeit.timeit("'abc需'")
> 0.04104208536801017
sys.getsizeof('abc需')
> 50
>
> Very easy to explain
On Sun, Feb 24, 2013 at 10:48 AM, 7segment <7segm...@live.com> wrote:
> Hi!
>
> The subject is a segment of a sentence which I copied from Python's
> official homepage. In whole, it reads:
>
> "The urlopen() and urlretrieve() functions can cause arbitrarily long
> delays while waiting for a network
On Sun, Feb 24, 2013 at 6:10 PM, Andrew Robinson
wrote:
> I've read through the whole of the subject, and the answer is no, although I
> think allowing it in (::) is a *very* good idea, including as a replacement
> for range or xrange.
>
> s=1:2:3
> for i in s:
> for i in (1:2:3) :
Eww, no. I ca
On Mon, Feb 25, 2013 at 12:41 AM, Andrew Robinson
wrote:
>> Intuitively, it should result in an infinite loop starting at 0. But
>> ranges require a stop value for a very good reason -- it should not be
>> this easy to accidentally create an infinite for loop.
>
> ...
> and, besides, the same is
On Tue, Feb 26, 2013 at 9:34 AM, Colin J. Williams wrote:
> Perhaps it's becaoue (teild count) is a statement. Statements do not return
> a value.
yield is a bit of an odd duck in that it's both a statement and an
expression. Compare:
http://docs.python.org/3/reference/simple_stmts.html#the-yi
On Tue, Feb 26, 2013 at 9:27 AM, andrea crotti
wrote:
> So I was trying to use groupby (which I used in the past), but I
> noticed a very strange thing if using list on
> the result:
As stated in the docs:
"""
The returned group is itself an iterator that shares the underlying
iterable with grou
On Wed, Feb 27, 2013 at 1:51 AM, Marwan wrote:
> When I run the generated exe, I get errors about the functions not
> existing...
>
> TestPython.exe test Hello
> AttributeError: 'module' object has no attribute 'Hello'
> Cannot find function "Hello"
"test" is the name of a module in the standard
On Wed, Feb 27, 2013 at 3:24 PM, Terry Reedy wrote:
>> Py33
> timeit.repeat("{1:'abc需'}")
>> [0.2573893570572636, 0.24261832285651508, 0.24259548003601594]
>
> On my win system, I get a lower time for this:
> [0.16579443757208878, 0.1475787649924598, 0.14970205670637426]
>
>> Py323
>> timeit
On Thu, Feb 28, 2013 at 12:47 PM, The Night Tripper wrote:
> Hi there
> I'm being very dumb ... how can I simplify this fragment?
>
>
> if arglist:
> arglist.pop(0)
> if arglist:
> self.myparm1 = arglist.pop(0)
> if arglist:
>
On Fri, Mar 1, 2013 at 1:02 PM, timothy crosley
wrote:
> Thanks! Since it simply produces html it can integrate very cleanly with
> django, or
> Any other framework that allows returning raw html. To be more specific, in
> django withing a view function you can return a response object that con
On Sat, Mar 2, 2013 at 10:22 AM, Ian Kelly wrote:
> class Vector(list):
> def __new__(cls, *args):
> return super(Vector, cls).__new__(cls, args)
> def __init__(self, *args):
> super(Vector, self).__init__(args)
>
> The __new__ method here will re
On Sat, Mar 2, 2013 at 10:02 AM, gialloporpora wrote:
> Hi all,
> I would like to inherit from the list native class.
> really I expected that was possible to use native list method without
> redefining them, for example the __repr__ method.
>
> I don't know if i have made something wrong, this is
On Sat, Mar 2, 2013 at 10:40 AM, bvdp wrote:
> Every time I write a program with exception handling (and I suppose that
> includes just about every program I write!) I need to scratch my brain when I
> create try blocks.
>
> For example, I'm writing a little program do copy specific files to a U
On Sat, Mar 2, 2013 at 10:52 AM, Kwpolska wrote:
> IOError and OSError should cover all copy problems, I think.
And it may be worth pointing out here that as of Python 3.3, IOError
is just a synonym for OSError.
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, Mar 2, 2013 at 6:56 PM, Alex Gardner wrote:
> I am in the process of making a pong game in python using the pygame library.
> My current problem is that when I move the mouse, it turns off as soon as
> the mouse stops moving. The way I am doing this is by making the default
> cursor i
On Sun, Mar 3, 2013 at 3:09 PM, Alex Gardner wrote:
> if (0,0) <= paddle_pos <= (300,300):
This doesn't do what you think it does. Tuples are compared
lexicographically, not element-wise. So (250, 350) < (300, 300), but
(350, 250) > (300, 300).
> paddle_pos = pygame.mouse.get_pos(
On Mon, Mar 4, 2013 at 7:34 AM, Bryan Devaney wrote:
>> if character not in lettersGuessed:
>>
>> return True
>>
>> return False
>
> assuming a function is being used to pass each letter of the letters guessed
> inside a loop itself that only continues checking if true is returned
On Mon, Mar 4, 2013 at 8:07 AM, Bryan Devaney wrote:
> On Sunday, March 3, 2013 6:45:26 PM UTC, Kwpolska wrote:
>>
>> It is! How else could he type those two question marks and 10 double-quotes?
>>
>
> Onscreen Keyboard?
Or voice recognition, perhaps. We have no idea what the OP's actual
input
On Thu, Mar 7, 2013 at 4:22 AM, Wolfgang Maier
wrote:
> Well, it skips the costly len() call because your iter(Foo()) returns
> iter(range()) under the hood and list() uses that object's __len__() method.
Iterators do not generally have __len__ methods.
>>> len(iter(range(10)))
Traceback (most r
On Thu, Mar 7, 2013 at 9:20 AM, Christian Heimes wrote:
> Am 07.03.2013 17:00, schrieb Ian Kelly:
>> On Thu, Mar 7, 2013 at 4:22 AM, Wolfgang Maier
>> wrote:
>>> Well, it skips the costly len() call because your iter(Foo()) returns
>>> iter(range()) under the h
On Thu, Mar 7, 2013 at 1:04 PM, Νίκος Γκρ33κ wrote:
> Τη Πέμπτη, 7 Μαρτίου 2013 9:36:33 μ.μ. UTC+2, ο χρήστης Joel Goldstick έγραψε:
>
>> So, I see you fixed the problem. How?
>
> Apart from appearing ugly its not causing any more trouble(other than some
> issues that i have fixed), so i will j
On Thu, Mar 7, 2013 at 12:19 PM, Stefan Behnel wrote:
>> Didn't know about that, thanks. Presumably a proper iter(QuerySet())
>> object could implement __length_hint__ in an efficient manner rather
>> than by just calling the __len__ of the underlying QuerySet,
>
> And how exactly would it do tha
On Thu, Mar 7, 2013 at 3:13 PM, John Nagle wrote:
> On 3/7/2013 10:42 AM, John Nagle wrote:
>> On 3/7/2013 5:10 AM, Dave Angel wrote:
>>> On 03/07/2013 01:33 AM, John Nagle wrote:
Here's a traceback that's not helping:
>>>
>>> A bit more context would be helpful. Starting with Python ve
On Fri, Mar 8, 2013 at 12:19 PM, wrote:
> I dare anyone who wants to to mess with 'htmlpage' variable value's now!
>
> I made it unhackable i believe!
>
> I'am testing it myself 3 hours now and find it safe!
>
> Please feel free to try also!
Okay, done. I was still able to read your source file
On Fri, Mar 8, 2013 at 1:01 PM, Ian Kelly wrote:
> On Fri, Mar 8, 2013 at 12:19 PM, wrote:
>> I dare anyone who wants to to mess with 'htmlpage' variable value's now!
>>
>> I made it unhackable i believe!
>>
>> I'am testing it myself 3 hour
On Fri, Mar 8, 2013 at 1:28 PM, Skip Montanaro wrote:
> I've never really used itertools before. While trying to figure out
> how to break a list up into equal pieces, I came across the consume
> function in the examples here:
>
> http://docs.python.org/2/library/itertools.html
>
> It seems to me
On Fri, Mar 8, 2013 at 1:54 PM, wrote:
> Τη Παρασκευή, 8 Μαρτίου 2013 8:54:15 μ.μ. UTC+2, ο χρήστης Steven D'Aprano
> έγραψε:
>
>> >>> -c ''; rm -rf /; oops.py
>
>> Please don't tell the newbies to destroy their system, no matter how
>> tempting it might be.
>
> What that "-c ''" options i keep
On Fri, Mar 8, 2013 at 1:31 PM, Νίκος Γκρ33κ wrote:
> Thank you very much for pointing my flaws once again!
>
> I cant beleive how easy you hacked the webserver again and be able to read my
> cgi scripts source and write to cgi-bin too!
>
> I have added extra security by following some of your ad
On Sat, Mar 9, 2013 at 5:25 PM, Alex Gardner wrote:
> On Saturday, March 2, 2013 7:56:31 PM UTC-6, Alex Gardner wrote:
>> I am in the process of making a pong game in python using the pygame
>> library. My current problem is that when I move the mouse, it turns off as
>> soon as the mouse stops
On Sun, Mar 10, 2013 at 4:25 PM, Alex Gardner wrote:
> Now the cursor isn't moving at all!
>
> while True:
> for event in pygame.event.get():
> if event.type == QUIT:
> sys.exit()
>
> screen.blit(bpaddle, paddle_rect)
> # Draw the net
On Mon, Mar 11, 2013 at 11:00 AM, Alex Gardner wrote:
> I added the blank paddle and now the green one is just gone. I feel like
> such a newbie ><
>
>
> screen.blit(bpaddle, paddle_rect)
We're not psychic, so you'll need to post the current code if you want
any suggestions on how to fix it.
On Mon, Mar 11, 2013 at 11:33 AM, Alex Gardner wrote:
> My bad! http://pastebin.com/yuvpT7bH
You're still drawing the blank paddle in two different places. One of
those places is immediately after you draw the paddle, which undoes
the work you just did in drawing it. That's why you're not seei
On Mon, Mar 11, 2013 at 12:55 PM, Jaime Stuardo wrote:
> Hello…
>
> I have downloaded pyparsing-2.0.0 files. When I run “python setup.py
> install” I get this error:
>
> Traceback (most recent call last):
> File "setup.py", line 9, in
> from pyparsing import __version__ as pyparsing_versio
On Mon, Mar 11, 2013 at 2:43 PM, Alex Gardner wrote:
> I tried to append what you told me to. Now it appears that I have a syntax
> error! I checked my indentations and they look fine to me, but I get this
> error:
>
> paddle_pos = pygame.mouse.get_pos()
>
On Wed, Mar 13, 2013 at 12:40 PM, wrote:
> I want to write a fairly trivial database driven application, it will
> basically present a few columns from a database, allow the user to add
> and/or edit rows, recalculate the values in one column and write the
> data back to the database.
>
> I want
On Tue, Mar 12, 2013 at 5:33 PM, Alex Gardner wrote:
> Sorry but im back to square one. My paddle isn't showing up at all!
> http://pastebin.com/PB5L8Th0
paddle_rect.center = pygame.mouse.get_pos()
This updates the paddle position.
screen.blit(beeper, paddle_rect)
This draws the padd
On Thu, Mar 14, 2013 at 4:16 PM, Alex Gardner wrote:
> It's all working now with one exception. I just want to arrange the paddle
> to the right side. I managed to do just that, but it won't move freely
> vertically. I am not fully aware of the arguments of pygame.Rect().
I recommend you rea
On Fri, Mar 15, 2013 at 5:50 AM, wrote:
> I'm using wxGrid and finding it fairly straightforward but I can't see
> an easy way to set the alignment (left, centre, right) for a whole
> column.
>
> There's SetDefaultCellAlignment() which sets the default for the whole
> grid and there's SetCellAlig
On Tue, Mar 19, 2013 at 8:44 AM, Tim Chase
wrote:
> On 2013-03-19 14:07, Neil Cerutti wrote:
>> On 2013-03-18, Ana Dion?sio wrote:
>> > But I still get the error and I use Excel 2010.
>> >
>> > I'm trying to export data in a list to Excel
>>
>> xlrd: Library for developers to extract data from Mi
On Mar 21, 2013 1:35 PM, "leonardo selmi" wrote:
>
> hi all,
>
> i wrote the following code:
>
> def find(word, letter):
> index = 0
> while index < len(word):
> if word[index] == letter:
> return index
> index = index + 1
> return -1
>
More efficient:
def
On Mon, Mar 25, 2013 at 10:24 PM, Shiyao Ma wrote:
> HI.
> one thing confuses me.
> It is said in the pep3101 that "{}".format (x) will invoke the method
> x.__format__
> However, I looked at the src of python3 and found:
> in class str(object), the format simply contains a pass statement
> in cla
On Tue, Mar 26, 2013 at 4:51 AM, Shiyao Ma wrote:
> Thx for your reply.
> I am using pycharm and simply press "go to declaration" which directs me to
> a py file, containing the following code:
> def format(*args, **kwargs): # known special case of str.format
> """
> S.format(*args
On Thu, Mar 28, 2013 at 7:01 AM, Steven D'Aprano
wrote:
> Any string method that takes a starting offset requires the method to
> walk the string byte-by-byte. I've even seen languages put responsibility
> for dealing with that onto the programmer: the "start offset" is given in
> *bytes*, not cha
On Thu, Mar 28, 2013 at 8:38 AM, Chris Angelico wrote:
> PEP393 strings have two optimizations, or kinda three:
>
> 1a) ASCII-only strings
> 1b) Latin1-only strings
> 2) BMP-only strings
> 3) Everything else
>
> Options 1a and 1b are almost identical - I'm not sure what the detail
> is, but there'
On Thu, Mar 28, 2013 at 7:34 AM, jmfauth wrote:
> The flexible string representation takes the problem from the
> other side, it attempts to work with the characters by using
> their representations and it (can only) fails...
This is false. As I've pointed out to you before, the FSR does not
div
On Thu, Mar 28, 2013 at 8:37 PM, Steven D'Aprano
wrote:
>>> I also wonder why the implementation bothers keeping a UTF-8
>>> representation. That sounds like premature optimization to me. Surely
>>> you only need it when writing to a file with UTF-8 encoding? For most
>>> strings, that will never
On Fri, Mar 29, 2013 at 12:11 AM, Ian Kelly wrote:
> From the PEP:
>
> """
> A new function PyUnicode_AsUTF8 is provided to access the UTF-8
> representation. It is thus identical to the existing
> _PyUnicode_AsString, which is removed. The function will compu
On Sun, Mar 31, 2013 at 11:33 PM, rusi wrote:
>
> So I really wonder: Is python losing more by supporting SMP with
> performance hit on BMP?
I don't believe so. Although performance is undeniably worse for some
benchmarks, it is also better for some others. Nobody has yet
demonstrated an actual
On Tue, Apr 2, 2013 at 3:20 AM, jmfauth wrote:
> It is somehow funny to see, the FSR "fails" precisely
> on problems Unicode will solve/handle, eg normalization or
> sorting [3].
Neither of these problems have anything to do with the FSR. Can you
give us an example of normalization or sorting wh
On Wed, Apr 3, 2013 at 12:52 AM, Chris Angelico wrote:
> Hmm. I was about to say "Can you just do a quick collections.Counter()
> of the string widths in 3.3, as an easy way of seeing which ones use
> BMP or higher characters", but I can't find a simple way to query a
> string's width. Can't see i
On Wed, Apr 3, 2013 at 5:52 AM, Dave Angel wrote:
> I'm also puzzled. I thought that the sort algorithm used a hash of all the
> items to be sorted, and only reverted to a raw comparison of the original
> values when the hash collided. Is that not the case? Or is the code you
> post here only u
On Wed, Apr 3, 2013 at 9:02 AM, Steven D'Aprano
wrote:
> On Wed, 03 Apr 2013 09:43:06 -0400, Roy Smith wrote:
>
> [...]
>>> n = max(map(ord, s))
>>> 4 if n > 0x else 2 if n > 0xff else 1
>>
>> This has to inspect the entire string, no?
>
> Correct. A more efficient implementation would be:
>
>
On Wed, Apr 3, 2013 at 1:53 AM, Steven D'Aprano
wrote:
> (sys.getsizeof(s) - sys.getsizeof(''))/len(s)
>>> s = '\x80\x81\x82\x83\x84\x85'
>>> len(s)
6
>>> import sys
>>> sys.getsizeof(s)
43
>>> sys.getsizeof(s) - sys.getsizeof('')
18
>>> (sys.getsizeof(s) - sys.getsizeof('')) / len(s)
3.0
I didn
On Wed, Apr 3, 2013 at 1:41 PM, John Nagle wrote:
> I'm struggling with radio hams who are trying to get my
> antique Teletype program running. I hate having to write
> instructions like this:
>
> Installation instructions (Windows):
You should check out pyInstaller or py2exe or cx_Freeze.
--
On Fri, Apr 5, 2013 at 2:39 AM, John Ladasky wrote:
>> 2) Rewrite some key portions in C, possibly using Cython (as MRAB suggested).
>
> And as I replied to MRAB, my limiting code is within Numpy. I've taken care
> to look for ways that I might have been using Numpy itself inefficiently (and
>
On Fri, Apr 5, 2013 at 12:13 PM, John Ladasky
wrote:
> On Friday, April 5, 2013 10:32:21 AM UTC-7, Ian wrote:
>
>> That doesn't seem to follow from your original post. Because Numpy is
>> a C extension, its performance would not be improved by psyco at all.
>
> What about the fact that Numpy acco
On Fri, Apr 5, 2013 at 4:04 PM, wrote:
> They say so, but python does not work that way. This is a simple script:
>
> from unittest import TestCase
>
> class SvnExternalCmdTests(TestCase) :
> def test_parse_svn_external(self) :
> for sample_external in sample_svn_externals :
>
On Fri, Apr 5, 2013 at 4:42 PM, Ian Kelly wrote:
> Python 2 resolved this ambiguity by assuming that a hard tab was
> simply equivalent to four or eight spaces (I don't remember which).
In fact, neither is correct. Per the docs:
...tabs are replaced (from left to right) by o
On Fri, Apr 5, 2013 at 6:22 PM, wrote:
> The correct tab stop positions have always been at 8 character columns apart.
> The "ambiguity" was introduced by editors that do not follow the default
> value set in hardware like printers or used by consoles and terminal
> emulators.
8 characters is
On Fri, Apr 5, 2013 at 11:07 PM, Timothy Madden wrote:
> Changing the tab size from this default is what makes the code incompatible,
> not the tabs themselves. So the solution is simple: do not change tab size
> from the default.
So in other words, everybody must be forced to use 8-character tab
On Sat, Apr 6, 2013 at 7:29 PM, Steven D'Aprano
wrote:
> For some definition of "easily".
>
> if implementation == "CPython":
> if version < "3.3":
> if sys.maxunicode exists:
> use it to decide whether this is a wide or narrow build
> if a wide build: return 4
On Sat, Apr 6, 2013 at 3:24 PM, Chris Angelico wrote:
> On Sat, Apr 6, 2013 at 8:09 PM, Serhiy Storchaka wrote:
>> 04.04.13 00:57, Chris Angelico написав(ла):
>>> http://bugs.python.org/issue17629 opened.
>>
>>
>> See also the discussion at
>> http://comments.gmane.org/gmane.comp.python.ideas/156
On Sat, Apr 6, 2013 at 8:18 PM, Roy Smith wrote:
> In article ,
> Ian Kelly wrote:
>
>> On Sat, Apr 6, 2013 at 7:29 PM, Steven D'Aprano
>> wrote:
>> > For some definition of "easily".
>> >
>> > if implementation == "CPython&
On Sun, Apr 7, 2013 at 6:40 PM, Barrett Lewis wrote:
> I was recently watching that Raymond Hettinger video on creating Beautiful
> Python from this years PyCon.
> He mentioned pushing up the new idiom
>
> with ignored():
> # do some work
>
> I tracked down his commit here http://hg.python.or
On Tue, Apr 9, 2013 at 12:17 PM, Grant Edwards wrote:
> Disclaimer: I'm a Unix guy and have been since the days of V7 on a
> PDP-11 -- I rarely use MS Windows.
>
> While I don't normally use Windows, I do occasionally have Python
> applications (written under Linux) which I'd like to distribute to
On Tue, Apr 9, 2013 at 5:41 AM, wrote:
> try:
> response = urllib.request.urlopen(request)
> content = response.read()
> except BaseException as ue:
> if (isinstance(ue, socket.timeout) or (hasattr(ue, "reason") and
> isinstance(ue.reason, sock
On Tue, Apr 9, 2013 at 1:45 PM, Grant Edwards wrote:
> Are there any drawbacks to running a 32-bit Python install on a 64-bit
> machine?
Apart from still being limited to a 2-GB address space, nothing that
I'm aware of.
> Can you have both 32 and 64 bit Python installed at the same time?
Absolu
On Tue, Apr 9, 2013 at 3:10 PM, Νίκος Γκρ33κ wrote:
> Hello, iam still trying to alter the code form python 2.6 => 3.3
>
> Everyrging its setup except that unicode error that you can see if you go to
> http://superhost.gr
>
> Can anyone help with this?
> I even tried to change print() with sys.st
On Wed, Apr 10, 2013 at 12:25 PM, Νίκος Γκρ33κ wrote:
> Τη Τετάρτη, 10 Απριλίου 2013 9:08:38 μ.μ. UTC+3, ο χρήστης Nobody έγραψε:
>> On Wed, 10 Apr 2013 00:23:46 -0700, nagia.retsina wrote:
>>
>>
>>
>> > Look at what 'python3 metrites.py' gives me
>>
>>
>>
>> > File "/root/.local/lib/python2.7/l
On Wed, Apr 10, 2013 at 5:16 PM, Max Bucknell wrote:
> I also have a function to generate the dot product of these two vectors. In
> Java, such a function would be put as a method on the class and I would do
> something like:
>
> >>> a.dot_product(b)
> 7
>
> and that would be the end of
3101 - 3200 of 3558 matches
Mail list logo