Re: f-string error message

2023-08-30 Thread Random832 via Python-list
On Sun, Aug 27, 2023, at 17:19, Rob Cliffe via Python-list wrote: > I understand that this is an error: I'm telling the f-string to expect > an integer when in fact I'm giving it a Decimal. > And indeed f"{x:3}" gives ' 42' whether x is an int or a Decimal. > However, to my mind it is not the

Re: Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-19 Thread Random832
On Sat, Apr 16, 2022, at 13:35, Peter J. Holzer wrote: > When adding a timedeltacal object to a datetime, the fields are added > from most to least significant: First a new date is computed by > advancing the number of months specified [TODO: Research how other > systems handle overflow (e.g.

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-19 Thread Random832
On Tue, Apr 19, 2022, at 07:11, Loris Bennett wrote: > I now realise that timedelta is not really what I need. I am interested > solely in pure periods, i.e. numbers of seconds, that I can convert back > and forth from a format such as A timedelta *is* a pure period. A timedelta of one day is

Re: use set notation for repr of dict_keys?

2021-02-24 Thread Random832
On Wed, Feb 24, 2021, at 02:59, Marco Sulla wrote: > On Wed, 24 Feb 2021 at 06:29, Random832 wrote: > > I was surprised, though, to find that you can't remove items directly from > > the key set, or in general update it in place with &= or -= (these > > operators work,

Re: use set notation for repr of dict_keys?

2021-02-23 Thread Random832
On Sat, Feb 20, 2021, at 15:00, dn via Python-list wrote: > So, the output is not a set (as you say) but nor (as > apparently-indicated by the square-brackets) is it actually a list! To be clear, it is an instance of collections.abc.Set, and supports most binary operators that sets support. I

Re: Response for PING in ircbot.

2021-02-02 Thread Random832
On Sat, Jan 30, 2021, at 11:50, Bischoop wrote: > > Got problem with responding for Ping, tried so many ways to response > and always end up with time out or other error. This time: 1. It looks like you're forgetting to send \n\r 2. i'm not sure if the server ping is guaranteed to have :

Re: sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.

2021-01-20 Thread Random832
On Wed, Jan 20, 2021, at 16:45, Random832 wrote: > On Wed, Jan 20, 2021, at 14:54, panfei wrote: > > 3. Compile Python 3.9.1 > > C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ > > CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ > &

Re: sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.

2021-01-20 Thread Random832
On Wed, Jan 20, 2021, at 14:54, panfei wrote: > 3. Compile Python 3.9.1 > C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ > CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ > LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure >

Re: Exploring terminfo

2021-01-18 Thread Random832
On Fri, Jan 15, 2021, at 13:36, Alan Gauld via Python-list wrote: > That could make a big difference, the putp() function specifically > states that it writes to stdout. I think there is a reasonable argument that this is a deficiency of the curses module. I think that the curses module should

Re: Best way to determine user's screensize?

2020-10-31 Thread Random832
On Sat, Oct 31, 2020, at 01:26, Igor Korot wrote: > This one is for "JAVAsucks" - > https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html > This one is for wxWidgets - https://docs.wxwidgets.org/3.0/overview_sizer.html > This one is for Qt - https://doc.qt.io/qt-5/layout.html > This

Re: Best way to determine user's screensize?

2020-10-30 Thread Random832
On Fri, Oct 30, 2020, at 20:18, Igor Korot wrote: > Hi, > > On Fri, Oct 30, 2020 at 6:59 PM Peter J. Holzer wrote: > > So, assuming the user is invoking the application for the first time, > > how should an application determine how much of the screen it should > > use? It has to make some

Re: Best way to determine user's screensize?

2020-10-30 Thread Random832
On Fri, Oct 30, 2020, at 12:05, Grant Edwards wrote: > Why do you think that's something your application needs to know? > > I _hate_ applications that think just because they've been started > they now own the entire computer and everything reachable from it. > > All you need to know is how big

Re: Why doesn't collections.Counter support a "key" argument in its constructor?

2020-09-12 Thread Random832
On Fri, Sep 11, 2020, at 12:01, Saurav Chirania wrote: > I really like that python's sort method accepts a key function as a > parameter which can be used to specify how elements should be compared. > > Similarly, we could have a "key" argument which specifies how elements > should be counted.

Re: Output showing "None" in Terminal

2020-08-24 Thread Random832
On Mon, Aug 24, 2020, at 09:12, Py Noob wrote: > Hi! > > i'm new to python and would like some help with something i was working on > from a tutorial. I'm using VScode with 3.7.0 version on Windows 7. Below is > my code and the terminal is showing the word "None" everytime I execute my > code.

Re: Iterators, iterables and special objects

2020-07-24 Thread Random832
On Fri, Jul 24, 2020, at 14:42, Chris Angelico wrote: > And then someone will ask why you can't subscript a map object if the > underlying object could be subscripted, etc, etc, etc. It's not meant > to be a transparent layer over the object; it's just an iterator - > basically equivalent to: > >

Re: Iterators, iterables and special objects

2020-07-24 Thread Random832
On Thu, Jul 23, 2020, at 05:14, Peter Slížik wrote: > > Works in what way? You can't use it in a 'for' loop if it doesn't > > define __iter__. > > > > class Iterable: > def __iter__(self): > return Iterator(...) > > class Iterator: > def __next__(self): > return > >

Re: Iterators, iterables and special objects

2020-07-24 Thread Random832
On Tue, Jul 21, 2020, at 15:54, Terry Reedy wrote: > The transformers should be once-through iterators because they can be > passed once-through interators. I suppose one could make them iterables > and add an attribute 'pristine' set to True in __init__ and False in > __iter__, but why have 2

Re: Formal Question to Steering Council (re recent PEP8 changes)

2020-07-04 Thread Random832
On Sat, Jul 4, 2020, at 18:17, Ethan Furman wrote: > On 07/04/2020 10:32 AM, Random832 wrote: > > > I said obvious because even if it was not obvious from the commit message > > itself, it had *already been explained* in the thread on the other mailing > > list > &

Re: Formal Question to Steering Council (re recent PEP8 changes)

2020-07-04 Thread Random832
On Sat, Jul 4, 2020, at 12:33, o1bigtenor wrote: > I would point out that even suggesting that the issue be a *obvious > factual mistake* only serves to prove that you didn't read the thing > and I, at least, wonder why you're offering an opinion on any part of > the discussion. I said

Re: Formal Question to Steering Council (re recent PEP8 changes)

2020-07-04 Thread Random832
On Fri, Jul 3, 2020, at 08:48, Rhodri James wrote: > As I said in my preamble, it doesn't matter whether you believe that is > true or think it's utter bollocks. I asked the question to get the > Steering Council's opinion, not anyone else's. If you collectively > really must rehash the

Re: Formal Question to Steering Council (re recent PEP8 changes)

2020-07-02 Thread Random832
On Thu, Jul 2, 2020, at 18:29, Michael Torrie wrote: > Come again? I can see no other link in the verbage with the "relics of > white supremacy" that she referred to. If there are other links, they > should be included in the commit message. I agree with Rhodri that an > explanation would be

Re: Pycharm Won't Do Long Underscore

2020-06-30 Thread Random832
On Wed, Jun 24, 2020, at 21:38, Grant Edwards wrote: > On 2020-06-24, Peter J. Holzer wrote: > > > There is U+FF3F Fullwidth Low Line. > > > >> If there were, Python would not know what to do with it > > > > You can use it in variable names, but not at the beginning, and it isn't > > equivalent

Re: Why does super(bool) give None

2020-04-24 Thread Random832
On Fri, Apr 24, 2020, at 02:10, Cecil Westerhof wrote: > issubclass(bool, int) gives True > but > super(bool) gives > > Do I not understand the meaning of super, or is this inconsistent? I've never heard of a one-argument form for super, but I just tried something and now I'm confused about

Re: What variable type is returned from Open()?

2020-04-15 Thread Random832
On Wed, Apr 15, 2020, at 12:11, dcwhat...@gmail.com wrote: > So you're saying this is a type _io.TextIOWrapper? This type doesn't > show up, on the hint listbox (I'm using Wing IDE). So if I type > var_file : _io, it doesn't show anything. While others have pointed out that you shouldn't need

Re: Documentation of __hash__

2020-02-07 Thread Random832
On Fri, Feb 7, 2020, at 10:14, Richard Damon wrote: > On 2/6/20 2:13 PM, klau...@gmail.com wrote: > > The default __eq__ method (object identity) is compatible with all > > (reasonable) self-defined __hash__ method. > > > > Stefan > > If __eq__ compares just the id, then the only hash you need

Re: Clarification on Immutability please

2020-01-28 Thread Random832
On Wed, Jan 22, 2020, at 02:34, Stephen Tucker wrote: > Oh dear, I am sorry. I have created quite a storm. > > Moreover, I am sorry because I misremembered what I had typed into Idle. My > original tuple only had two elements, not three, so the slicing [:2] didn't > affect the tuple at all - and

[issue39365] Support (SEEK_END/SEEK_CUR) relative seeking in StringIO

2020-01-19 Thread random832
random832 added the comment: That documentation isn't specific to StringIO, and in any case, the limitation in question isn't documented. The actual implementation is at https://github.com/python/cpython/blob/HEAD/Modules/_io/stringio.c#L484 But if examples would help, they're simple

[issue39365] Support (SEEK_END/SEEK_CUR) relative seeking in StringIO

2020-01-16 Thread random832
New submission from random832 : Currently this fails with a (misleading in the case of SEEK_END) "Can't do nonzero cur-relative seeks" error, but there's no conceptual reason it shouldn't be possible. The offset should simply be taken as a character offset, without an

Re: Extension type inherit from Python int

2020-01-16 Thread Random832
On Thu, Jan 16, 2020, at 12:33, Mathias Enzensberger via Python-list wrote: > Has anyone already done something like that? Is there some trick to > work around that issue, or is it simply not possible to inherit from > PyLongObject? pure-python types that derive from int place __dict__ at the

Re: Why isn't "-std=c99" (and others) not part of python3-config's output?

2020-01-11 Thread Random832
On Mon, Nov 25, 2019, at 15:13, Musbur wrote: > 2) How does one activate the necessary CFLAGs for extension building? the standard level required for building some extension is a property of the extension's source code, isn't it? I don't know if including the python headers requires -std=c99 or

Re: Does the argparse generate a wrong help message?

2020-01-01 Thread Random832
On Fri, Dec 27, 2019, at 23:08, jf...@ms4.hinet.net wrote: > > > optional arguments: > > > -h, --help show this help message and exit > > > --foo [FOO] foo help > > > --goo GOOgoo help > > > > > > D:\Works\Python>py test.py --foo 1 --goo 2 > > > 1 ['2'] > > So the square bracket means

Re: INHERITANCE in python3

2019-12-18 Thread Random832
On Wed, Dec 18, 2019, at 23:10, vahid asadi via Python-list wrote: > HI guys this is my first post on python mailing lists ever and i glad > to do this. > my problem here is why this attribute is not recognize by python and it > raise an traceback error that said 'there is no such p.family >

Re: nonlocal fails ?

2019-11-17 Thread Random832
On Sun, Nov 17, 2019, at 07:26, Richard Damon wrote: > I am not sure about C#, but in C++, a base language for C#, you can not > take the address of a variable of reference type, if you do, you get the > objected referred to, not the reference. References are essentially > constant pointers, and

Re: nonlocal fails ?

2019-11-16 Thread Random832
On Fri, Nov 15, 2019, at 13:41, Dennis Lee Bieber wrote: > C# documents those as something visible to the user at the language > level... > https://www.infoworld.com/article/3043992/a-deep-dive-value-and-reference-types-in-net.html > """ > Types in Microsoft .Net can be either value type or

Re: nonlocal fails ?

2019-11-15 Thread Random832
On Fri, Nov 15, 2019, at 11:47, Richard Damon wrote: > The issue with calling it a Reference, is that part of the meaning of a > Reference is that it refers to a Object, and in Python, Names are > conceptually something very much different than an Object. Yes, in the > implementation details, a

Re: nonlocal fails ?

2019-11-15 Thread Random832
On Fri, Nov 15, 2019, at 10:48, Richard Damon wrote: > On 11/15/19 6:56 AM, R.Wieser wrote: > > There are quite a number of languages where /every/ type of argument > > (including values) can be transfered "by reference". Though some default > > to > > "by value", where others default to "by

Re: keying by identity in dict and set

2019-11-01 Thread Random832
On Sun, Oct 27, 2019, at 03:24, Steve White wrote: > Yes, there are several options, but they all involve an extra layer > that detracts between the interface I am building and my user's code. > In this situation, the objects being used as keys are conceptually the > unique entities that the user

Re: keying by identity in dict and set

2019-10-26 Thread Random832
On Sat, Oct 19, 2019, at 07:31, Steve White wrote: > Hi, > > I have an application that would benefit from object instances > distinguished by identity being used in dict's and set's. To do this, > the __hash__ method must be overridden, the obvious return value being > the instance's id. > >

Re: what's the differences: None and null?

2019-09-13 Thread Random832
On Fri, Sep 13, 2019, at 21:22, Hongyi Zhao wrote: > what's the differences: None and null? null isn't really a concept that exists in Python... while None fills many of the same roles that null does in some other languages, it is a proper object, with __str__ and __repr__ methods (that return

Re: CVE-2019-9636 - Can this be exploit over the wire?

2019-09-05 Thread Random832
On Wed, Sep 4, 2019, at 13:36, Barry Scott wrote: > The conclusion I reached is that the CVE only applies to client code > that allows a URL in unicode to be entered. > > Have I missed something important in the analysis? While as I mentioned in my other post I'm not sure if the CVE's analysis

Re: CVE-2019-9636 - Can this be exploit over the wire?

2019-09-05 Thread Random832
On Wed, Sep 4, 2019, at 13:36, Barry Scott wrote: > I have been looking into CVE-2019-9636 and I'm not sure that > python code that works in bytes is vulnerable to this. I'm not convinced that the CVE (or, at least, the description in the bug report... it's also unclear to me whether this is an

Re: Plumbing behind super()

2019-06-27 Thread Random832
On Thu, Jun 27, 2019, at 23:32, adam.pre...@gmail.com wrote: > On Thursday, June 27, 2019 at 8:30:21 PM UTC-5, DL Neil wrote: > > I'm mystified by "literally given nothing". > > I'm focusing there particularly on the syntax of writing "super()" > without any arguments to it. However, internally

Re: Implementing C++'s getch() in Python

2019-05-25 Thread Random832
On Sat, May 25, 2019, at 10:07, binoythomas1...@gmail.com wrote: > Hi Shakti! > > Thanks for your response. I have tried getpass() but got the following > warning: > > Warning (from warnings module): > File > "C:\Users\Binoy\AppData\Local\Programs\Python\Python37-32\lib\getpass.py", > line

[issue36958] IDLE should print exit message or status if one is provided

2019-05-18 Thread Random832
New submission from Random832 : IDLE currently just returns to the interactive prompt when a script exits, even if SystemExit has arguments. This can be confusing to new users if they are using sys.exit to print a message. -- assignee: terry.reedy components: IDLE files: run.py.patch

Can't drop files on python scripts in a fresh installation of Windows

2018-09-05 Thread Random832
Python itself runs fine, but when I try to drop a file on a script it just doesn't work. If I try to regsvr32 the shell extension, it says: The module "c:\windows\pyshellext.amd64.dll" failed to load. There was no indication of any problem until this. Apparently it is linked against

Can't drop files on python scripts in a fresh installation of Windows 10 and Python 3.7

2018-09-03 Thread Random832
Python itself runs fine, but when I try to drop a file on a script it just doesn't work. If I try to regsvr32 the shell extension, it says: The module "c:\windows\pyshellext.amd64.dll" failed to load. There was no indication of any problem until this. Apparently it is linked against

Re: Open (txt) editor and get its content

2018-04-19 Thread Random832
On Thu, Apr 19, 2018, at 03:39, zljubi...@gmail.com wrote: > Is there any other option for getting interactive multi line input from user. If you don't need a full-featured text editor, you could build a simple input popup with the Textbox widget in tkinter. --

Re: Help: 64bit python call c and got OSError: exception: access violation writing 0xFFFFFFFF99222A60

2018-01-22 Thread Random832
On Mon, Jan 22, 2018, at 16:00, Jason Qian via Python-list wrote: > Hello! > > I am using ctypes on Windows to interface with a dll and it works fine > on Linux and windows 32-bit python. But, when using 64-bit python, we got > error "exception: access violation writing 0x99222A60".

Re: Can utf-8 encoded character contain a byte of TAB?

2018-01-15 Thread Random832
On Mon, Jan 15, 2018, at 09:35, Peter Otten wrote: > Peng Yu wrote: > > > Can utf-8 encoded character contain a byte of TAB? > > Yes; ascii is a subset of utf8. > > If you want to allow fields containing TABs in a file where TAB is also the > field separator you need a convention to escape the

Re: [OT] Re: has sourceforge exposed the dirty little secret ?

2018-01-07 Thread Random832
On Sun, Jan 7, 2018, at 18:50, Gene Heskett wrote: > That, now that you mention it, could also effect this as I see it, my > default kmail message body font is hack 14 in deference to the age of my > eyes. > > My system default font is I believe utf-8. That is not a kmail settable > option.

Re: [OT] Re: has sourceforge exposed the dirty little secret ?

2018-01-07 Thread Random832
On Sun, Jan 7, 2018, at 17:47, Richard Damon wrote: > But it also says: > > Content-Transfer-Encoding: 7bit > > Which is incorrect, as the message is actually 8bit encoded (since the > Emoji aren't in the first 127 characters, so their UTF-8 encoding isn't > 7-bit. Some software might have

Re: [OT] Re: has sourceforge exposed the dirty little secret ?

2018-01-07 Thread Random832
On Sun, Jan 7, 2018, at 17:27, Gene Heskett wrote: > > > >   > > > But here its broken and I am looking at two pairs of vertical boxes > because it is not properly mime'd. If you use chars or gliphs from a > non-default charset, it needs to demarcated with a mime-boundary marker > followed by

Re: unicode direction control characters

2018-01-02 Thread Random832
On Tue, Jan 2, 2018, at 10:36, Robin Becker wrote: > >> u'\u200e28\u200e/\u200e09\u200e/\u200e1962' > > I guess I'm really wondering whether the BIDI control characters have any > semantic meaning. Most numbers seem to be LTR. > > If I saw u'\u200f12' it seems to imply that the characters should

Re: How to exec a string which has an embedded '\n'?

2017-12-30 Thread Random832
On Sat, Dec 30, 2017, at 23:57, jf...@ms4.hinet.net wrote: > I have a multiline string, something like '''...\nf.write('\n')\n...''' > when pass to exec(), I got > SyntaxError: EOL while scanning string literal > > How to get rid of it? Use \\n for this case, since you want the \n to be

Re: What is wrong with this regex for matching emails?

2017-12-19 Thread Random832
On Mon, Dec 18, 2017, at 02:01, Chris Angelico wrote: > Hmm, is that true? I was under the impression that the quoting rules > were impossible to match with a regex. Or maybe it's just that they're > impossible to match with a *standard* regex, but the extended > implementations (including

Re: __contains__ classmethod?

2017-12-18 Thread Random832
On Mon, Dec 18, 2017, at 16:25, Tim Chase wrote: > My understanding was that "in" makes use of an available __contains__ > but something seems to preventing Python from finding that. > > What's going on here? Most __ methods have to be an actual method on the class object, which means you have

Re: What is wrong with this regex for matching emails?

2017-12-17 Thread Random832
On Sun, Dec 17, 2017, at 10:46, Chris Angelico wrote: > But if you're trying to *validate* an email address - for instance, if > you receive a form submission and want to know if there was an email > address included - then my recommendation is simply DON'T. You can't > get all the edge cases

Re: why won't slicing lists raise IndexError?

2017-12-08 Thread Random832
On Mon, Dec 4, 2017, at 13:54, Jason Maldonis wrote: > Is there any background on why that doesn't raise an IndexError? Knowing > that might help me design my extended list class better. For my specific > use case, it would simplify my code (and prevent `if isinstance(item, > slice)` checks) if

Re: Politeness (was: we want python software)

2017-12-06 Thread Random832
On Wed, Dec 6, 2017, at 11:18, Steve D'Aprano wrote: > You suggested that if he wasn't familiar with free software, his > request that people send him a copy of Python wouldn't look so odd. > Okay, if Python weren't free software, it would be non-free software, > and you are saying that it

Re: why won't slicing lists raise IndexError?

2017-12-04 Thread Random832
On Mon, Dec 4, 2017, at 13:54, Jason Maldonis wrote: > Is there any background on why that doesn't raise an IndexError? Knowing > that might help me design my extended list class better. For my specific > use case, it would simplify my code (and prevent `if isinstance(item, > slice)` checks) if

Re: replacing `else` with `then` in `for` and `try`

2017-11-06 Thread Random832
I haven't read over every message in the thread, so sorry if this has been suggested before, but how about "if not break:" and "if not except:" as synonyms for the current 'else' clause? They're already keywords, and this sequence of keywords has no current meaning. --

Re: What extended ASCII character set uses 0x9D?

2017-08-18 Thread Random832
On Fri, Aug 18, 2017, at 03:39, Marko Rauhamaa wrote: > BTW, I was reading up on the history of ASCII control characters. Quite > fascinating. > > For example, have you ever wondered why DEL is the odd control character > out at the code point 127? The reason turns out to be paper punch tape. >

Re: Grapheme clusters, a.k.a.real characters

2017-07-20 Thread Random832
On Thu, Jul 20, 2017, at 01:15, Steven D'Aprano wrote: > I haven't really been paying attention to Marko's suggestion in detail, > but if we're talking about a whole new data type, how about a list of > nodes, where each node's data is a decomposed string object guaranteed to > be either: How

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Random832
On Tue, Jul 18, 2017, at 22:49, Steve D'Aprano wrote: > > What about Emoji? > > U+1F469 WOMAN is two columns wide on its own. > > U+1F4BB PERSONAL COMPUTER is two columns wide on its own. > > U+200D ZERO WIDTH JOINER is zero columns wide on its own. > > > What about them? In a monospaced font,

Re: Grapheme clusters, a.k.a.real characters

2017-07-19 Thread Random832
On Tue, Jul 18, 2017, at 19:21, Gregory Ewing wrote: > Random832 wrote: > > What about Emoji? > > U+1F469 WOMAN is two columns wide on its own. > > U+1F4BB PERSONAL COMPUTER is two columns wide on its own. > > The term "emoji" is becoming rather stra

Re: Grapheme clusters, a.k.a.real characters

2017-07-18 Thread Random832
On Tue, Jul 18, 2017, at 10:23, Anders Wegge Keller wrote: > På Tue, 18 Jul 2017 23:59:33 +1000 > Chris Angelico skrev: > > On Tue, Jul 18, 2017 at 11:11 PM, Steve D'Aprano > >> (I don't think any native English words use a double-V or double-U, but > >> the possibility exists.)

Re: Grapheme clusters, a.k.a.real characters

2017-07-18 Thread Random832
On Sun, Jul 16, 2017, at 01:37, Steven D'Aprano wrote: > In a *well-designed* *bug-free* monospaced font, all code points should > be either zero-width or one column wide. Or two columns, if the font > supports East Asian fullwidth characters. What about Emoji? U+1F469 WOMAN is two columns wide

Re: Grapheme clusters, a.k.a.real characters

2017-07-18 Thread Random832
On Fri, Jul 14, 2017, at 04:15, Marko Rauhamaa wrote: > Consider, for example, a Python source code > editor where you want to limit the length of the line based on the > number of characters more typically than based on the number of pixels. Even there you need to go based on the width in

Re: Grapheme clusters, a.k.a.real characters

2017-07-18 Thread Random832
On Fri, Jul 14, 2017, at 08:33, Chris Angelico wrote: > What do you mean about regular expressions? You can use REs with > normalized strings. And if you have any valid definition of "real > character", you can use it equally on an NFC-normalized or > NFD-normalized string than any other. They're

Re: About the implementation of del in Python 3

2017-07-07 Thread Random832
On Fri, Jul 7, 2017, at 10:41, Nathan Ernst wrote: > Looks like single expression statements are handled a bit differently > than > multiple expression statements: > > Python 3.5.2 (default, Nov 17 2016, 17:05:23) > [GCC 5.4.0 20160609] on linux > Type "help", "copyright", "credits" or "license"

Re: About the implementation of del in Python 3

2017-07-07 Thread Random832
On Fri, Jul 7, 2017, at 04:12, Gregory Ewing wrote: > Only if you interpret the word "address" very narrowly. > > By the way, even the low-level notion of "address" that C > programs deal with is, on most modern hardware, a *virtual* > address that goes through a level of translation before it >

Re: Rawest raw string literals

2017-04-20 Thread Random832
On Thu, Apr 20, 2017, at 16:01, Grant Edwards wrote: > On 2017-04-20, MRAB wrote: > > There _is_ a "universal solution"; it's called a Hollerith constant. :-) > > Wow, I haven't seen one of those in a _long_ time -- probably about 45 > years. I think the first FORTAN

Re: Who are the "spacists"?

2017-03-20 Thread Random832
On Sun, Mar 19, 2017, at 18:48, Mikhail V wrote: > Sadly, many people believe that a code editor > should be monospaced, but generally that does not > have any sense. It's also a bit self-reinforcing because there aren't many good coding fonts that are proportional. And in fact there are issues

Re: What's with all the messages from @f38.n261.z1

2017-02-07 Thread Random832
On Tue, Feb 7, 2017, at 15:08, Michael Torrie wrote: > Seems like we're getting a bunch of messages on the mailing list that > appear to be copies of real member posts that are saying they are from > @f38.n261.z1? They don't appear to be deliberate impersonations. Some > misconfigured server

Re: Extended ASCII

2017-01-13 Thread Random832
On Fri, Jan 13, 2017, at 17:24, D'Arcy Cain wrote: > I thought I was done with this crap once I moved to 3.x but some > Winblows machines are still sending what some circles call "Extended > ASCII". I have a file that I am trying to read and it is barfing on > some characters. For example: >

Re: Simulating int arithmetic with wrap-around

2017-01-06 Thread Random832
On Fri, Dec 30, 2016, at 09:47, Steve D'Aprano wrote: > Again, assume both operands are in range for an N-bit signed integer. > What's > a good way to efficiently, or at least not too inefficiently, do the > calculations in Python? I'd do something like: bit_mask = (1 << bits) - 1 # 0x

Re: Simulating int arithmetic with wrap-around

2017-01-04 Thread Random832
On Fri, Dec 30, 2016, at 09:47, Steve D'Aprano wrote: > Again, assume both operands are in range for an N-bit signed integer. > What's > a good way to efficiently, or at least not too inefficiently, do the > calculations in Python? I'd do something like: bit_mask = (1 << bits) - 1 # 0x

Re: OT - "Soft" ESC key on the new MacBook Pro

2016-12-19 Thread Random832
On Sun, Dec 18, 2016, at 17:03, Gregory Ewing wrote: > mm0fmf wrote: > > +1 for knowing where CTRL should be. > > Bonus +1 for having used an ASR33. > > And it's quite remarkable that the designers of the ASR33 > knew exactly where it would need to be for Emacs users > years later! I think

Re: Best attack order for groups of numbers trying to destroy each other, given a victory chance for number to number attack.

2016-12-15 Thread Random832
On Thu, Dec 15, 2016, at 08:31, Dennis Lee Bieber wrote: > As for my posts disappearing: I run with "X-NoArchive" set. I have from > before Google absorbed DejaNews. Back then, most news-servers expired > posts > on some periodic basis (my ISP tended to hold text groups for 30 days or > so,

Re: Running python from pty without prompt

2016-12-14 Thread Random832
On Tue, Dec 13, 2016, at 19:20, Steve D'Aprano wrote: > sys.flags.interactive will tell you whether or not your script was > launched > with the -i flag. > > hasattr(sys, 'ps1') or hasattr(sys, 'ps2') will tell you if you are > running > in the REPL (interactive interpreter). The ps1 and ps2

Re: Running python from pty without prompt

2016-12-14 Thread Random832
On Tue, Dec 13, 2016, at 19:10, Steve D'Aprano wrote: > Can you show a simple demonstration of what you are doing? > > I'm having difficulty following this thread because I don't know > what "script run on a tty" means. The question is literally about the input/script being the tty and not

Re: Running python from pty without prompt

2016-12-13 Thread Random832
On Tue, Dec 13, 2016, at 17:09, Michael Torrie wrote: > On 12/13/2016 10:48 AM, Random832 wrote: > > The problem is there's currently no way to differentiate "interactive > > mode" from "script run on a tty". > > > > You can get similar behavior wit

Re: Running python from pty without prompt

2016-12-13 Thread Random832
On Tue, Dec 13, 2016, at 11:01, Michael Torrie wrote: > On 12/13/2016 05:39 AM, Samuel Williams wrote: > > Michael, yes. > > > > FYI, I found out why this works. Pressing Ctrl-D flushes the input > > buffer. If you do this on an empty line, it causes read(...) to return > > 0 which Ruby considers

Re: Splitting text into lines

2016-12-13 Thread Random832
On Tue, Dec 13, 2016, at 12:25, George Trojan - NOAA Federal wrote: > > > > Are repeated newlines/carriage returns significant at all? What about > > just using re and just replacing any repeated instances of '\r' or '\n' > > with '\n'? I.e. something like > > >>> # the_string is your file all

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Random832
On Thu, Dec 8, 2016, at 20:38, Dennis Lee Bieber wrote: > On Thu, 08 Dec 2016 10:37:27 -0500, Random832 <random...@fastmail.com> > declaimed the following: > >There are other issues, like needing a way to do Windows' version of > >wildcard parsing with all its quirks,

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Random832
On Wed, Dec 7, 2016, at 22:41, Steven D'Aprano wrote: > Python's fnmatch lib is a good example. It has, or at least had, no > support for escaping metacharacters. Anyone relying on Python's fnmatch and > glob > modules alone for globbing will be unable to handle legitimate file names. That's not

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Random832
On Wed, Dec 7, 2016, at 15:29, Lew Pitcher wrote: > But, point of fact is that the feature to disable globbing is not often > needed. Most Unix programs that accept filenames are happy to accept a > list of filenames. There is not much call for a program to perform it's own > globbing, like is

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Random832
On Wed, Dec 7, 2016, at 03:50, Peter Otten wrote: > Is there an equivalent to > > # touch -- -r > > on Windows? Doesn't need one - options conventionally start with /, and filenames can't contain /. -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Random832
On Wed, Dec 7, 2016, at 00:15, Steven D'Aprano wrote: > and the shell expands the metacharacters ? {...} * [...] regardless of > how much > smarts the command itself has. > > There are thousands of programs I might use, and they may implement who > knows > how many different globbing rules: >

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-08 Thread Random832
On Thu, Dec 8, 2016, at 01:20, Gregory Ewing wrote: > BartC wrote: > > And globbing doesn't take care of all of it: a Linux program still has > > to iterate over a loop of filenames. The same as on Windows, except the > > latter will need to call a function to deliver the next filename. > >

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Random832
On Tue, Dec 6, 2016, at 02:01, Larry Hudson via Python-list wrote: > On 12/05/2016 06:51 PM, Nathan Ernst wrote: > > IIRC, command.com was a relic of Win9x running on top of DOS and was a > > 16-bit executable, so inherently crippled (and probably never support by > > the NT kernel). Whereby

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Random832
On Mon, Dec 5, 2016, at 21:21, Dennis Lee Bieber wrote: > They are languages in their own right, with their own rules. > > The Windows command prompt being one of the weakest -- it doesn't > support arithmetic and local variables, nor (to my knowledge) looping > constructs. BAT files

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Random832
On Mon, Dec 5, 2016, at 14:48, Michael Torrie wrote: > Wow. Does that actually work? And work consistently? How would it > handle globs like this: The rules are simpler than you're probably thinking of. There's actually no relationship between globs on the left and on the right. Globs on the

Re: Immutability of Floats, Ints and Strings in Python

2016-11-28 Thread Random832
On Fri, Nov 25, 2016, at 06:33, Ned Batchelder wrote: > A Python implementation can choose when to reuse immutable objects and > when not to. Reusing a value has a cost, because the values have to > be kept, and then found again. So the cost is only paid when there's > a reasonable chance that

Re: Calling Bash Command From Python

2016-10-31 Thread Random832
On Mon, Oct 31, 2016, at 10:55, Wildman via Python-list wrote: > I have code using that approach but I am trying to save myself > from having to parse the entire shadow file. Grep will do it > for me if I can get code right. Python already has built-in functions to parse the shadow file.

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Random832
On Tue, Oct 25, 2016, at 02:39, Steven D'Aprano wrote: > Not really. I think that lots of people think they need it, but > once they write a little utility, they often realise that it's not > that useful. That's just my opinion, and I'm one of those guys who > wrote one: > >

Re: Making IDLE3 ignore non-BMP characters instead of throwing an exception?

2016-10-17 Thread Random832
On Mon, Oct 17, 2016, at 14:20, eryk sun wrote: > You can patch print() to transcode non-BMP characters as surrogate > pairs. For example: > > On Windows this should allow printing non-BMP characters such as > emojis (e.g. U+0001F44C). I thought there was some reason this wouldn't work with tk,

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread Random832
On Sat, Oct 8, 2016, at 07:29, Steve D'Aprano wrote: > The oldest version I have access to is the *extremely* primitive 0.9. Not > surprisingly, it doesn't have xrange -- but it lacks a lot of things, > including globals(), map(), named exceptions, "" strings ('' is okay), > exponentiation, and

Re: how to refactor nested for loop into smaller for loop assume each of them independent?

2016-10-08 Thread Random832
On Sat, Oct 8, 2016, at 06:12, BartC wrote: > The OP's code however is a good demonstration of how crazy Python's > original for-range loop was: you need to construct a list of N elements > just to be able to count to N. How many years was it until xrange was > introduced? Python 1.4 had it,

Re: A newbie doubt on methods/functions calling

2016-10-06 Thread Random832
On Thu, Oct 6, 2016, at 19:27, Loren Wilton wrote: > So I don't want to WRITE a Python interpreter for the actual mainframe > environment. I want to use an interpreter for an existing environment > (Windows) where there are already a lot of existing libraries. But > since a lot of the data to be

  1   2   3   4   5   6   7   8   >