Re: Python3 Multiprocessing

2013-08-09 Thread random832
On Fri, Aug 9, 2013, at 16:43, Devyn Collier Johnson wrote: Thanks MRAB! That is easy. I always (incorrectly) thought the join() command got two threads and made them one. I did not know it made the script wait for the threads. What you're missing is the fact that the main thread [i.e. the

Re: back with more issues

2013-08-12 Thread random832
On Mon, Aug 12, 2013, at 10:56, Rotwang wrote: No! A function should have *four* well-defined pieces: what are its parameters, what does it do, what are its side-effects, what does it return, and an almost fanatical devotion to the Pope [etc.] To be fair, I can't think of what what does it

Re: .split() Qeustion

2013-08-14 Thread random832
On Wed, Aug 14, 2013, at 10:32, wxjmfa...@gmail.com wrote: I'm always and still be suprised by the number of hard coded '\n' one can find in Python code when the portable (here win) os.linesep '\r\n' exists. Because high-level code isn't supposed to use the os module directly.

Re: How to I do this in Python ?

2013-08-16 Thread random832
On Fri, Aug 16, 2013, at 7:47, Roy Smith wrote: There is no need to shell out to dd just to do this. All dd is doing for you is seeking to the offset you specify and closing the file. You can do that entirely in Python code. http://docs.python.org/2.7/library/stdtypes.html#file.seek

Re: Encapsulation unpythonic?

2013-08-21 Thread random832
its name changes, and so have a name property. The subclass may want to use a variable called _name for some other purpose. (maybe name isn't the best example). Examples often look pathological when you simplify out the bit that makes them make sense. -- Random832 -- http://mail.python.org

Re: PEPs should be included with the documentation download

2013-08-21 Thread random832
On Wed, Aug 21, 2013, at 13:32, Chris Angelico wrote: On Wed, Aug 21, 2013 at 3:14 PM, Aseem Bansal asmbans...@gmail.com wrote: Currently the documentation download includes a lot of things but PEPs are not its part. I wanted to suggest that PEPs should be included in the download. They

Re: PEPs should be included with the documentation download

2013-08-21 Thread random832
On Wed, Aug 21, 2013, at 14:15, Jerry Hill wrote: Personally, the only PEPs I've used as reference material as PEP 8 (the Python Style Guide), and PEP 249 (the Python Database API Specification v2.0). If I recall correctly, one of the database adapters I used basically said that they were PEP

Re: Raw_input with readline in a daemon thread makes terminal text disappear

2013-08-21 Thread random832
On Wed, Aug 21, 2013, at 12:42, David M. Welch wrote: Hi all, This is an old thread, but I'm having the same behavior in my terminal when I run some code but kill the process in the terminal (Ctrl-C). The code has two prime suspects (from a simple google search): 1. Creates ssh port

Re: Basic Python Query

2013-08-22 Thread random832
On Thu, Aug 22, 2013, at 9:45, Ned Batchelder wrote: So that I understand what's going on, what's the bad thing that happens with a multi-part message? I would have thought that mail readers would choose the preferred part, or is it something to do with the message quoting? The bad thing

Re: Basic Python Query

2013-08-22 Thread random832
On Thu, Aug 22, 2013, at 18:22, Dennis Lee Bieber wrote: Well... The main thing to understand is that this particular forum is NOT JUST a mailing-list. It is cross-linked with the Usenet comp.lang.python news-group (and that, unfortunately, is cross-linked to Google-Groups). And to

Re: Running a command line program and reading the result as it runs

2013-08-23 Thread random832
On Fri, Aug 23, 2013, at 7:14, Peter Otten wrote: The following works on my linux system: instream = iter(p.stdout.readline, ) for line in instream: print line.rstrip() I don't have Windows available to test, but if it works there, too, the problem is the internal buffer

Re: can't get utf8 / unicode strings from embedded python

2013-08-24 Thread random832
On Sat, Aug 24, 2013, at 2:45, David M. Cotter wrote: you need to use u ... delimiters for Unicode, otherwise the results you get are completely arbitrary and depend on the encoding of your terminal. okay, well, i'm on a mac, and not using terminal at all. but if i were, it would be utf8

Re: can't get utf8 / unicode strings from embedded python

2013-08-24 Thread random832
On Sat, Aug 24, 2013, at 12:47, David M. Cotter wrote: What _are_ you using? i have scripts in a file, that i am invoking into my embedded python within a C++ program. there is no terminal involved. the print statement has been redirected (via sys.stdout) to my custom print class, which

Re: Getting request's source site

2013-08-26 Thread random832
On Mon, Aug 26, 2013, at 11:03, Guy Tamir wrote: Thanks for reply, In what cases will i have this header? In practice, you'll usually have it, except in cases where the user has bookmarked your site, typed/pasted the URL directly, had it opened by an external program, or taken action to block

Re: How come StopIteration.__base__ is not BaseException?

2013-08-26 Thread random832
On Mon, Aug 26, 2013, at 15:37, Marco Buttu wrote: Since StopIteration is not an error, how come does it inherit directly from Exception and not from BaseException? The reason KeyboardInterrupt and SystemExit inherit from BaseException is because you often want them to escape (allowing the

Re: python3 integer division debugging

2013-08-28 Thread random832
On Wed, Aug 28, 2013, at 11:15, Neal Becker wrote: The change in integer division seems to be the most insidious source of silent errors in porting code from python2 - since it changes the behaviour or valid code silently. I wish the interpreter had an instrumented mode to detect and

Re: String splitting with exceptions

2013-08-28 Thread random832
On Wed, Aug 28, 2013, at 12:44, John Levine wrote: I have a crufty old DNS provisioning system that I'm rewriting and I hope improving in python. (It's based on tinydns if you know what that is.) The record formats are, in the worst case, like this: foo.[DOM]::[IP6::4361:6368:6574]:600::

Re: How to execute command on remote windows machine

2013-09-03 Thread random832
has an option for this: /S. I don't know what mechanism it uses or what you would have to do to give yourself permission to use it. -- Random832 -- https://mail.python.org/mailman/listinfo/python-list

Re: Unable to redirect the subprocess CMD.exe to txt file. Please help !!!

2013-09-03 Thread random832
On Tue, Sep 3, 2013, at 9:54, Venkatesh wrote: Hello comp.lang.python Group, I am trying to invoke a subprocess in Python as below import sys import time import os import subprocess DETACHED_PROCESS = 0x0008 path = r'C:\Windows\System32\cmd.exe /k ping www.google.com -n 4

Re: How to split with \ character, and licence copyleft mirror of ©

2013-09-03 Thread random832
On Tue, Sep 3, 2013, at 6:31, Tim Chase wrote: I'd contend that the two primary purposes of raw strings (this is starting to sound like a Spanish Inquisition sketch) are regexes and DOS/Win32 file path literals. And I hit this trailing-backslash case all the time, as Vim's path-completion

Re: How to exit a cgi file after a download

2013-09-04 Thread random832
On Wed, Sep 4, 2013, at 12:49, Ferrous Cranus wrote: Without closing it, the client can download again and forever if they choose to because the cgi window is open and the link is still active. Why is this a problem? They usually won't want to, and if they do want to (for example if they

Re: How to split with \ character, and licence copyleft mirror of ©

2013-09-06 Thread random832
On Thu, Sep 5, 2013, at 23:33, Tim Roberts wrote: random...@fastmail.us wrote: Of course, in 99% of situations where you can use a windows pathname in Python, you are free to use it with a forward slash instead of a backslash. This is actually worth repeating, because it's not well known.

Re: Chardet, file, ... and the Flexible String Representation

2013-09-06 Thread random832
On Fri, Sep 6, 2013, at 11:46, Piet van Oostrum wrote: The FSR does not split unicode in chuncks. It does not create problems and therefore it doesn't have to solve this. The FSR simply stores a Unicode string as an array[*] of ints (the Unicode code points of the characters of the string.

Re: Chardet, file, ... and the Flexible String Representation

2013-09-09 Thread random832
On Fri, Sep 6, 2013, at 13:04, Chris Angelico wrote: On Sat, Sep 7, 2013 at 2:59 AM, random...@fastmail.us wrote: Incidentally, how does all this interact with ctypes unicode_buffers, which slice as strings and must be UTF-16 on windows? This was fine pre-FSR when unicode objects were

Re: Chardet, file, ... and the Flexible String Representation

2013-09-09 Thread random832
On Mon, Sep 9, 2013, at 15:03, Ian Kelly wrote: Do you mean that it breaks when overwriting Python string object buffers, or when overwriting arbitrary C strings either received from C code or created with create_unicode_buffer? If the former, I think that is to be expected since ctypes

Re: a gift function and a question

2013-09-09 Thread random832
On Mon, Sep 9, 2013, at 16:10, Mohsen Pahlevanzadeh wrote: My question is , do you have reverse of this function? persianToInteger? The int constructor is able to handle different forms of decimal numerals directly: int('\u06f3\u06f4\u06f5\u06f5') 3455 --

Re: a gift function and a question

2013-09-10 Thread random832
On Tue, Sep 10, 2013, at 3:01, Steven D'Aprano wrote: def integerToPersian(number): Convert positive integers to Persian. integerToPersian(3455) '۳۴۵۵' Does not support negative numbers. digit_map = dict(zip('0123456789', '۰۱۲۳۴۵۶۷۸۹')) digits =

Re: Chardet, file, ... and the Flexible String Representation

2013-09-10 Thread random832
On Mon, Sep 9, 2013, at 10:28, wxjmfa...@gmail.com wrote: *time performance differences* Comment: Such differences never happen with utf. Why is this bad? Keeping in mind that otherwise they would all be almost as slow as the UCS-4 case. sys.getsizeof('a') 26 sys.getsizeof('€') 40

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-13 Thread random832
On Fri, Sep 13, 2013, at 10:38, stephen.bou...@gmail.com wrote: Hm, that gives me a Type str doesn't support the buffer API message. Aha, I need to use str(s, encoding='utf8').rstrip('\0'). It's not a solution to your problem, but why aren't you using CF_UNICODETEXT, particularly if you're

Re: Is %z broken for return values of time.gmtime()?

2013-09-16 Thread random832
On Mon, Sep 16, 2013, at 9:15, Michael Schwarz wrote: According to the documentation of time.gmtime(), it returns a struct_time in UTC, but %z is replaced by +0100, which is the UTC offset of my OS’s time zone without DST, but DST is currently in effect here (but was not at the timestamp

Re: Is %z broken for return values of time.gmtime()?

2013-09-17 Thread random832
On Mon, Sep 16, 2013, at 16:55, Michael Schwarz wrote: On 2013-W38-1, at 19:56, random...@fastmail.us wrote: On Mon, Sep 16, 2013, at 9:15, Michael Schwarz wrote: According to the documentation of time.gmtime(), it returns a struct_time in UTC, but %z is replaced by +0100, which is the

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-18 Thread random832
On Fri, Sep 13, 2013, at 12:09, random...@fastmail.us wrote: Anyway, to match behavior found in other applications when pasting from the clipboard, I would suggest using: if s.contains('\0'): s = s[:s.index('\0')] Which will also remove non-null bytes after the first null (but if the

Re: Stripping characters from windows clipboard with win32clipboard from excel

2013-09-19 Thread random832
On Wed, Sep 18, 2013, at 16:13, Dave Angel wrote: So is the bug in Excel, in Windows, or in the Python library? Somebody is falling down on the job; if Windows defines the string as ending at the first null, then the Python interface should use that when defining the text defined with

Bug tracker breaks when given a username with an uppercase letter

2013-09-19 Thread random832
Registration appears to succeed, but does not allow login, and I can't tell if email confirmation worked or not. I was able to register by changing it to lowercase, but I had to guess what was happening. -- https://mail.python.org/mailman/listinfo/python-list

Re: class implementation

2013-09-30 Thread random832
On Mon, Sep 30, 2013, at 17:28, Ned Batchelder wrote: On 9/30/13 3:34 PM, Dave Angel wrote: Python doesn't actually have variables, but the things it documents as variables are local names within a method. Those are not visible outside of the method, regardless of whether you're in a class

Re: Help with python functions?

2013-10-01 Thread random832
On Tue, Oct 1, 2013, at 13:53, kjaku...@gmail.com wrote: I ended up with these. I know they're only like half right... I was wondering if any of you had to do this, what would you end up with? # Question 1.a def temp(T, from_unit, to_unit): Assuming this is temperature conversion. You

Re: Tail recursion to while iteration in 2 easy steps

2013-10-02 Thread random832
On Tue, Oct 1, 2013, at 17:30, Terry Reedy wrote: Part of the reason that Python does not do tail call optimization is that turning tail recursion into while iteration is almost trivial, once you know the secret of the two easy steps. Here it is. That should be a reason it _does_ do it -

Re: Tail recursion to while iteration in 2 easy steps

2013-10-02 Thread random832
On Wed, Oct 2, 2013, at 9:32, Steven D'Aprano wrote: Python is not as aggressively functional as (say) Haskell, but it is surely an exaggeration to suggest that the failure to include tail call optimization means that Python rejects functional programming styles. You can still write you

Re: Tail recursion to while iteration in 2 easy steps

2013-10-03 Thread random832
On Wed, Oct 2, 2013, at 17:33, Terry Reedy wrote: 5. Conversion of apparent recursion to iteration assumes that the function really is intended to be recursive. This assumption is the basis for replacing the recursive call with assignment and an implied internal goto. The programmer can

Re: Tail recursion to while iteration in 2 easy steps

2013-10-03 Thread random832
On Wed, Oct 2, 2013, at 21:46, MRAB wrote: The difference is that a tuple can be reused, so it makes sense for the comiler to produce it as a const. (Much like the interning of small integers) The list, however, would always have to be copied from the compile-time object. So that object

Re: Tail recursion to while iteration in 2 easy steps

2013-10-03 Thread random832
On Wed, Oct 2, 2013, at 22:34, Steven D'Aprano wrote: You are both assuming that LOAD_CONST will re-use the same tuple (1, 2, 3) in multiple places. But that's not the case, as a simple test will show you: def f(): ... return (1, 2, 3) f() is f() True It does, in fact, re-use it when it

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread random832
On Mon, Oct 7, 2013, at 13:15, Alain Ketterlin wrote: That's fine. My point was: you can't at the same time have full dynamicity *and* procedural optimizations (like tail call opt). Everybody should be clear about the trade-off. Let's be clear about what optimizations we are talking about.

Re: Tail recursion to while iteration in 2 easy steps

2013-10-07 Thread random832
On Sat, Oct 5, 2013, at 3:39, Antoon Pardon wrote: What does this mean? Does it mean that a naive implementation would arbitrarily mess up stack traces and he wasn't interested in investigating more sophisticated implementations? Does it mean he just didn't like the idea a stack trace

Re: converting letters to numbers

2013-10-08 Thread random832
On Tue, Oct 8, 2013, at 10:28, kjaku...@gmail.com wrote: I have to define a function add(c1, c2), where c1 and c2 are capital letters; the return value should be the sum (obtained by converting the letters to numbers, adding mod 26, then converting back to a capital letter). All I have so

Re: Code golf challenge: XKCD 936 passwords

2013-10-08 Thread random832
On Tue, Oct 8, 2013, at 2:45, sprucebond...@gmail.com wrote: On Monday, October 7, 2013 8:17:21 PM UTC-10, Chris Angelico wrote: print(*__import__(random).sample(open(/usr/share/dict/words).read().split(\n),4)) # 87 import random as r

Re: converting letters to numbers

2013-10-08 Thread random832
On Tue, Oct 8, 2013, at 11:44, kjaku...@gmail.com wrote: def add(c1, c2): ans = '' This only makes sense if your answer is going to be multiple characters. for i in c1 + c2: This line concatenates the strings together. ans += chrord(i)-65))%26) + 65) The way you are

Re: Code golf challenge: XKCD 936 passwords

2013-10-09 Thread random832
On Tue, Oct 8, 2013, at 18:27, Rob Day wrote: On 08/10/13 07:17, Chris Angelico wrote: Who's up for some fun? Implement an XKCD-936-compliant password generator in Python 3, in less code than this: print(*__import__(random).sample(open(/usr/share/dict/words).read().split(\n),4))

Re: Sexism in the Ruby community: how does the Python community manage it?

2013-10-16 Thread random832
On Wed, Oct 16, 2013, at 23:13, Owen Jacobson wrote: * therapist - yeah, It passes as a double meaning - but still. Or a single meaning. Who's to say the person who wrote the module even had any idea it could be read otherwise? * shag Something to do with carpet? * db_nazi See below.

Re: python -c commands on windows.

2013-10-21 Thread random832
On Mon, Oct 21, 2013, at 16:47, Terry Reedy wrote: Manual says -c command Execute the Python code in command. command can be one or more statements separated by newlines, with significant leading whitespace as in normal module code. In Windows Command Prompt I get:

Re: Reading From stdin After Command Line Redirection

2013-10-23 Thread random832
On Wed, Oct 23, 2013, at 16:52, Chris Angelico wrote: There are times when this is correct behaviour - like asking for passwords (SSH and sudo work like this). Less (or pagers generally, or an interactive text editor that allows creating a file from standard input) would be another example of a

Re: Python3 doc, operator reflection

2013-10-28 Thread random832
On Mon, Oct 28, 2013, at 8:00, Johannes Bauer wrote: Hi group, in http://docs.python.org/3/reference/datamodel.html#customization the doc reads: There are no swapped-argument versions of these methods (to be used when the left argument does not support the operation but the right

Re: getpeername() on stdin?

2013-11-01 Thread random832
On Thu, Oct 31, 2013, at 21:12, Nobody wrote: On Thu, 31 Oct 2013 12:16:23 -0400, Roy Smith wrote: I want to do getpeername() on stdin. I know I can do this by wrapping a socket object around stdin, with s = socket.fromfd(sys.stdin.fileno(), family, type) but that requires that I

Re: [Python-ideas] os.path.join

2013-11-04 Thread random832
On Mon, Nov 4, 2013, at 11:07, Chris Angelico wrote: Then os.path.join is probably the wrong tool for the job. Do you want to collapse /foo/bar + ../quux into /foo/quux? That rewrites the first. If not, don't use a function that does that. Try simple string concatenation instead.

Re: 'isimmutable' and 'ImmutableNester'

2013-11-11 Thread random832
A built-in function 'isimmutable()' shall tell efficiently whether the object of concern is mutable or not. What's the benefit over attempting to hash() the object? copy.deepcopy already has special case for int, string, and tuples (including tuples that do and do not have mutable members) -

Re: 'isimmutable' and 'ImmutableNester'

2013-11-12 Thread random832
On Tue, Nov 12, 2013, at 4:39, Frank-Rene Schäfer wrote: All you've done is proven that you can subvert things. By fiddling with __hash__, __eq__, and so on, you can make sets and dicts behave very oddly. Means nothing. To the contrary, it means everything about what 'isimmutable' could

Unicode stdin/stdout (was: Re: python 3.3 repr)

2013-11-15 Thread random832
Of course, the real solution to this issue is to replace sys.stdout on windows with an object that can handle Unicode directly with the WriteConsoleW function - the problem there is that it will break code that expects to be able to use sys.stdout.buffer for binary I/O. I also wasn't able to get

Re: [Python-ideas] Unicode stdin/stdout

2013-11-18 Thread random832
On Mon, Nov 18, 2013, at 7:33, Robin Becker wrote: UTF-8 stuff This doesn't really solve the issue I was referring to, which is that windows _console_ (i.e. not redirected file or pipe) I/O can only support unicode via wide character (UTF-16) I/O with a special function, not via using byte-based

Re: Why is there no natural syntax for accessing attributes with names not being valid identifiers?

2013-12-03 Thread random832
On Tue, Dec 3, 2013, at 12:14, Piotr Dobrogost wrote: Hi! I find global getattr() function awkward when reading code. What is the reason there's no natural syntax allowing to access attributes with names not being valid Python identifiers in a similar way to other attributes? Something

Re: Packaging a proprietary Python library for multiple OSs

2013-12-05 Thread random832
On Thu, Dec 5, 2013, at 10:49, Michael Herrmann wrote: Very interesting point. Thank you very much for pointing out uncompyle. I had always known that it was easy to decompile .pyc files, but hadn't imagined it to be that easy. I just tried uncompyle with some of our proprietary .pyc files. It

Re: Newbie question. Are those different objects ?

2013-12-20 Thread random832
On Fri, Dec 20, 2013, at 10:16, dec...@msn.com wrote: The second time we type print type y, how does the program knows which one of the y's it refers to ? Is the first y object deleted ? y does not refer to the first object anymore after you've assigned the second object to it. In CPython, if

Re: No overflow in variables?

2014-01-22 Thread random832
On Wed, Jan 22, 2014, at 13:26, Chris Angelico wrote: The Python integer type stores arbitrary precision. It's not a machine word, like the C# integer types (plural, or does it have only one? C# has the usual assortment of fixed-width integer types - though by default they throw exceptions on

Re: Can global variable be passed into Python function?

2014-02-24 Thread random832
On Mon, Feb 24, 2014, at 13:05, j.e.ha...@gmail.com wrote: typedef struct { int value; } Number; Number *o; o = malloc(sizeof(*o)); o-value=3; printf(o%p, o-value%p\n, o, o-value); o0x9fe5008, o-value0x9fe5008 Is the compiler borked? That's cheating. Try printf(o%p, o);

Re: [OT] Can global variable be passed into Python function?

2014-02-24 Thread random832
On Mon, Feb 24, 2014, at 13:19, Michael Torrie wrote: Why would you think that? The address of the start of your malloc'ed structure is the same as the address of the first element. Surely this is logical? And of course all this is quite off topic. That's not helpful - the problem, in

Re: Python 3.5, bytes, and %-interpolation (aka PEP 461)

2014-02-24 Thread random832
On Mon, Feb 24, 2014, at 15:46, Marko Rauhamaa wrote: That is: 1. ineffient (encode/decode shuffle) 2. unnatural (strings usually have no place in protocols) That's not at all clear. Why _aren't_ these protocols considered text protocols? Why can't you add a string directly to headers?

Re: DB API question - where is a stored procedure's return value?

2014-03-13 Thread random832
On Thu, Mar 13, 2014, at 13:01, Chris Angelico wrote: On Fri, Mar 14, 2014 at 1:43 AM, John Gordon gor...@panix.com wrote: select foo() as value from dual That will get the return value into an SQL variable, but the OP wanted to know how to fetch it from python code. In theory, that

Re: Deep vs. shallow copy?

2014-03-13 Thread random832
On Thu, Mar 13, 2014, at 11:28, Rustom Mody wrote: Heh! I was hesitating to put that line at all: For one thing its a hackneyed truth in the non-FP community. For another, in practical Haskell, use of frank recursion is regarded as as sign of programming immaturity: And IIRC Lisp and Scheme

Re: unicode as valid naming symbols

2014-03-28 Thread random832
On Thu, Mar 27, 2014, at 11:10, Rustom Mody wrote: Just out of curiosity how do/did you type that? When I see an exotic denizen from the unicode-universe I paste it into emacs and ask Who are you? But with your 'def' my emacs is going a bit crazy! Your emacs probably is using UCS-2 or

Re: Unicode Chars in Windows Path

2014-04-03 Thread random832
On Thu, Apr 3, 2014, at 5:00, Marko Rauhamaa wrote: In fact, proper dealing with punctuation in pathnames is one of the main reasons to migrate to Python from bash. Even if it is often possible to write bash scripts that handle arbitrary pathnames correctly, few script writers are pedantic

Re: Default mutable parameters in functions

2014-04-04 Thread random832
On Thu, Apr 3, 2014, at 20:38, Mark Lawrence wrote: I just wish I had a quid for every time somebody expects something out of Python, that way I'd have retired years ago. At least here it's not accompanied by as that's how it works in some other language. I can't imagine a language that

Re: Unicode in Python

2014-05-01 Thread random832
On Mon, Apr 28, 2014, at 4:57, wxjmfa...@gmail.com wrote: Python 3: - It missed the unicode shift. - Covering the whole unicode range will not make Python a unicode compliant product. Please cite exactly what portion of the unicode standard requires operations with all characters to be

Re: program to generate data helpful in finding duplicate large files

2014-09-22 Thread random832
On Thu, Sep 18, 2014, at 14:45, Chris Kaynor wrote: Additionally, you may want to specify binary mode by using open(file_path, 'rb') to ensure platform-independence ('r' uses Universal newlines, which means on Windows, Python will convert \r\n to \n while reading the file). Additionally, some

Re: GCD in Fractions

2014-09-24 Thread random832
On Wed, Sep 24, 2014, at 10:26, Ian Kelly wrote: This depends entirely on your implementation of the modulo operation, which is an issue of computing since the operator is not used in mathematics. Wikipedia suggests that remainders from Euclidean division should be used. In Euclidean division,

Re: Fuzzy Counter?

2014-09-26 Thread random832
On Wed, Sep 24, 2014, at 00:57, Miki Tebeka wrote: On Tuesday, September 23, 2014 4:37:10 PM UTC+3, Peter Otten wrote: x eq y y eq z not (x eq z) where eq is the test given above -- should x, y, and z land in the same bin? Yeah, I know the counting depends on the order of items. But

Re: Fuzzy Counter?

2014-09-26 Thread random832
On Fri, Sep 26, 2014, at 14:30, Rob Gaddi wrote: The histogram bin solution that everyone keeps trying to steer you towards is almost certainly what you really want. Epsilon is your resolution. You cannot resolve any information below your resolution limit. Yes, 1.49 and 1.51 wind up in

Re: Python 3.4.1 on W2K?

2014-10-07 Thread random832
On Tue, Oct 7, 2014, at 16:27, Michael Torrie wrote: That's really interesting. I looked briefly at the page. How does your python extension work with xywrite? Does it manipulate xywrite documents or does it tie in at runtime with Xywrite somehow? If so, how does it do this? Crossing the

Re: operator module functions

2014-10-08 Thread random832
On Wed, Oct 8, 2014, at 15:38, Ethan Furman wrote: LOL, no kidding! The main reason I bother using the operator module is for the readability of not seeing the dunders, and the writability of not having to type them. I'm not sure what situation you would have to type them (as opposed to

Re: Toggle

2014-10-08 Thread random832
On Wed, Oct 8, 2014, at 23:02, Mark Lawrence wrote: When I first read this I was extremely jealous of the originator but having used it umpteen times I'm still extremely jealous of the originator!!! Why doesn't my mind work like his? :) You could also keep the ints in two variables and do a

Re: trying idle

2014-10-09 Thread random832
On Thu, Oct 9, 2014, at 05:26, Terry Reedy wrote: On 10/9/2014 2:52 AM, Rustom Mody wrote: Particularly with macs my knowledge is at the level: How the ^%*)( do you right click without a right-click button? I believe control-click, but Macs users could say better. Control-click was the

Re: trying idle

2014-10-10 Thread random832
On Fri, Oct 10, 2014, at 03:53, Mark H Harris wrote: The apple mouse has only one click in the hardware... but, through the software (settings) the apple hardware 'know' which side of the mouse you are pushing over. It only has one physical switch (I'm not sure the latest ones have any at

Re: real-life example LC_CTYPE effects?

2014-10-21 Thread random832
On Mon, Oct 20, 2014, at 16:33, Albert-Jan Roskam wrote: Hi, The locale category LC_CTYPE may affect character classification and case conversion. That's the theory. Can you give a practical example where this locale setting matters? Eg.: locale.setlocale(locale.LC_CTYPE, loc) m =

Re: Flush stdin

2014-10-22 Thread random832
On Tue, Oct 21, 2014, at 19:16, Dan Stromberg wrote: Actually, doesn't line buffering sometimes exist inside an OS kernel? stty/termios/termio/sgtty relate here, for *ix examples. Supporting code: http://stromberg.dnsalias.org/~strombrg/ttype/ It turns on character-at-a-time I/O in the tty

Re: Truthiness

2014-10-23 Thread random832
On Thu, Oct 23, 2014, at 10:56, Simon Kennedy wrote: Thanks everyone. That's a thorough enough explanation for me. You should know, though, that numeric values equal to 1 (and 0 for False) _are_ == True. This works for dictionary keys, array indexes, etc. The bool type is actually a subclass of

Re: locale.getlocale() in cmd.exe vs. Idle

2014-11-11 Thread random832
(English_United States in Windows) and not Unix-like (cf. getdefaultlocale: en_US) regards, Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list -- Random832 -- https://mail.python.org/mailman/listinfo/python-list

Re: locale.getlocale() in cmd.exe vs. Idle

2014-11-11 Thread random832
) regards, Albert-Jan -- https://mail.python.org/mailman/listinfo/python-list -- Random832 -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7 and unicode (one more time)

2014-11-20 Thread random832
On Thu, Nov 20, 2014, at 07:35, Peter Otten wrote: %s nötig %s % (uüblich, uähnlich) Traceback (most recent call last): File stdin, line 1, in module UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128) This is surprising to me - why is it

Re: python 2.7 and unicode (one more time)

2014-11-20 Thread random832
On Thu, Nov 20, 2014, at 09:59, Chris Angelico wrote: On Fri, Nov 21, 2014 at 12:59 AM, random...@fastmail.us wrote: On Thu, Nov 20, 2014, at 07:35, Peter Otten wrote: %s nötig %s % (uüblich, uähnlich) Traceback (most recent call last): File stdin, line 1, in module

Re: python 2.7 and unicode (one more time)

2014-11-20 Thread random832
On Thu, Nov 20, 2014, at 16:29, Ethan Furman wrote: If your unicode string happens to contain a base64 encoded .png, then you could decode that into bytes. ;) Bytes of the PNG, or of the raw pixels? -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7 and unicode (one more time)

2014-11-20 Thread random832
unfortunately incompatible with unicode normalization if naively translated, whereas VISCII sacrifices a handful of C0 control characters in addition to fully packing the high half with letters. -- Random832 -- https://mail.python.org/mailman/listinfo/python-list

Re: Using Python for date calculations

2014-11-21 Thread random832
On Fri, Nov 21, 2014, at 05:33, alister wrote: the problem with input is code-injection which is very similar to sql injection (httpd://xkcd.com/327). the data entered by the user is processed as if it was python code, this means the user could enter a command (or sequence of commands)

Re: Using Python for date calculations

2014-11-21 Thread random832
On Fri, Nov 21, 2014, at 05:47, Chris Angelico wrote: Now, maybe you want it to eval. There are times when I conceptually want enter an integer, but it makes good sense to be able to type 1+2 and have it act as if I typed 3. That's fine... but if you want eval, write eval into your code. Be

Re: Infinitely nested containers

2014-11-21 Thread random832
On Fri, Nov 21, 2014, at 02:00, Marko Rauhamaa wrote: Gill Shen gillar...@gmail.com: How is this [nesting] behavior implemented under the hood? Pointers. And why is this allowed at all? There's no reason not to. There's no reason not to allow it with tuples, but you can't do it.

Re: Infinitely nested containers

2014-11-21 Thread random832
On Fri, Nov 21, 2014, at 12:47, Chris Angelico wrote: You can do it in C, I believe - PyTuple_New() followed by PyTuple_SetItem(x, 0, x) should do it. Yeah, that's how I did it. I think python 2 crashed and python 3 didn't... or maybe it was the interactive interpreter that crashed and calling

Re: python 2.7 and unicode (one more time)

2014-11-22 Thread random832
On Fri, Nov 21, 2014, at 23:38, Steven D'Aprano wrote: I really don't understand what bothers you about this. In Python, we have Unicode strings and byte strings. In computing in general, strings can consist of Unicode characters, ASCII characters, Tron characters, EBCDID characters,

Re: python 2.7 and unicode (one more time)

2014-11-22 Thread random832
On Sat, Nov 22, 2014, at 18:38, Mark Lawrence wrote: ... That is a standard Windows build. He is again conflating problems with using the Windows command line for a given code page with the FSR. The thing is, with a truetype font selected, a correctly written win32 console problem should be

Re: I have no class

2014-11-22 Thread random832
On Sat, Nov 22, 2014, at 21:47, Seymore4Head wrote: What do I need to do to make a and b have different values? import random class RPS: throw=random.randrange(3) a=RPS b=RPS print (a ,a.throw) print (b ,b.throw) if a.throw == b.throw: print(Tie) elif (a.throw -

Re: python 2.7 and unicode (one more time)

2014-11-22 Thread random832
On Sat, Nov 22, 2014, at 21:11, Chris Angelico wrote: Is that true? Does WriteConsoleW support every Unicode character? It's not obvious from the docs whether it uses UCS-2 or UTF-16 (or maybe something else). I was defining every unicode character loosely. There are certainly display problems

Re: Infinitely nested containers

2014-11-22 Thread random832
On Sun, Nov 23, 2014, at 00:59, Steven D'Aprano wrote: It works fine now (Python 3.3). py L = [] py t = (L, None) py L.append(L) py L.append(t) # For good measure. py print(t) ([[...], (...)], None) This is a tuple in a list in a tuple, not a tuple in a tuple. Really? I

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread random832
On Sun, Nov 23, 2014, at 11:33, Dennis Lee Bieber wrote: Why would that be possible? Many truetype fonts only supply glyphs for single-byte encodings (ISO-Latin-1, for example -- pop up the Windows character map utility and see what some of the font files contain. With a bitmap font

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread random832
On Sun, Nov 23, 2014, at 15:31, Dave Angel wrote: I didn't realize Windows shell (DOS box) had that bug. Course I don't use Windows much the last few years. it's one thing to not display it properly. It's quite another to supply faulty data to the clipboard. Especially since the Windows

Re: bug or feature in enum34 py2.7 backport?

2014-11-26 Thread random832
On Wed, Nov 26, 2014, at 06:29, Mark Summerfield wrote: TypeError: type() argument 1 must be string, not unicode If this is a bug, maybe it is one in type() itself - I get the same error with type('X', (object,), dict(a=1)) -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   8   >