Re: reversed(enumerate(x))

2016-07-20 Thread Random832
On Wed, Jul 20, 2016, at 13:42, Ian Kelly wrote: > I had occasion to write something like this: > > for i, n in reversed(enumerate(x)): pass > > How would you write this? I'd write my own version of enumerate with a step argument, and call enumerate(reversed(x), start=len(x), step=-1) -- ht

Re: Just starting to learn Python, and encounter a problem

2016-07-22 Thread Random832
On Fri, Jul 22, 2016, at 09:59, Zagyen Leo wrote: > yeah, it may be quite simple to you experts, but hard to me. > > In one of exercises from the Tutorial it said: "Write a program that asks > the user their name, if they enter your name say "That is a nice name", > if they enter "John Cleese" o

Re: learning python. learning defining functions . need help

2016-07-22 Thread Random832
On Fri, Jul 22, 2016, at 11:21, justin walters wrote: > Try opening the interactive terminal on your command line and type the > following: > > type({}) == dict() > > That should illustrate why. That doesn't illustrate anything relevant at all. The reason this is false is because dict() is

Re: Why not allow empty code blocks?

2016-07-25 Thread Random832
On Sun, Jul 24, 2016, at 18:13, BartC wrote: > (They don't need to be elaborate to start being confusing. Take 'int > *a[]' and 'int (*a)[]'; one of these is an array of pointers, the other > a pointer to an array. Quite different! But which is which? int (*a)[]; === int x[]; where x is (*a). To

Re: Can Python learn from Perl? Perl 5 can now run Perl 6 code

2016-07-28 Thread Random832
On Thu, Jul 28, 2016, at 03:21, Steven D'Aprano wrote: > Well, kinda sorta. I'm not really pulling your leg. But Perl has a > feature that if you tell it to run a file with a hashbang line, it > will call the given executable to run that file. That's now been > improved to recognise Perl6 as an ext

Re: `exec`-based routine crashes app upon migration from 3.4.3 to python 3.5.2.

2016-07-28 Thread Random832
On Thu, Jul 28, 2016, at 11:47, Enjoys Math wrote: > So what's the proper way to get the return value of an exec call when > there is one? Exec calls do not have return values. If you need to pass an object out of the exec call to the surrounding context, you can wrap it in an exception and throw

Re: Why not allow empty code blocks?

2016-07-30 Thread Random832
On Sat, Jul 30, 2016, at 22:10, Steven D'Aprano wrote: > "while True" doesn't merely emulate an infinite loop, it implements an > infinite loop without needing dedicated syntax, byte-code or > implementation. Er, it's not like it would need dedicated byte code anyway. The bytecode of an infinite

Re: Why not allow empty code blocks?

2016-07-30 Thread Random832
On Sat, Jul 30, 2016, at 22:17, Chris Angelico wrote: > Yeah. The distinction means you have a fundamental API difference > between the procedures (which don't return anything) and the functions > (whose return values you mightn't care about). Not really any more than between functions returning d

Re: Procedures and functions [was Re: Why not allow empty code blocks?]

2016-07-30 Thread Random832
On Sun, Jul 31, 2016, at 00:01, D'Arcy J.M. Cain wrote: > On Sun, 31 Jul 2016 13:32:16 +1000 > Steven D'Aprano wrote: > > Many beginners make the mistake of writing: > > > > mylist = mylist.sort() > > > > or try to write: > > > > mylist.sort().reverse() > > > > If we had procedures, that would

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Random832
On Wed, Aug 3, 2016, at 08:29, Malcolm Greene wrote: > Looking for a way to use the Python 3 print() function with encoding and > errors parameters. > > Are there any concerns with closing and re-opening sys.stdout so > sys.stdout has a specific encoding and errors behavior? Would this break > oth

Re: print() function with encoding= and errors= parameters?

2016-08-03 Thread Random832
On Wed, Aug 3, 2016, at 11:09, Peter Otten wrote: > I'm unsure about this myself -- wouldn't it be better to detach the > underlying raw stream? Like Well, "better" depends on your point of view. > The ValueError raised if you try to write to the original stdout > looks like a feature to me. Ma

Re: Capturing the bad codes that raise UnicodeError exceptions during decoding

2016-08-04 Thread Random832
On Thu, Aug 4, 2016, at 15:22, Malcolm Greene wrote: > Hi Chris, > > Thanks for your suggestions. I would like to capture the specific bad > codes *before* they get replaced. So if a line of text has 10 bad codes > (each one raising UnicodeError), I would like to track each exception's > bad code

Re: Python slang

2016-08-05 Thread Random832
On Fri, Aug 5, 2016, at 20:14, Dennis Lee Bieber wrote: > .push() tends to make this one think "stack" and not general purpose > list. It's a bit unusual to have .pop() without a matching .push(). -- https://mail.python.org/mailman/listinfo/python-list

Re: Running Python from the source repo

2016-08-08 Thread Random832
On Mon, Aug 8, 2016, at 15:25, Terry Reedy wrote: > Last January, I wrote a batch file to build all three versions with the > 'optional' extensions. I started rebuilding more often after this. > > 36\pcbuild\build.bat -e -d > 35\pcbuild\build.bat -e -d > 27\pcbuild\build.bat -e -d > > Thanks fo

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 1

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 i

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 a

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 o

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: 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. > > Thi

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 d

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

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 nam

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 r

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 ca

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 > att

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: 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: 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 en

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 s

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 is

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: 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 the

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 t

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 int

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 argume

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 obvious

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: 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: 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 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: 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. Th

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. Let

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: 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 choice

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 on

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'

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 th

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? > Somet

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.

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: What is a function parameter =[] for?

2015-11-24 Thread Random832
On 2015-11-24, Chris Angelico wrote: > On Wed, Nov 25, 2015 at 1:24 AM, Antoon Pardon > wrote: >>> Start thinking of it as a constructor call rather than a literal, and >>> you'll get past most of the confusion. >> >> That doesn't change the fact it does look like a literal and not like >> a const

Re: What is a function parameter =[] for?

2015-11-24 Thread Random832
On 2015-11-24, Chris Angelico wrote: > Probably the grammar. In other words, it's part of the language's very > definition. Then the definition is wrong. I think "literal" is a word whose meaning is generally agreed on, rather than something each language's spec can invent from whole cloth for it

Re: Late-binding of function defaults (was Re: What is a function parameter =[] for?)

2015-11-25 Thread Random832
On 2015-11-25, Ben Finney wrote: > That is, the ‘2’ in ‘cartesian_point = (2, 3)’ means something different > than in ‘cartesian_point = (3, 2)’. > > Whereas the ‘2’ in ‘test_scores = [2, 3]’ means exactly the same as in > ‘test_scores = [3, 2]’. > > If each position in the sequence gives the valu

Re: Question about output different with command dis.dis(code)

2015-11-26 Thread Random832
fl writes: > Python 1.5.2 (#1, Aug 27 2012, 09:09:18) [GCC 4.1.2 20080704 (Red Hat > 4.1.2-52)] on linux2 The context of the post was discussing the behavior of a very old version of python. I'm not sure how you missed this. > When I run the above three line code, I get the following: Further

Re: Late-binding of function defaults (was Re: What is a function parameter =[] for?)

2015-11-26 Thread Random832
Chris Angelico writes: > Windows: I'm not sure, and frankly, I don't trust it. A quick test > showed a couple of failures: > > It might be case insensitive only for ASCII. Windows uses a simple WCHAR->WCHAR (lower->upper) mapping for case comparison. it doesn't handle those cases, but it does ha

Re: What is a function parameter =[] for?

2015-11-26 Thread Random832
Steven D'Aprano writes: > On Thu, 26 Nov 2015 09:34 pm, Dave Farrance wrote: > > >> (Conversely, I see that unlike CPython, all PyPy's numbers have >> unchanging ids, even after exiting PyPy and restarting, so it seems that >> PyPy's numerical ids are "faked".) >> >> [PyPy 2.6.1 with GCC 4.9.2]

Re: Caret key quits idle on pt keyboard

2015-11-30 Thread Random832
On 2015-11-30, Chris Angelico wrote: > Hmm. This could be part of the known issues with Tk (on which Idle > depends) and non-BMP characters, but a caret should be safe. Is there a known issue with dead keys? From what I can find the Portuguese keyboard doesn't have a "proper" caret, it has a circ

Re: "Downloading"

2015-12-01 Thread Random832
On 2015-12-01, Steve Hayes wrote: > You download things FROM a computer, you upload them TO a computer. I'm a little bit confused as to what kinds of file transfers you think don't have at least two endpoints. -- https://mail.python.org/mailman/listinfo/python-list

Re: Unicode failure

2015-12-04 Thread Random832
On 2015-12-04, Terry Reedy wrote: > Tk widgets, and hence IDLE windows, will print any character from \u > to \u without raising, even if the result is blank or �. Higher > codepoints fail, but allowing the entire BMP is better than any Windows > codepage. Well, any bar 1200, 1201, 12

Re: Unicode failure

2015-12-05 Thread Random832
On 2015-12-05, Terry Reedy wrote: > On 12/4/2015 10:22 PM, Random832 wrote: >> Well, any bar 1200, 1201, 12000, 12001, 65000, 65001, and 54936. > > Test before you post. As someone else pointed out, I meant that as a list of codepages which support all Unicode codepoints

Re: Unicode failure

2015-12-06 Thread Random832
Mark Lawrence writes: > On 06/12/2015 09:06, Dave Farrance wrote: >> "D'Arcy J.M. Cain" wrote: >>> utf-8 >>> Traceback (most recent call last): >>> File "./g", line 5, in >>> print(u"\N{TRADE MARK SIGN}") >>> UnicodeEncodeError: 'ascii' codec can't encode character '\u2122' in >>> position

Message-IDs on Usenet gateway

2015-12-06 Thread Random832
Dave Farrance writes: > That raises another question. I'm seeing a number of broken threads > because people reply to posts that are not present in Usenet. It's not > just my main news-server because my newreader can gather posts from > several Usenet servers and those posts are nowhere on Usene

Re: Ignore error with non-zero exit status

2015-12-21 Thread Random832
Thomas 'PointedEars' Lahn writes: > Chris Angelico wrote: CA Proof that percent formatting isn't planned for deprecation, much less CA removal. TL>>> Then it would have failed to accomplish that. CA There is strong support for it in certain quarters of python-dev. […] TL>>> There *was*.

Re: Meaning and purpose of the Subject field

2015-12-21 Thread Random832
Cameron Simpson writes: > Besides, changing the Subject line is _supposed_ to break the > threading in these contexts: such clients clearly consider the > discussion topic (subject) as sufficient definition of a thread, and > changing the topic should imply a new thread to such simplistic > client

Why doesn't os.remove work on directories?

2015-12-22 Thread Random832
This is surprising to anyone accustomed to the POSIX C remove function, which can remove either files or directories. Is there any known rationale for this decision? -- https://mail.python.org/mailman/listinfo/python-list

Re: how to get names of attributes

2015-12-30 Thread Random832
On Wed, Dec 30, 2015, at 07:50, Chris Angelico wrote: > I believe that's true, yes. The meaning of "by default" there is that > "class X: pass" will make an old-style class. All built-in types are > now new-style classes. To be clear, AFAIK, built-in types were never old-style classes - prior to t

Re: Newbie: Check first two non-whitespace characters

2015-12-31 Thread Random832
otaksoftspamt...@gmail.com writes: > I need to check a string over which I have no control for the first 2 > non-white space characters (which should be '[{'). > > The string would ideally be: '[{...' but could also be something like > ' [ { '. > > Best to use re and how? Something else? I

Re: GitHub's ³pull request² is proprietary lock-in

2016-01-02 Thread Random832
Michael Vilain writes: > We used stash/bitbucket at my last contract. It's the second site I've > come across that used Atlasian's toolset. Yes, I know it's not > statistically significant. > > Anyway, the pull/merge request workflow is becoming pretty standard. I think you're missing a disti

Re: GitHub's ³pull request² is proprietary lock-in

2016-01-03 Thread Random832
Chris Angelico writes: > They are. Ultimately, a GitHub pull request is backed by a git pull > request. There is no such thing as a "git pull request", except in the ordinary english meaning of the word request. It is true that a pull request is, from one angle, a formalized request for someone t

Re: GitHub's “pull request” is proprietary lock-in

2016-01-03 Thread Random832
Just as a general comment, I note there are now at least four mangled versions of this subject header, and threading is already fragile enough on this list. I think in the future it would be best to avoid non-ASCII characters in subject lines. -- https://mail.python.org/mailman/listinfo/python-l

Re: GitHub's “pull request” is proprietary lock-in

2016-01-03 Thread Random832
Michael Torrie writes: > I noticed this too. Though threading based on message-id is working > quite well, as designed! It doesn't work as well here as elsewhere, though, because message-ids get rewritten by the usenet gateway, so the IDs referenced in people's headers differ depending on whether

Re: imshow keeps crashhing

2016-01-07 Thread Random832
On Wed, Jan 6, 2016, at 18:37, William Ray Wing wrote: > Is this a typo or did you really mean /private/vars? That is, did your > create a “vars” directory under /private at some point in the past > (pre-Yosemite)? The usual directory there would be /var > > In any case, the whole /private direc

Re: Stop writing Python 4 incompatible code

2016-01-13 Thread Random832
On Wed, Jan 13, 2016, at 09:21, sjms...@gmail.com wrote: > This strikes me as very good advice. Thanks for being so far-sighted. > And let's hope that Python 4 has fewer incompatibilities (none would > good) than Python 3! Who says there's going to be a Python 4? I always assumed 3.9 would be fol

Re: "x == None" vs "x is None"

2016-01-17 Thread Random832
writes: > I prefer (x is None) and (x is not None). > > This matches the SQL concept of NULL. > > (X = NULL) is not valid since NULL is not a value and cannot be compared > with anything. The suitably generic SQL operator is "is (not) distinct from", in some dialects of SQL [certainly if you're

Re: When is an int not an int? Who can explain this?

2016-01-18 Thread Random832
On Mon, Jan 18, 2016, at 11:51, Chris Angelico wrote: > Armed with that information, you should be able to track down what's > going on. It's curious, though, that you have a callable subclass of > module bound to the name int. Very curious indeed. He hasn't tried calling it. And there's no reason

Re: Question about function parameter copy

2016-01-18 Thread Random832
On Mon, Jan 18, 2016, at 13:44, Robert wrote: > cdef inline dtype_t _logsumexp(dtype_t[:] X) nogil: > . > > fwdlattice[t, j] = _logsumexp(work_buffer) + framelogprob[t, j] > > I find that [:] is about object copy, but I am not sure about its usage > here in a function parameter. W

Re: How to simulate C style integer division?

2016-01-21 Thread Random832
On Thu, Jan 21, 2016, at 09:31, Marko Rauhamaa wrote: > Maybe: > >def intdiv(a, b): >return a // b if (a < 0) == (b < 0) else -(-a // b) Personally, I like a // b + (a % b and a ^ b < 0) - I've done the opposite in C to get python-style division. -- https://mail.python.org/mailman/li

Re: How to simulate C style integer division?

2016-01-21 Thread Random832
Terry Reedy writes: > But fails with remainder 0, as others noted. Lesson: include corner > cases in validation test. Anyway, my main point about writing a clear > spec remains true. My validation test for this was to loop both numerator and denominator from -5 to 5 (skipping denominator 0) to

Re: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread Random832
On Mon, Jan 25, 2016, at 12:19, MRAB wrote: > Do you really want to insist that the format string always used _all_ of > the arguments? Um, yes? Why on earth _wouldn't_ you want to insist that? -- https://mail.python.org/mailman/listinfo/python-list

Re: .format won't display my value with 2 decimal places: Why?

2016-01-25 Thread Random832
On Mon, Jan 25, 2016, at 12:23, Chris Angelico wrote: > if some translations don't use a token at all, I'm not sure what situation that would be reasonable in. -- https://mail.python.org/mailman/listinfo/python-list

Re: psss...I want to move from Perl to Python

2016-01-29 Thread Random832
On Fri, Jan 29, 2016, at 04:12, Ulli Horlacher wrote: > Steven D'Aprano wrote: > > > Every time I make a half-hearted attempt to learn enough Perl syntax to get > > started, I keep running into the differences between $foo, %foo and @foo > > and dire warnings about what happens if you use the wro

Re: Mimick tac with python.

2016-01-29 Thread Random832
On Fri, Jan 29, 2016, at 23:46, Hongyi Zhao wrote: > Hi all, > > I can use the following methods for mimicking tac command bellow: > > awk '{a[NR]=$0} END {while (NR) print a[NR--]}' input_file > perl -e 'print reverse<>' input_file Well, both of those read the whole file into memory - tac is so

Re: Efficient Wrappers for Instance Methods

2016-02-03 Thread Random832
On Wed, Feb 3, 2016, at 16:43, Sven R. Kunze wrote: > Actually a nice idea if there were no overhead of creating methods for > all heap instances separately. I'll keep that in mind. :) What about changing the class of the object to one which is inherited from its original class and has the method

Re: Reply to whom? (was: Efficient Wrappers for Instance Methods)

2016-02-03 Thread Random832
On Wed, Feb 3, 2016, at 16:50, Ben Finney wrote: > (You will also have a “reply to all” command. That's almost never > appropriate in a forum like this.) Why not? People reply all to messages I write all the time, and I find it somewhat useful since it separates replies to things I have said from

Re: Efficient Wrappers for Instance Methods

2016-02-04 Thread Random832
On Thu, Feb 4, 2016, at 11:18, Sven R. Kunze wrote: > On 04.02.2016 00:47, Random832 wrote: > > On Wed, Feb 3, 2016, at 16:43, Sven R. Kunze wrote: > >> Actually a nice idea if there were no overhead of creating methods for > >> all heap instances separately. I'l

Re: A sets algorithm

2016-02-08 Thread Random832
On Sun, Feb 7, 2016, at 20:07, Cem Karan wrote: > a) Use Chris Angelico's suggestion and hash each of the files (use the > standard library's 'hashlib' for this). Identical files will always have > identical hashes, but there may be false positives, so you'll need to verify > that files t

Re: Set Operations on Dicts

2016-02-08 Thread Random832
On Mon, Feb 8, 2016, at 08:32, Matt Wheeler wrote: > On 8 February 2016 at 12:17, Jussi Piitulainen > wrote: > > Also, what would be the nicest current way to express a priority union > > of dicts? > > > > { k:(d if k in d else e)[k] for k in d.keys() | e.keys() } > > Since Python 3.5: {**e, **d}

Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO

2016-02-08 Thread Random832
On Mon, Feb 8, 2016, at 10:40, Ian Kelly wrote: > Besides, you're forgetting that the whole point of having so many > backwards incompatible changes in Python 3 in the first place was to > get them out of the way and not have to do them further into the > future. Python 4.0 has never been planned t

Re: [STORY-TIME] THE BDFL AND HIS PYTHON PETTING ZOO

2016-02-08 Thread Random832
On Mon, Feb 8, 2016, at 10:46, Chris Angelico wrote: > > I still think we should just retroactively declare 3.5 to be python 5, > > and then keep going with python 6, 7, etc... > > http://dirtsimple.org/2004/12/python-is-not-java.html Java's hardly the only, or even the first, project to drop a v

Re: tarfile : read from a socket?

2016-02-11 Thread Random832
On Thu, Feb 11, 2016, at 11:41, Ulli Horlacher wrote: > When I use: > > for member in taro.getmembers(): > print('extracting "%s"' % member.name) > taro.extract(member) > > I get the error: > > File "/usr/lib/python2.7/tarfile.py", line 556, in seek > raise StreamError("seeki

Re: tarfile : secure extract?

2016-02-12 Thread Random832
On Thu, Feb 11, 2016, at 18:24, Ulli Horlacher wrote: > A better approach would be to rename such files while extracting. > Is this possible? What happens if you change member.name before extracting? -- https://mail.python.org/mailman/listinfo/python-list

Re: repr( open('/etc/motd', 'rt').read() )

2016-02-15 Thread Random832
On Mon, Feb 15, 2016, at 08:05, Veek. M wrote: > What is happening with # 1 # (repr)? > repr calls __repr__ which gives you bytes.. why does this result in \\n When you call a function that returns a string directly in the interpreter prompt (i.e. without print), it passes the result to repr, whic

Re: Guido on python3 for beginners

2016-02-17 Thread Random832
On Thu, Feb 18, 2016, at 01:47, Steven D'Aprano wrote: > There are more features in Python 3, so in that trivial sense of "more to > learn", I suppose that it is objectively correct that it is harder to > learn > than Python 2. But I don't think the learning curve is any steeper. If > anything,

Re: Guido on python3 for beginners

2016-02-18 Thread Random832
On Thu, Feb 18, 2016, at 07:25, Rustom Mody wrote: > My beef is somewhat different: viz that post 70s (Pascal) and 80s > (scheme) > programming pedagogy has deteriorated with general purpose languages > replacing > 'teaching-purpose language' for teaching. The flaw in this idea is right there in

Re: Considering migrating to Python from Visual Basic 6 for engineering applications

2016-02-22 Thread Random832
On Mon, Feb 22, 2016, at 05:46, Steven D'Aprano wrote: > Jussi, I think you have an inflated expectation of what was available in > 1976. Command line? What's that? Programs ran in batch mode, > and 'interactive' meant that you could easily slip out one punched card, > replace it with a different o

Re: Make a unique filesystem path, without creating the file

2016-02-22 Thread Random832
On Mon, Feb 22, 2016, at 14:32, Marko Rauhamaa wrote: > urandom() is not quite random and so should not be considered > cryptographically airtight. > > Under Linux, /dev/random is the way to go when strong security is > needed. Note that /dev/random is a scarce resource on ordinary systems. http:

Re: setting the font of the root title

2016-02-23 Thread Random832
On Tue, Feb 23, 2016, at 11:30, kevind0...@gmail.com wrote: > Hello: > > Newbee here. > > I need to change the font of the title of the root. > Actually I just need it to be larger, which means I may need the > top boarder to be larger. > > I wrote the bit of code below, hoping for the desired

<    1   2   3   4   5   6   7   8   >