Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-30 Thread Random832
On Wed, Mar 30, 2016, at 12:59, Rustom Mody wrote: > On Wednesday, March 30, 2016 at 7:56:50 PM UTC+5:30, Ben Bacarisse wrote: > > Dennis Lee Bieber writes: > > Sorry Dennis > Dont see you at all > Neither on googlegroups -- which of course everyone loves to hate > Nor the archive: > https://mail

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-30 Thread Random832
On Wed, Mar 30, 2016, at 19:01, Dennis Lee Bieber wrote: > Though I'm surprised GoogleGroups would expire that fast. > > Google is the reason I inserted that header -- I started back in the > days when news-servers routinely expired stuff (text groups about monthly > lifespan, the bina

Re: Threading is foobared?

2016-03-30 Thread Random832
On Thu, Mar 31, 2016, at 00:50, Mark Sapiro wrote: > What Mailman does do as noted by Random832 is replace the Message-ID: > header value in posts gated to Usenet with a list specific, Mailman > generated unique value. There is a reason for this, and that reason is > if a message is

Re: Threading is foobared?

2016-03-30 Thread Random832
On Thu, Mar 31, 2016, at 01:25, Random832 wrote: > > if a message is cross-posted to two lists which both gateway to Usenet, > > and Mailman didn't make the Message-IDs unique, the news server would > > discard one of the two posts as a duplicate and the post would be >

Re: Threading is foobared?

2016-03-30 Thread Random832
On Thu, Mar 31, 2016, at 01:25, Random832 wrote: > Actually, merely prepending the original Message-ID itself append, not prepend... I'd misremembered the order that References go in. -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestion: make sequence and map interfaces more similar

2016-03-31 Thread Random832
On Thu, Mar 31, 2016, at 09:17, Mark Lawrence via Python-list wrote: > On 31/03/2016 14:08, Antoon Pardon wrote: > > Op 31-03-16 om 13:57 schreef Chris Angelico: > >> Okay. I'll put a slightly different position: Prove that your proposal > >> is worth discussing by actually giving us an example tha

Re: Strange range

2016-04-01 Thread Random832
On Fri, Apr 1, 2016, at 10:12, Marko Rauhamaa wrote: > Yes, I realize it now. I had thought it was: > > def range(start, end=None, step=1): > if end is None: > start, end = 0, start > i = start > while step * (end - i) > 0: > yield i >

Re: Strange range

2016-04-01 Thread Random832
On Fri, Apr 1, 2016, at 09:24, Chris Angelico wrote: > It is an iterable. It is not a factory, as that implies that you call > it. I do have an objection to this statement. It's perfectly reasonable to describe the factory pattern as applying to objects on which you call a method to return the new

Re: Set type for datetime intervals

2016-04-01 Thread Random832
On Fri, Apr 1, 2016, at 01:24, Nagy László Zsolt wrote: > > Hello, > > I need to compare sets of datetime intervals, and make set operations on > them: intersect, union, difference etc. One element of a set would be an > interval like this: Two thoughts on this: Such an object is not precisel

Re: Set type for datetime intervals

2016-04-01 Thread Random832
More thoughts... sorry. On Fri, Apr 1, 2016, at 01:24, Nagy László Zsolt wrote: > > Hello, > > I need to compare sets of datetime intervals, and make set operations on > them: intersect, union, difference etc. One element of a set would be an > interval like this: > > element ::= (start_poin

Re: extract rar

2016-04-01 Thread Random832
On Fri, Apr 1, 2016, at 15:22, Jianling Fan wrote: > Hello everyone, > > I am wondering is there any way to extract rar files by python without > WinRAR software? > > I tried Archive() and patool, but seems they required the WinRAR > software. Rar is a proprietary format. They do distribute a fr

Re: [beginner] What's wrong?

2016-04-01 Thread Random832
On Fri, Apr 1, 2016, at 19:29, Michael Selik wrote: > Humans have always had trouble with this, in many contexts. I remember > being annoyed at folks saying the year 2000 was the first year of the new > millennium, rather than 2001. They'd forgotten the Gregorian calendar > starts from AD 1. Natur

Re: Drowning in a teacup?

2016-04-02 Thread Random832
On Sat, Apr 2, 2016, at 15:28, Ned Batchelder wrote: > On Friday, April 1, 2016 at 4:27:30 PM UTC-4, Fillmore wrote: > > notorious pass by reference vs pass by value biting me in the backside > > here. Proceeding in order. > > As others have pointed out, this is false dichotomy. There are other

Re: Drowning in a teacup?

2016-04-02 Thread Random832
On Sat, Apr 2, 2016, at 19:15, Ethan Furman wrote: > Also, if "pass-by-value" is being used, even mutation of the passed > object will not show up in the caller. I disagree. I don't think the definition of pass-by-value implies this. -- https://mail.python.org/mailman/listinfo/python-list

Re: Strange range

2016-04-02 Thread Random832
On Sun, Apr 3, 2016, at 00:43, Steven D'Aprano wrote: > If you personally don't see any advantage in this, so be it, but you > might > not be aware of the history of (x)range: > > Guido in 2001: "Nobody uses this extra functionality, and its buggy, > let's > get rid of it." > > https://www.python

Re: Sorting a list

2016-04-04 Thread Random832
On Mon, Apr 4, 2016, at 02:56, Peter Otten wrote: > > That works well. Why is it 'cheating'? > > On second thought it isn't ;) It does require a numeric type, though. There are lots of types that are orderable but do not have a negation operator that provides a key with reversed ordering. -- ht

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-04 Thread Random832
On Mon, Apr 4, 2016, at 03:12, Nagy László Zsolt wrote: > > Hi All, > > If anyone is interested, a module was born: > > https://bitbucket.org/nagylzs/intervalset > https://pypi.python.org/pypi/intervalset/0.1.1 I don't know if I like it being immutable. Maybe have separate mutable and immutab

Re: Set type for datetime intervals

2016-04-04 Thread Random832
On Mon, Apr 4, 2016, at 06:15, Nagy László Zsolt wrote: > If you define the intersection operation on interval sets only, then you > need to write something like this: > > if IntervalSet(i1)*IntervalSet(i2): > pass > > which is both uglier and an overkill. I guess what I don't understand in

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-04 Thread Random832
On Mon, Apr 4, 2016, at 11:32, Oscar Benjamin wrote: > On 4 April 2016 at 16:09, Random832 wrote: > > Like I said before, I don't think the set-like operations on Intervals > > are useful - what can you accomplish with them rather than by making a > > set consisting of o

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-05 Thread Random832
On Tue, Apr 5, 2016, at 01:44, Nagy László Zsolt wrote: > If you want to manipulate an interval set, you cannot just "add another > interval" to it. Adding an interval may result in unifying thousands of > other intervals. It is possible that you add a wide interval to a set > with 1000 elements, a

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-05 Thread Random832
On Tue, Apr 5, 2016, at 04:11, Nagy László Zsolt wrote: > But there is still need to check begin <= end. But maybe > you are right: if we suppose that nobody will try to use an interval > where end < begin then we can use plain tuples. But then the user *must* > make sure not to use invalid interv

Re: ANN: intervalset Was: Set type for datetime intervals

2016-04-06 Thread Random832
On Tue, Apr 5, 2016, at 17:37, Nagy László Zsolt wrote: > > >> It is blurred by design. There is an interpretation where an interval > >> between [0..4] equals to a set of intervals ([0..2],[2..4]). > > No, because 2.5 is in one and not the other. > My notation was: 0..4 for any number between 0

Re: Untrusted code execution

2016-04-06 Thread Random832
On Tue, Apr 5, 2016, at 21:43, Steven D'Aprano wrote: > As Zooko says, Guido's "best argument is that reducing usability (in > terms > of forbidding language features, especially module import) and reducing > the > usefulness of extant library code" would make the resulting interpreter > too > feeb

Re: Untrusted code execution

2016-04-06 Thread Random832
On Wed, Apr 6, 2016, at 12:04, Chris Angelico wrote: > On Thu, Apr 7, 2016 at 1:41 AM, Ian Kelly wrote: > > type might also be a concern since it can be used to assemble > > arbitrary classes. > > Sadly, this means denying the ability to interrogate an object for its > type. And no, this won't do

Re: Promoting Python

2016-04-06 Thread Random832
On Wed, Apr 6, 2016, at 14:23, Marko Rauhamaa wrote: > Chris Angelico : > > > Plus, anyone could implement a Python interpreter with TCE. > > Tricky in practice because None is the default return value. > > If the programmer were careful to return the value of the tail call, it > can be eliminat

Re: recursive methods require implementing a stack?

2016-04-06 Thread Random832
On Wed, Apr 6, 2016, at 16:21, Charles T. Smith wrote: > I just tried to write a recursive method in python - am I right that > local > variables are only lexically local scoped, so sub-instances have the same > ones? Is there a way out of that? Do I have to push and pop my own > simulated > stac

Re: Untrusted code execution

2016-04-06 Thread Random832
On Wed, Apr 6, 2016, at 21:45, Steven D'Aprano wrote: > And you would have to do something about the unfortunate matter that > modules > have a reference to the unrestricted __builtins__: > > py> os.__builtins__['eval'] > Well, I thought that the solution being discussed uses AST to generally fo

Re: read a file and remove Mojibake chars

2016-04-07 Thread Random832
On Thu, Apr 7, 2016, at 04:47, Daiyue Weng wrote: > Hi, when I read a file, the file string contains Mojibake chars at the > beginning, the code is like, > > file_str = open(file_path, 'r', encoding='utf-8').read() > print(repr(open(file_path, 'r', encoding='utf-8').read()) > > part of the string

Re: Untrusted code execution

2016-04-07 Thread Random832
On Thu, Apr 7, 2016, at 00:48, Steven D'Aprano wrote: > Sure, but I'm just demonstrating that the unrestricted builtins are just > one > attribute lookup away. And as Chris points out, if you have (say) the os > module, then: > > magic = os.sys.modules[ > ''.join(chr(i-1) for i in > (96,

Re: Untrusted code execution

2016-04-07 Thread Random832
On Thu, Apr 7, 2016, at 08:13, Jon Ribbens wrote: > > All the obvious, and even not-so-obvious, attack tools are gone: > > eval, exec, getattr, type, __import__. We don't even need to take these away, per se. eval and exec could be replaced with functions that perform the evaluation with the same

Re: how to convert code that uses cmp to python3

2016-04-08 Thread Random832
On Fri, Apr 8, 2016, at 10:08, Chris Angelico wrote: > seq1 == seq2 > seq1 < seq2 > > You only need ONE comparison, and the other is presumed to be its > opposite. When, in the Python 3 version, would you need to compare > twice? == might be just as expensive as the others, particularly if the se

test post please ignore

2016-04-08 Thread Random832
Testing posting from an email address other than the one I'm subscribed in, to determine whether it's possible to post to the list without being subscribed. -- https://mail.python.org/mailman/listinfo/python-list

Re: Repair??

2016-04-08 Thread Random832
I suspect that the reason that a lot of people who report issues like this don't seem to follow up is that they may not be subscribed to the list, and replies are sent to the list exclusively. Quoting the entire reply so they see it. On Fri, Apr 8, 2016, at 21:24, Ben Finney wrote: > Amaya McLean

Re: Repair??

2016-04-09 Thread Random832
- Original message - From: Amaya McLean To: Random832 Subject: Re: Repair?? Date: Sat, 9 Apr 2016 10:41:52 -0400 How, specifically, are you installing Python? There are many ways, and > we can't guess which you use. > I'm trying to install Python on my laptop, from py

Re: QWERTY was not designed to intentionally slow typists down (was: Unicode normalisation [was Re: [beginner] What's wrong?])

2016-04-09 Thread Random832
On Fri, Apr 8, 2016, at 23:28, Steven D'Aprano wrote: > And how did it enable fast typing? By *slowing down the typist*, and thus > having fewer jams. Er, no? The point is that type bars that are closer together collide more easily *at the same actual typing speed* than ones that are further apart

Re: QWERTY was not designed to intentionally slow typists down (was: Unicode normalisation [was Re: [beginner] What's wrong?])

2016-04-09 Thread Random832
On Fri, Apr 8, 2016, at 23:28, Steven D'Aprano wrote: > This is the power of the "slowing typists down is a myth" meme: same > Wikipedia contributor takes an article which *clearly and obviously* > repeats the conventional narrative that QWERTY was designed to > decrease the number of key presses p

Re: how to convert code that uses cmp to python3

2016-04-09 Thread Random832
On Sat, Apr 9, 2016, at 07:49, Ben Finney wrote: > I find that a dubious claim. > > The ‘cmp’ implementation must decide *at least* between three > conditions: less-than, equal-to, greater-than. That is *at least* two > inflection points. Yes, but in a sequence it can decide that at each element,

Re: Unacceptable behavior

2016-04-10 Thread Random832
On Sun, Apr 10, 2016, at 13:15, breamore...@gmail.com wrote: > Or are you in the camp that believes when someone > is too bone idle to do any work for themselves, and turns up here asking > for us to write all of their code for them, we should kill the fatted > calf, roll out the red carpet, and th

Re: Parens do create a tuple

2016-04-10 Thread Random832
On Sun, Apr 10, 2016, at 22:32, Steven D'Aprano wrote: > def func(arg1, arg2, arg3): > pass > > func(1, 2, 3) > > does not create a tuple (1, 2, 3) anywhere in its execution. Well, the second argument to PyObject_Call and function_call is a tuple, which had to come from somewhere. That may

Re: Parens do create a tuple

2016-04-10 Thread Random832
On Mon, Apr 11, 2016, at 00:08, Steven D'Aprano wrote: > Should we say that the / and - operators therefore create tuples? I don't > think so. But I am talking about the tuple that is passed to FunctionType.__call__ at runtime, not a tuple created within some parser stage. -- https://mail.python.

Re: Parens do create a tuple

2016-04-11 Thread Random832
On Mon, Apr 11, 2016, at 04:01, Steven D'Aprano wrote: > What tuple that is passed to FunctionType.__call__? > > Where is the tuple in these examples? > > > py> from types import FunctionType > py> FunctionType.__call__(lambda x: x+1, 23) > 24 > py> FunctionType.__call__(lambda x, y: str(x)+str(

Re: Is threading better on Usenet or gmane?

2016-04-11 Thread Random832
On Mon, Apr 11, 2016, at 10:24, Grant Edwards wrote: > I've been reading c.l.p on Usenet for many, many years. There has > always been a certain abount of thread breakage (presumably due to > broken e-mail clients and/or the list<->usenet gateway), but it seems > to have gotten worse lately. > >

Re: sys.exit(1) vs raise SystemExit vs raise

2016-04-12 Thread Random832
On Tue, Apr 12, 2016, at 08:50, Ganesh Pal wrote: > I m on python 2.7 and Linux , I have a simple code need suggestion if > I > I could replace sys.exit(1) with raise SystemExit . No; raise SystemExit is equivalent to sys.exit(0); you would need raise SystemExit(1) to return 1. Why do you wa

Re: sys.exit(1) vs raise SystemExit vs raise

2016-04-12 Thread Random832
On Tue, Apr 12, 2016, at 10:12, Ganesh Pal wrote: > > > > > > No; raise SystemExit is equivalent to sys.exit(0); you would need raise > > SystemExit(1) to return 1. > > > > Thanks will replace SystemExit with SystemExit(1) . > > > > > Why do you want to do this, though? What do you think you ga

Re: sum accuracy

2016-04-13 Thread Random832
On Wed, Apr 13, 2016, at 12:51, Robin Becker wrote: > Does anyone know if sum does anything special to try and improve > accuracy? My > simple tests seem to show it is exactly equivalent to a for loop > summation. No, it doesn't. Sum works on any type that can be added (except strings), it can't

Re: how to setup for localhost:8000

2016-04-14 Thread Random832
Just a note, some browsers will try to resolve this as www.localhost.com - try http://127.0.0.1:8000 . On Thu, Apr 14, 2016, at 14:06, Andrew Farrell wrote: > What happens when you type > > http://localhost:8000 > > Into the address bar of your browser as this is running? -- https://mail.python

Re: installing python

2016-04-14 Thread Random832
On Thu, Apr 14, 2016, at 13:59, Cheryl Arko wrote: > I am having issues installing the python software on my laptop. I have > tried to install it several times and when I try to get into the program > it > keeps giving me options to modify, repair or uninstall. I have tried all > of those options

Re: Falsehoods People Believe about PEP 8 (was: Guido sees the light: PEP 8 updated)

2016-04-16 Thread Random832
On Sat, Apr 16, 2016, at 16:21, Ben Finney wrote: > * Oh, come on, no-one would use U+000C FORM FEED in source code. Some text editors have shortcuts to navigate to the previous/next line that begins with a form feed. -- https://mail.python.org/mailman/listinfo/python-list

Re: Fraud

2016-04-16 Thread Random832
On Sat, Apr 16, 2016, at 20:20, Joel Goldstick wrote: > As it turns out, the OP hasn't engaged in any further back and forth, > which to me enforces my original post. It's entirely possible he's not subscribed to the mailing list. -- https://mail.python.org/mailman/listinfo/python-list

Re: Guido sees the light: PEP 8 updated

2016-04-16 Thread Random832
On Sat, Apr 16, 2016, at 21:30, Tim Chase wrote: > On 2016-04-16 19:39, eryk sun wrote: > > On Sat, Apr 16, 2016 at 4:50 PM, Tim Chase wrote: > > > I also do some editing/diffing within a cmd.exe window on Windows > > > which is limited to 80 characters unless you do some hijinks in > > > the setti

Re: Guido sees the light: PEP 8 updated

2016-04-16 Thread Random832
On Sun, Apr 17, 2016, at 01:01, eryk sun wrote: > It doesn't support fonts that mix half-width and full-width glyphs. This is the most baffling bit to me. I mean, it _has_ to, for Chinese, Japanese, and Korean users. This support obviously exists in the code. Why not extend it to everyone, inste

Re: Moderation and slight change of (de facto) policy

2016-04-17 Thread Random832
On Sun, Apr 17, 2016, at 18:08, Matt Ruffalo wrote: > Hi- > > That seems like a reasonable approach, though I think there *really* > needs to be an option along the lines of "subscribed to the list for the > purposes of moderation, but not receiving list messages via email". There is. I'm on seve

Re: Guido sees the light: PEP 8 updated

2016-04-17 Thread Random832
On Sun, Apr 17, 2016, at 19:56, Gregory Ewing wrote: > And then legacy command-line exes will be supported by running > cmd.exe under WINE in the Linux subsystem. Running the command directly under WINE, more like. Because cmd.exe is pretty terrible as a scripting language and command interpreter

Re: QWERTY was not designed to intentionally slow typists down (was: Unicode normalisation [was Re: [beginner] What's wrong?])

2016-04-17 Thread Random832
On Sun, Apr 17, 2016, at 21:39, Steven D'Aprano wrote: > Oh no, it's the thread that wouldn't die! *wink* > > Actually, yes it is. At least, according to this website: > > http://www.mit.edu/~jcb/Dvorak/history.html I'd really rather see an instance of the claim not associated with Dvorak marketi

Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Random832
On Mon, Apr 18, 2016, at 23:04, Rustom Mody wrote: > See elastic tabstops: http://nickgravgaard.com/elastic-tabstops/ >From there: >A column block is a run of uninterrupted vertically adjacent cells. How's that going to handle this case: if foo: # comment that is aligned do some

Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Random832
On Mon, Apr 18, 2016, at 23:54, Rustom Mody wrote: > Start no tabs: > if foo# comment that is aligned > do some stuff# across multiple indent levels > > Add tabs as leading indents with second line indented 1 tab more > (showing tabs as |) > |if foo# comment that is aligned > ||do some stuff# acr

Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Random832
On Tue, Apr 19, 2016, at 08:55, Rustom Mody wrote: > > Like, it ends up looking like this: > > > > if foo("what if it's a much longer condition"):# comment > > do something # > > comm

Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Random832
On Tue, Apr 19, 2016, at 12:05, Steven D'Aprano wrote: > It's worse than that. There are many other places that mirror this group, > such as gmane, Activestate, bytes.com, gossamer-threads.com, and of > course > Google Groups. Google groups goes through Usenet, and would be affected equally by a

Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Random832
On Tue, Apr 19, 2016, at 13:43, Tim Chase wrote: > Well, let's take a look at their native file formats: > > Inkscape: SVG > > Libreoffice: compressed XML > > Firefox: HTML+CSS+JS > > Musescore: compressed text > > Dia: compressed XML None of those are "text" in the sense being discussed here

Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Random832
On Tue, Apr 19, 2016, at 13:55, Jon Ribbens wrote: > On 2016-04-19, Steven D'Aprano wrote: > > It's worse than that. There are many other places that mirror this group, > > such as gmane, Activestate, bytes.com, gossamer-threads.com, and of course > > Google Groups. They all have their own moderat

Re: Moderation and slight change of (de facto) policy

2016-04-19 Thread Random832
On Tue, Apr 19, 2016, at 15:01, Ethan Furman wrote: > The only thing changing is what happens if someone posts /directly/ to > the mailing list (not through gmane, etc). Is the mailing list software able to make that distinction? I thought that was on gmane's end. -- https://mail.python.org/mail

Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Random832
On Tue, Apr 19, 2016, at 20:02, Tim Chase wrote: > Well, my preferred method of "viewing" python code is /usr/bin/python > > Authoring, editing, and consuming are all distinct actions. Viewing and executing are also distinct. > > You could, for example, design a programming language that uses X

Re: Guido sees the light: PEP 8 updated

2016-04-19 Thread Random832
On Tue, Apr 19, 2016, at 20:34, Steven D'Aprano wrote: > That's not the sense of being discussed here. Yes it is - this started as a discussion of whether indentation and alignment should be based on fixed spaces (as text editors support) or dynamic tab stops (as any word processing format support

Re: Running lpr on windows from python

2016-04-20 Thread Random832
On Wed, Apr 20, 2016, at 09:57, loial wrote: > I am trying to run lpr from python 2.7.10 on windows > > However I always get the error > 'C:/windows/system32/lpr.exe ' is not recognized as an internal or > external command, > operable program or batch file. > > Even though typing the same at the

Re: PEP proposal: sequence expansion support for yield statement: yield *

2016-04-20 Thread Random832
On Wed, Apr 20, 2016, at 15:34, Ken Seehart wrote: > Currently the common pattern for yielding the elements in a sequence is > as follows: > > for x in sequence: yield x > > I propose the following replacement (the result would be identical): > > yield *sequence yield from sequence -- http

How are you supposed to define subclasses in C?

2016-04-21 Thread Random832
I was trying to write a proof of concept on including descriptors (e.g. a "sys.recursionlimit" instead of set/get methods) in the sys module, and couldn't figure out how to "properly" define a type using PyType_FromSpecWithBases. Everything I tried just segfaulted. I ended up just calling PyObject_

Re: Can't run lpr from python on windows 2012 server

2016-04-22 Thread Random832
On Fri, Apr 22, 2016, at 10:15, loial wrote: > I am reposting this question in a simpler form. > > I can run lpr from the command prompt but not from python > > os.system("notepad") works > os.system("lpr") does not work. Basically it says lpr is not a known > program or executable > > Why can I

Re: Remove directory tree without following symlinks

2016-04-22 Thread Random832
On Fri, Apr 22, 2016, at 10:56, Steven D'Aprano wrote: > What should I use for "remove_tree"? Do I have to write my own, or does a > solution already exist? In the os.walk documentation it provides a simple recipe and also mentions shutil.rmtree -- https://mail.python.org/mailman/listinfo/python-

Re: Can't run lpr from python on windows 2012 server

2016-04-22 Thread Random832
On Fri, Apr 22, 2016, at 11:06, loial wrote: > Yes it does. I finally found the solution here : > > http://www.tomshardware.co.uk/forum/240019-44-error-windows > > Copied lpr.exe, lprhelp.dll, and lprmonui.dll from the System32 folder to > the sysWOW64 folder A better solution might be to instal

Re: Remove directory tree without following symlinks

2016-04-23 Thread Random832
On Sat, Apr 23, 2016, at 06:24, Steven D'Aprano wrote: > "rm -r" gives me a NameError when I run it in my Python script :-) > > But seriously, where is that documented? I've read the man page for > rm, and it doesn't say anything about treatment of symlinks, nor is > there an option to follow/not

Re: Remove directory tree without following symlinks

2016-04-23 Thread Random832
On Sat, Apr 23, 2016, at 12:29, Nobody wrote: > On Linux, an alternative is to use fchdir() rather than chdir(), which > changes to a directory specified by an open file descriptor Of course, then there's also the risk of running out of open file descriptors. High-quality implementations of rm wi

Re: Python path and append

2016-04-25 Thread Random832
On Mon, Apr 25, 2016, at 16:15, Seymore4Head wrote: > Thanks for the tip. > > Still broke. :( > > f = open('wout.txt', 'r+') > for line in f: > if line=="": > exit > line=line[:-1] > line=line+" *" > f.write(line) > print line > f.close() Your problem is that after y

Re: def __init__(self):

2016-04-26 Thread Random832
On Tue, Apr 26, 2016, at 03:34, Ben Finney wrote: > That's needlessly confusing: ‘__init__’ is not a constructor because it > does not construct the instance. The ‘__new__’ method is the constructor > for a class (and returns the new instance). the __new__ method is the *allocator*. "constructor"

Re: Why does pathlib not have is_readable() & things like that?

2016-04-26 Thread Random832
On Tue, Apr 26, 2016, at 09:30, Adam Funk wrote: > I recently discovered pathlib in the Python 3 standard library, & find > it very useful, but I'm a bit surprised that it doesn't offer things > like is_readable() and is_writable. Is there a good reason for that? Well, one reason would be EAFP. J

Re: Question on List processing

2016-04-26 Thread Random832
On Tue, Apr 26, 2016, at 11:38, subhabangal...@gmail.com wrote: > I am trying to send you a revised example. > list1=[u"('koteeswaram/BHPERSN engaged/NA ','class1')", > u"('koteeswaram/BHPERSN is/NA ','class1')"] > > [('koteeswaram/BHPERSN engaged/NA ','class1'), > ('koteeswaram/BHPERSN is/NA '

Re: def __init__(self):

2016-04-26 Thread Random832
On Tue, Apr 26, 2016, at 12:12, Steven D'Aprano wrote: > The obvious reason for overriding __new__ is to construct an immutable > instance. You have to override __new__, because by the time it returns > the > instance is immutable and you can no longer initialise it. Other than by subclassing an e

Re: Differences between Class(Object) and Class(Dict) for dictionary usage?

2016-04-26 Thread Random832
On Tue, Apr 26, 2016, at 23:43, Christopher Reimer wrote: > Greetings, > > If I'm using a dictionary to store variables for an object, and > accessing the variable values from dictionary via property decorators, what exactly do you mean by property decorators? If you're just accessing them in a

Re: Pythonic style

2016-04-28 Thread Random832
On Thu, Apr 28, 2016, at 01:16, Rustom Mody wrote: > On Thursday, April 28, 2016 at 9:26:21 AM UTC+5:30, Chris Angelico wrote: > > My rule of thumb is: Dunders are for defining, not for calling. It's > > not a hard-and-fast rule, but it'll get you through 99%+ of > > situations. > > Neat and cleve

Re: What should Python apps do when asked to show help?

2016-04-28 Thread Random832
On Thu, Apr 28, 2016, at 13:06, Chris Angelico wrote: > On Fri, Apr 29, 2016 at 2:33 AM, Steven D'Aprano > wrote: > > Many command line tools simply output help to stdout (or stderr, if they're > > evil), > > I'm not sure stderr is particularly more evil than stdout, but whatever > :) When a too

Re: What should Python apps do when asked to show help?

2016-04-28 Thread Random832
On Thu, Apr 28, 2016, at 13:33, Grant Edwards wrote: > As long as -? -h --help just write stuff to stdout you can add > whatever other options you like that run pagers, start up web > browsers, or show mp4 movies on the wall without annoying grouchy old > Unix users like me. ;) One disadvantage

Re: What should Python apps do when asked to show help?

2016-04-28 Thread Random832
On Thu, Apr 28, 2016, at 15:39, Grant Edwards wrote: > That's fine. If you want two or three forms of documentation then you > prepare two or three forms of documentation. > > Adding an option to run the default 'help' output through a pager or > display it in a web browser doesn't somehow force

Re: What should Python apps do when asked to show help?

2016-04-29 Thread Random832
On Fri, Apr 29, 2016, at 22:09, Ethan Furman wrote: > So I have to cripple my shell to get pydoc help to work nicely? Neat! > Actually, not so much. :( If you don't want a pager with pydoc, when exactly do you want it? -- https://mail.python.org/mailman/listinfo/python-list

Re: What should Python apps do when asked to show help?

2016-04-29 Thread Random832
On Fri, Apr 29, 2016, at 22:27, Rustom Mody wrote: > On Saturday, April 30, 2016 at 7:47:11 AM UTC+5:30, Random832 wrote: > > On Fri, Apr 29, 2016, at 22:09, Ethan Furman wrote: > > > So I have to cripple my shell to get pydoc help to work nicely? Neat! > >

Re: What should Python apps do when asked to show help?

2016-04-29 Thread Random832
On Fri, Apr 29, 2016, at 22:46, Rustom Mody wrote: > I dont get whats so hard to get in this: > When we need pagers we know where to get them And if you set PAGER=cat (thus "crippling your shell"), you will likewise know where to get them when you want to page the output from man or git. Why is py

Re: What should Python apps do when asked to show help?

2016-04-29 Thread Random832
On Sat, Apr 30, 2016, at 00:06, Ben Finney wrote: > Steven D'Aprano writes: > > > So they want the PAGER environment variable to specify what pager they > > want... > > > > ...so long as applications don't actually make use of that PAGER > > environment variable to determine the pager they want t

Re: What should Python apps do when asked to show help?

2016-04-29 Thread Random832
On Fri, Apr 29, 2016, at 23:23, Steven D'Aprano wrote: > Seriously, I'm thinking that a keyword argument to help might be useful: > > help(object, pager=None) I'd call it something more generic like "output". > where: > > - pager=None gives the current behaviour; > > - pager="foo" calls out to

Re: What should Python apps do when asked to show help?

2016-04-30 Thread Random832
On Sat, Apr 30, 2016, at 19:51, c...@zip.com.au wrote: > _When_ they want a pager. Why would they need an environment variable at all in that case, rather than explicitly invoking the pager by name? To me, *not* having PAGER=cat signifies that someone *does* want a pager. That may be a crappy con

Re: What should Python apps do when asked to show help?

2016-04-30 Thread Random832
On Sat, Apr 30, 2016, at 22:30, Grant Edwards wrote: > We don't want to use a PAGER variable to specify when we want a pager > and when we don't want a pager. If we want a pager we append "| less" > to the command. If we don't want a pager, we don't append that to the > command. Setting PAGER=ca

Re: What should Python apps do when asked to show help?

2016-05-01 Thread Random832
On Sun, May 1, 2016, at 13:04, Grant Edwards wrote: > On 2016-05-01, Steven D'Aprano wrote: > > Is nobody except me questioning the assumption that we're only > > talking about Unix users? > > Didn't the OP specify that he was writing a command-line utility for > Linux/Unix? We've been talking a

Re: Use __repr__ to show the programmer's representation (was: Need help understanding list structure)

2016-05-03 Thread Random832
On Tue, May 3, 2016, at 15:24, moa47...@gmail.com wrote: > I also wanted to understand what character set it was returning. I was > giving it a gedcom file with ansel encoding, which is normal. My > genealogy program can also export its database to gedcom using UTF-8 and > Unicode. But both of thos

Re: Whittle it on down

2016-05-05 Thread Random832
On Thu, May 5, 2016, at 04:41, Steven D'Aprano wrote: > > There's no situation where "&" and " " will exist in the given > > dataset, and recognizing that is important. You don't have to account > > for every bit of nonsense. > > Whenever a programmer says "This case will never happen",

Re: Whittle it on down

2016-05-05 Thread Random832
On Thu, May 5, 2016, at 03:36, Steven D'Aprano wrote: > Putting non-ASCII letters aside for the moment, how would you match these > specs as a regular expression? Well, obviously *your* language (not the OP's), given the cases you reject, is "one or more sequences of letters separated by space*-a

Re: Whittle it on down

2016-05-05 Thread Random832
On Thu, May 5, 2016, at 14:03, Steven D'Aprano wrote: > You failed to anchor the string at the beginning and end of the string, > an easy mistake to make, but that's the point. I don't think anchoring is properly a concern of the regex itself - .match is anchored implicitly at the beginning, and o

Re: Whittle it on down

2016-05-05 Thread Random832
On Thu, May 5, 2016, at 14:27, Jussi Piitulainen wrote: > Random832's pattern is fine. You need to use re.fullmatch with it. Heh, in my previous post I said "and one could easily imagine an API that implicitly anchors at the end". So easy to imagine it turns out that someone

Re: Python is an Equal Opportunity Programming Language

2016-05-07 Thread Random832
On Sat, May 7, 2016, at 11:16, Steven D'Aprano wrote: > > Indian and Chinese H1B holders are getting screwed, which is of course > > the whole objective of the country limits. > > The *whole* objective? You don't think that *part* of the objective may > be > to ensure that citizens of countries ot

Re: Python is an Equal Opportunity Programming Language

2016-05-07 Thread Random832
On Sat, May 7, 2016, at 22:43, Steven D'Aprano wrote: > > If not for the quotas, a citizen of some other country would have an > > equal chance to get a green card as a citizen of India or China. > > If you have a big hat with 5,000,000 tickets marked "Indian", and 500 > tickets marked "Finish",

Re: Are imports supposed to be like this?

2016-05-09 Thread Random832
On Mon, May 9, 2016, at 19:54, Brendan Abel wrote: > Consider the following example python package where `a.py` and `b.py` > depend on each other: > > /package > __init__.py > a.py > b.py > > > There are several ways I could import the "a.py" module in "b.py" > >

Re: Python 3.5.1 Not Working

2016-05-13 Thread Random832
On Fri, May 13, 2016, at 12:18, Aidan Silcock via Python-list wrote: > > > Sent from Yahoo Mail on Android > > On Fri, 13 May, 2016 at 16:59, Aidan Silcock > wrote: HelloI have tried to download python 3.5.1 today and it has > downloaded but each time I try to open it it says I need to

Re: How to get a directory list sorted by date?

2016-05-16 Thread Random832
On Sun, May 15, 2016, at 17:52, Chris Angelico wrote: > On Mon, May 16, 2016 at 2:00 AM, Grant Edwards > wrote: > > On 2016-05-15, Michael Selik wrote: > >> On Sun, May 15, 2016, 10:37 AM Grant Edwards > >> wrote: > >>> On 2016-05-15, Tim Chase wrote: > > unless sorted() returns a la

Re: OT: limit number of connections from browser to my server?

2016-05-16 Thread Random832
On Mon, May 16, 2016, at 13:34, Peter Otten wrote: > I think HTTP/2 allows multiple requests over a single TCP connection. HTTP/1.1 allows the same just fine, the problem here is convincing the browser to actually do it. -- https://mail.python.org/mailman/listinfo/python-list

<    1   2   3   4   5   6   7   8   >