Re: scope of function parameters

2011-05-30 Thread Steven D'Aprano
On Mon, 30 May 2011 09:12:50 +0200, Laurent Claessens wrote: > Could you give an example of an object that has no name ? I've missed > something ... >>> mylist = [None, 42, "something"] The list object has a name, mylist. The three objects inside the list have n

Re: English Idiom in Unix: Directory Recursively

2011-05-30 Thread Steven D'Aprano
k. Sometimes brand names do become generic. "Personal Computer" once was a specific IBM model, not just a description. Elevator and escalator were once brandnames. In some parts of the southern USA, "coke" is used as a word for any softdrink, not just Coca Cola. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: float("nan") in set or as key

2011-05-30 Thread Steven D'Aprano
On Mon, 30 May 2011 19:58:35 +, Chris Torek wrote: > In article <[email protected]> Steven > D'Aprano wrote: >>Better than a float method is a function which takes any number as >>argument: >> >>>>>

Re: scope of function parameters (take two)

2011-05-30 Thread Steven D'Aprano
r global. You are misinterpreting what you see if you think they are. [...] > If making python behave this way is impossible, then I will just have to > live with it. But if it's a question of "we've always done it this way", > or, " why change? I'm not bothered by it", then I will repeat my > original question: Are there others who feel as I do that a function > parameter should always be local to the function? They are. You are misinterpreting what you see. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: float("nan") in set or as key

2011-06-01 Thread Steven D'Aprano
On Tue, 31 May 2011 19:45:01 -0700, Carl Banks wrote: > On Sunday, May 29, 2011 8:59:49 PM UTC-7, Steven D'Aprano wrote: >> On Sun, 29 May 2011 17:55:22 -0700, Carl Banks wrote: >> >> > Floating point arithmetic evolved more or less on languages like >> >

Re: float("nan") in set or as key

2011-06-01 Thread Steven D'Aprano
paroxysms of concern over the violation that they will probably never see, and ignore the dozens that they trip over day after day. Compiler optimizations are some of the worst and most egregious violations of the rule Floats Are Not Reals. Large numbers of numeric algorithms are simply broken due

Re: Something is rotten in Denmark...

2011-06-01 Thread Steven D'Aprano
on. The only difference is that lambda is an expression , and is limited to a single expression. The leap from "lambda is an expression" to "...and therefore the thing created by lambda has 'additional' stuff beyond ordinary def functions" is unjustified. Neverth

Re: Something is rotten in Denmark...

2011-06-01 Thread Steven D'Aprano
ng smarts' into the interpreter to allow for 'interpreter > intuition' (say AI ) that would presume to understand when early vs late > binding makes sense and apply early binding in those cases where the > context is not ambiguous and when it is clear that an iterable is being > passed to the constant lambda function?? The problem with Do What I Mean is that it so rarely Does What You Mean. At best it Does What Some Other Guy Imagined I'd Probably Mean In This Situation. Let's not go there. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: float("nan") in set or as key

2011-06-01 Thread Steven D'Aprano
ed value. Which makes it roughly equivalent to a float, only done in software with little hardware support. (In case it's not obvious: floats are equivalent to implicit rationals with a scaling factor and denominator equal to some power of two.) -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: float("nan") in set or as key

2011-06-02 Thread Steven D'Aprano
On Wed, 01 Jun 2011 21:41:06 +0100, Nobody wrote: > On Sun, 29 May 2011 23:31:19 +0000, Steven D'Aprano wrote: > >>> That's overstating it. There's a good argument to be made for raising >>> an exception. >> >> If so, I've never heard it,

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-05 Thread Steven D'Aprano
ds And more lisp than John McCarthy 😉 Attacking the man, instead of the argument. Is that the best you've got? If you're going to cast aspersions on my character, do it properly: I'm an arrogant, ignorant boob who dares to questions the Great Ones who clearly are

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-05 Thread Steven D'Aprano
'm happy to sit on the fence and not give an opinion as to whether the mathematical definition: y = 2 is or is not the same as the Python assignment: y = 2 -- Steven D'Aprano “You are deluded if you think software engineers who can't write operating systems or appl

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-05 Thread Steven D'Aprano
sight into their behaviour, and it certainly doesn't make him their inventor. > but in this case following through your logic that python exists in a > historical, contextual vacuum] I never said that. -- Steven D'Aprano “You are deluded if you think software engineers

Re: A question on modification of a list via a function invocation

2017-09-05 Thread Steven D'Aprano
because that's misleading and tempts the reader to draw the wrong conclusion. IDs in Python are arbitrary integers. They have no meaning except to be distinct for any two objects existing at the same time. -- Steven D'Aprano “You are deluded if you think software engineers who can't write operating systems or applications without security holes, can write virtualization layers without security holes.” —Theo de Raadt -- https://mail.python.org/mailman/listinfo/python-list

Re: A question on modification of a list via a function invocation

2017-09-05 Thread Steven D'Aprano
On Tue, 05 Sep 2017 21:17:30 -0700, Rustom Mody wrote: > Sure you can say with Steven that this can be 'explained' by saying an > object can be in two places at one time. > Others would then say 'Humpty-dumpty!' since you have removed the most > basic intuition

Re: A question on modification of a list via a function invocation

2017-09-05 Thread Steven D'Aprano
lude pointers as a value at all. > You can't do it in Pascal, either, but Pascal definitely has pointers. Not in standard Pascal, but most actual Pascal compilers let you perform pointer arithmetic. -- Steven D'Aprano “You are deluded if you think software engineers who can&#

Re: tictactoe script - commented - may have pedagogical value

2017-09-07 Thread Steven D'Aprano
one. Maybe the page is broken. But anyway... it doesn't seem to me that the page is doing any computation using HTML. It's more like a book listing a table of primes. The book hasn't done any computation, and we wouldn't say that this is proof that pieces of paper are capable

Re: Using Python 2

2017-09-11 Thread Steven D'Aprano
hird-party libraries that you want type hints for > but that you're not the maintainer of. Keeping type hints together with > the actual code is always preferable. You don't have to care about type > annotations, but when they happen to be present, then everybody should > c

Re: Using Python 2

2017-09-12 Thread Steven D'Aprano
more areas of this community instead > of keeping himself all couped-up in those "members only" forums. Python-Dev and Python-Ideas are no more "members only" than Python-List (this forum). As you know, because you subscribed to at least one of them some time ago. The only di

Re: Python dress

2017-09-12 Thread Steven D'Aprano
he Duke > of Edinburgh is his father, don't you? :-) Ah, yes, thanks for the correction. Of course I was thinking about Prince Philip, not Charles. -- Steven D'Aprano “You are deluded if you think software engineers who can't write operating systems or applications without

Re: [Tutor] beginning to code

2017-09-12 Thread Steven D'Aprano
ey're doing. And of course the beauty of duck-typing in Python is that *everything* is a bool, or at least quacks like a bool and swims like a bool. [...] > they're just reductio ad absurdum. I see that your understanding of logical fallacies is as penetrating and profound as you

Re: [Tutor] beginning to code

2017-09-13 Thread Steven D'Aprano
On Tue, 12 Sep 2017 23:20:21 -0700, Rick Johnson wrote: > Steven D'Aprano wrote: >> Rick Johnson wrote: >> >> >> > But just because we have been trained that the implicit `if x:` is >> > shorthand for the reasonable `if bool(x) == True:` >> &g

Re: "tkinter"

2017-09-13 Thread Steven D'Aprano
On Thu, 14 Sep 2017 17:54:37 +1200, Gregory Ewing wrote: > Sean DiZazzo wrote: >> I usually just say "tinker", since it's easy... > > +1. All we need now are modules called talior, sodlier and psye. > Should I write a PEP? Oooh yes please :-) -- Steven D

Re: "tkinter"

2017-09-13 Thread Steven D'Aprano
and sounds like the most English-like solution. But maybe I'm biased due to my name.[1] (3) Pretend that the K is silent, as in KNIGHT. t(k)inter I suppose that's not unreasonable, but personally I don't like it. [1] Ironically, I actually pronounce my name DA PRANO. So do m

Re: [Tutor] beginning to code

2017-09-13 Thread Steven D'Aprano
On Wed, 13 Sep 2017 11:05:37 +, Stefan Ram wrote: > Steven D'Aprano writes: >>The *only* reasonable place to stop is right at the beginning: if >>bool(x): >>at least for languages like Pascal and Java where `if` requires a >>specific boolean type. >

Re: "tkinter"

2017-09-14 Thread Steven D'Aprano
On Thu, 14 Sep 2017 17:01:30 +1000, Ben Finney wrote: > Steven D'Aprano writes: > >> (1) Separate T K and INTER syllables. >> >> But the problem with that is that there's very little (but not none >> whatsoever) precedence for sounding out letters individ

Re: Old Man Yells At Cloud

2017-09-19 Thread Steven D'Aprano
at's usually while I'm developing an > algorithm, and then I can decide whether or not and when to coerce the > result to floating point. I guess that you must have pretty simple algorithms then. No square roots, no trig, no exponentiation except for positive integer powers, l

Re: Research paper "Energy Efficiency across Programming Languages: How does energy, time, and memory relate?"

2017-09-19 Thread Steven D'Aprano
em, if its not in the standard library, it might as well not even exist. -- Steven D'Aprano “You are deluded if you think software engineers who can't write operating systems or applications without security holes, can write virtualization layers without security holes.” —Theo de

Re: [Tutor] beginning to code

2017-09-19 Thread Steven D'Aprano
if x is None: ... elif x == []: ... > So I find code that uses the domain specific condition more clear and > less error-prone than code that abstracts that domain specific condition > into the truthy-falsy distinction python makes. "Less error-prone" -- got some exa

Re: [Tutor] beginning to code

2017-09-19 Thread Steven D'Aprano
to understand our entire project to understand them, so just trust me." And the problem is solved. -- Steven D'Aprano “You are deluded if you think software engineers who can't write operating systems or applications without security holes, can write virtualization layer

Re: [Tutor] beginning to code

2017-09-19 Thread Steven D'Aprano
it is redundant to write if isinstance(x, bool) and x: I'd write "if x is True" if I really, honestly wanted True specifically. -- Steven D'Aprano “You are deluded if you think software engineers who can't write operating systems or applications without security hol

Re: Old Man Yells At Cloud

2017-09-19 Thread Steven D'Aprano
't be called Python. But it could be called EvenSlowerThanPythonYouReallyDontWantToDoAnySeriousNumericWorkWithThis instead. *wink* -- Steven D'Aprano “You are deluded if you think software engineers who can't write operating systems or applications without security holes, can write virtualization layers without security

Greater and less than operators [was Re: [Tutor] beginning to code]

2017-09-19 Thread Steven D'Aprano
t; oven # put cake into the oven cake < oven # remove cake from oven I don't mean that as a serious example of a useful DSL. But it is the kind of thing we might want to do. Only hopefully less lame. -- Steven D'Aprano “You are deluded if you think software engineers who ca

Re: Old Man Yells At Cloud

2017-09-19 Thread Steven D'Aprano
a function, because if you do, it won't receive the names of the variables, only their values. It's a trade-off. With del, if, else etc, the value of them being statements far outweighs the disadvantages. But for print, its the other way around. As I've said, apart from saving *

Re: Parentheses (as after "print")

2017-09-27 Thread Steven D'Aprano
s definition, or a messed up `if func(a, b)` statement, or a messed up `while func(a, b)` statement, or a messed up `with func(a, b)` statement. No thanks. -- Steven D'Aprano “You are deluded if you think software engineers who can't write operating systems or applications without

Re: Aliasing [was Re: [Tutor] beginning to code]

2017-09-27 Thread Steven D'Aprano
you think you can, it is only because you have misunderstood the problem and are writing something else that does something different from what the Pascal version does. -- Steven D'Aprano “You are deluded if you think software engineers who can't write operating systems or applic

Re: Efficient counting of results

2017-10-20 Thread Steven D'Aprano
propriate counters. I was just thinking there > might be tools to make the job easier/cleaner/more efficient. From the > responses I have gotten, it would seem that that is likely not the case, > so I'll just say "thank you all for your time", and let the matter rest. No problem. Sorry I couldn't be more helpful and glad you have a working solution. -- Steven D'Aprano -- https://mail.python.org/mailman/listinfo/python-list

Re: grapheme cluster library

2017-10-21 Thread Steven D'Aprano
st "support graphemes") on the Python-Ideas mailing list; - register a feature request on the tracker; - complain about the lack of such support here; - do nothing. -- Steven D'Aprano -- https://mail.python.org/mailman/listinfo/python-list

Re: Dunder variables

2018-01-09 Thread Steven D'Aprano
On Tue, 09 Jan 2018 09:55:49 +0200, Frank Millman wrote: > Hi all > > I have read that one should not call dunder methods in application code. "Should not" rather than "must not", but that's correct. In general, calling a dunder method directly is *not* the same as the operation you probably w

Re: Dunder variables

2018-01-09 Thread Steven D'Aprano
On Tue, 09 Jan 2018 11:28:03 +0200, Frank Millman wrote: > I have a class call Context containing only data, not methods. Instances > are passed around a lot in my application, with various methods > accessing various attributes. That contradicts itself... your Context class has data, but no meth

Re: Dunder variables

2018-01-09 Thread Steven D'Aprano
On Tue, 09 Jan 2018 16:14:27 +0200, Frank Millman wrote: > Maybe I was not clear. The Context instance is passed as an argument to > many methods. The methods can access the attributes of the instance. The > instance has no methods of its own. Ah, I see, I misunderstood. [...] >> Alternatively,

Generating SVG from turtle graphics

2018-01-11 Thread Steven D'Aprano
I'd like to draw something with turtle, then generate a SVG file from it. Is this possible? If not, is there something I can do which lets me plot lines, shapes and curves and output to SVG? Ideally, I'd like to draw a figure pixel by pixel, and then have the SVG library fit a bezier curve to

Re: Simple graphic library for beginners

2018-01-11 Thread Steven D'Aprano
On Fri, 12 Jan 2018 05:42:03 +1100, Chris Angelico wrote: > On Fri, Jan 12, 2018 at 5:33 AM, bartc wrote: [...] >> Except my Python 3.6 doesn't have pip. There is a however a copy in my >> Python 3.4. But that gives me the message: > > Why doesn't it? Recent Pythons should include pip by default

Re: Simple graphic library for beginners

2018-01-11 Thread Steven D'Aprano
On Fri, 12 Jan 2018 12:14:03 +1100, Chris Angelico wrote: > On Fri, Jan 12, 2018 at 11:57 AM, Steven D'Aprano > wrote: [...] >> Recent Pythons include "ensure pip" by default, which is a private >> version of pip which is intended to do nothing but install the la

Re: Simple graphic library for beginners

2018-01-11 Thread Steven D'Aprano
of pip comes first on the PATH pip3.6 ... # use the pip installed with Python 3.6 pip2.7 ... # use the pip installed with Python 2.7 etc. And don't say "use a venv" :-) -- Steven D'Aprano -- https://mail.python.org/mailman/listinfo/python-list

Re: Detecting a cycle in a graph

2018-01-14 Thread Steven D'Aprano
On Sun, 14 Jan 2018 10:30:31 +0200, Frank Millman wrote: > I can detect a cycle in a path. It is possible for there to be more than > one gateway in the path. I want to identify the gateway that actually > triggered the cycle, but I have not figured out a way to do this. You don't need a gateway

Re: documentation on read.encode

2018-01-17 Thread Steven D'Aprano
On Wed, 17 Jan 2018 16:54:37 -0500, Larry Martell wrote: > The code that was receiving the > PNG was not reading and writing the file as binary. Strangely that > worked on Linux but not on Windows. Nothing strange about it -- on Unix and Linux systems (with the possible exception of Mac OS?) in

Re: Where are the moderators?

2018-01-18 Thread Steven D'Aprano
On Fri, 19 Jan 2018 00:43:36 +, MRAB wrote: > If you're viewing via Google Groups, then complain about the spam to > Google. Alternatively, and just as effectively, you could repeatedly hit yourself on the head with a ball-peen hammer. That will be just as effective at filtering the spam, b

Re: Very strange issues with collections.Mapping

2018-01-18 Thread Steven D'Aprano
On Thu, 18 Jan 2018 16:37:18 -0500, Jason Swails wrote: > The root cause of the issue comes down to the following check returning > true: > > isinstance([], collections.Mapping) I re-iterate Chris' suggestion that you check that the instance is an actual list, not a subclass. Can you grep the

Context manager able to write to the caller's namespace

2018-01-18 Thread Steven D'Aprano
I'm looking for a solution, or at least hints, to this problem. I want to define a context manager in one module: # a.py def CM: def __enter__(self): return self def __exit__(self, *args): pass Then call it from another module: # b.py import a with a.CM() as spam:

Re: Context manager able to write to the caller's namespace

2018-01-18 Thread Steven D'Aprano
On Fri, 19 Jan 2018 16:49:49 +1100, Chris Angelico wrote: [...] > 1) Context manager was called from global scope, and needs access to > globals() or locals() as returned in the caller A! /facepalm Of course the caller can just pass locals() to the context manager. Why didn't I think o

Is this the right way to write a codec error handler?

2018-01-20 Thread Steven D'Aprano
I want an error handler that falls back on Latin-1 for anything which cannot be decoded. Is this the right way to write it? def latin1_fallback(exception): assert isinstance(exception, UnicodeError) start, end = exception.start, exception.end obj = exception.object if isinstance(

Re: Can't get python running

2018-01-20 Thread Steven D'Aprano
On Sun, 21 Jan 2018 12:21:40 +1100, Chris Angelico wrote: > Jim, let the installer put it where it wants to, and make sure you've > added it to PATH. Then you should be able to type "py" to start Python. Shouldn't the installer ensure that it puts "py" somewhere on the path? -- Steve -- htt

Re: Is this the right way to write a codec error handler?

2018-01-20 Thread Steven D'Aprano
On Sat, 20 Jan 2018 12:57:45 +0200, Serhiy Storchaka wrote: > Just `end` instead of `end+1`. Oops! > And it is safer to use `bytes.decode(obj[start:end], 'latin1')` or > `str(obj[start:end], 'latin1')` instead of > `obj[start:end].decode('latin1')`. Just for the case if obj has > overridden deco

Re: python to C code generator

2018-01-23 Thread Steven D'Aprano
On Tue, 23 Jan 2018 17:43:18 +, bartc wrote: > It wouldn't be a satisfactory way of writing C programs. So, although > I'm not that big a fan of C syntax, it might be better to write C as C, > and Python as Python, to avoid confusion.) This. The fundamental reality is that `a + b` means diff

Re: Fwd: Text Strip() now working constantly.

2018-01-28 Thread Steven D'Aprano
On Sat, 27 Jan 2018 11:25:35 -0600, George Shen wrote: > I have attached a JPG that clearly illustrate the issue. [...] > Please see the JPG. And what of us who are blind or visually impaired and use a screen reader to read text? Unless you use Photoshop to edit your source code, why are you us

Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Steven D'Aprano
On Sat, 27 Jan 2018 21:23:02 -0500, Jason Qian via Python-list wrote: > there are 0D 0A 09 If your string actually contains CARRIAGE RETURN (OD) NEWLINE (OA), and TAB (09) characters, then you don't need to do anything. Just call print, and they will be printed correctly. If that doesn't work,

Re: Data-structure for multiway associativity in Python

2018-01-28 Thread Steven D'Aprano
On Sat, 27 Jan 2018 10:01:47 -0800, qrious wrote: > I need a data structure and a corresponding (hopefully fast) mechanism > associated with it to do the following. While I am looking for the > concept first, my preference for implementation of this will be in > Python. > > [c1, c2,..., cn] is a

Where has the practice of sending screen shots as source code come from?

2018-01-28 Thread Steven D'Aprano
I'm seeing this annoying practice more and more often. Even for trivial pieces of text, a few lines, people post screenshots instead of copying the code. Where has this meme come from? It seems to be one which inconveniences *everyone* involved: - for the sender, instead of a simple copy and p

Re: Compression of random binary data

2018-01-28 Thread Steven D'Aprano
On Sat, 27 Jan 2018 22:14:46 -0800, pendrysammuel wrote: > I have it in my head, just need someone to write the program for me, Sure, my rate is $150 an hour. > I > know nothing about data compression or binary data other than 1s and 0s > and that you can not take 2 number without a possible v

Re: Compression of random binary data

2018-01-28 Thread Steven D'Aprano
On Sat, 27 Jan 2018 21:50:24 -0800, pendrysammuel wrote: > 387,420,489 is a number with only 2 repeating binary sequences Okay. Now try these two numbers: 387420479 387420499 -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Where has the practice of sending screen shots as source code come from?

2018-01-28 Thread Steven D'Aprano
On Sun, 28 Jan 2018 15:54:31 +, Tim Golden wrote: > At least for Windows users, grabbing a partial screenshot (eg of text) > has been very easy since Windows 7 when the "Snipping Tool" was added to > the builtins. Thanks, I didn't know that. > Certainly easier for the average user than try

Re: Data-structure for multiway associativity in Python

2018-01-28 Thread Steven D'Aprano
On Sun, 28 Jan 2018 14:48:02 -0800, qrious wrote: > First list = { 1, 2, 3} > Second list = { 4, 5, 6} > Third list = { 7, 8, 9} > > If I pass 9 as the argument, the return value of the function would be > {7, 8}. subsets = [{1, 2, 3}, {4, 5, 6}, {7, 8, 9}] data = {} for subset in subsets:

Re: Where has the practice of sending screen shots as source code come from?

2018-01-28 Thread Steven D'Aprano
On Mon, 29 Jan 2018 08:55:54 +1100, Tim Delaney wrote: > I got back a Word document containing about 10 screenshots where they'd > apparently taken a screenshot, moved the horizontal scrollbar one > screen, taken another screenshot, etc. You're lucky they didn't just take a single screen shot, th

Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Steven D'Aprano
Jason, your Python output and the C output are not the same. Also, it looks like your email client is adding formatting codes to the email, or something. Please look at your post here: https://mail.python.org/pipermail/python-list/2018-January/730384.html Do you notice the extra asterisks added

Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Steven D'Aprano
On Sun, 28 Jan 2018 17:04:56 -0800, Dan Stromberg wrote: > How about: os.write(1, message) What do you think that will do that print() doesn't do? -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Steven D'Aprano
On Sun, 28 Jan 2018 20:31:39 -0500, Jason Qian via Python-list wrote: > Thanks a lot :) > > os.write(1, message) works ! I still do not believe that print(message) doesn't work. I can see no reason why you need to use os.write(). -- Steve -- https://mail.python.org/mailman/listinfo/pyth

Re: Where has the practice of sending screen shots as source code come from?

2018-01-28 Thread Steven D'Aprano
On Sun, 28 Jan 2018 17:13:05 -0800, Dan Stromberg wrote: > I'm afraid the perspective may be: > Text == primitive > GUI == modern > > It feel like it'd be possible to train a neural network to translate > text in a screenshot to plain text though. That would be OCR, which has been around long be

Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Steven D'Aprano
On Sun, 28 Jan 2018 19:51:06 -0500, Jason Qian via Python-list wrote: > print(repr(message)) out : > > *does not exist\r\n\tat com.* For the record, I'd just like to say that this is not the output of Jason's call to print(). It has been edited to remove the b' ' delimiters which would have

Re: Please help on print string that contains 'tab' and 'newline'

2018-01-28 Thread Steven D'Aprano
On Sun, 28 Jan 2018 17:49:44 -0800, Dan Stromberg wrote: > On Sun, Jan 28, 2018 at 5:35 PM, Steven D'Aprano > wrote: >> On Sun, 28 Jan 2018 17:04:56 -0800, Dan Stromberg wrote: >>> How about: >>>>>> os.write(1, message) >> >>

Re: Automation query... Plz help

2018-01-29 Thread Steven D'Aprano
On Mon, 29 Jan 2018 16:23:23 +0530, Prahallad Achar wrote: > Hello friends, > > There is an desktop application which runs on Windows and written in > java [...] > Is there a way to run this automation without launching the application > (headless) Is the name of the application a secret? --

Re: Automation query... Plz help

2018-01-29 Thread Steven D'Aprano
On Mon, 29 Jan 2018 17:50:46 +0530, Prahallad Achar wrote: > No.. Not at all. > > Its CTP application.. Which is basically transport planner for networks If you want to know whether CTP can be run headless, you should ask the CTP support team or software maintainer, not Python forums. Do you h

Re: Where has the practice of sending screen shots as source code come from?

2018-01-29 Thread Steven D'Aprano
On Mon, 29 Jan 2018 11:43:36 -0800, John Ladasky wrote: > On Sunday, January 28, 2018 at 7:07:11 AM UTC-8, Steven D'Aprano wrote: >> >> (The day a programmer posts a WAV file of themselves reading their code >> out aloud, is the day I turn my modem off and lea

Re: Where has the practice of sending screen shots as source code come from?

2018-01-29 Thread Steven D'Aprano
On Mon, 29 Jan 2018 17:34:34 +, John Gordon wrote: [...] > The displayed filename in File Explorer was input.txt -- meaning that > the real filename was actually input.txt.txt, because File Explorer > shows file extensions as a separate column. > > Without this screenshot, we would have had o

Re: String matching based on sound?

2018-01-29 Thread Steven D'Aprano
On Mon, 29 Jan 2018 13:28:32 -0900, Israel Brewster wrote: > In initial searching, I did find the "fuzzy" library, which at first > glance appeared to be what I was looking for, but it, apparently, > ignores numbers, with the result that "all 4 one" gave the same output > as "all in", but NOT the

Re: Where has the practice of sending screen shots as source code come from?

2018-01-29 Thread Steven D'Aprano
On Mon, 29 Jan 2018 21:32:11 -0800, Rustom Mody wrote: > On Sunday, January 28, 2018 at 8:37:11 PM UTC+5:30, Steven D'Aprano > wrote: >> I'm seeing this annoying practice more and more often. Even for trivial >> pieces of text, a few lines, people post screenshots in

[OT] Dutch Reach [was Re: Where has the practice of sending screen shots as source code come from?]

2018-01-30 Thread Steven D'Aprano
On Tue, 30 Jan 2018 05:48:15 -0800, Rustom Mody wrote: [...] >> Ah, yes, the Dutch Reach. That would be like the French Pox (which >> isn't French), the Spanish Flu (that didn't start in Spain), the >> Jerusalem artichoke (which is neither an artichoke nor from Jerusalem), >> and the turkey (the b

[OT] Text as digitization [was Re: Where has the practice of sending screen shots as source code come from?]

2018-01-30 Thread Steven D'Aprano
On Tue, 30 Jan 2018 05:48:15 -0800, Rustom Mody wrote: > Text is a highly stylized unnatural medium Hmmm. I think it is no more "unnatural" than whale songs or the extremely formalised dancing rituals of birds or any other animal communication. Our species just takes this communication to a hig

Re: [OT] Dutch Reach [was Re: Where has the practice of sending screen shots as source code come from?]

2018-01-30 Thread Steven D'Aprano
On Tue, 30 Jan 2018 15:48:29 +, Matt Wheeler wrote: > Checking the side mirrors isn't particularly helpful advice if you're > sitting in any seat other than the driver's seat, however. That's a fair point. But it really only applies to those sitting on the driver's side in the back seat. On

Re: Import statements and multiprocessing

2018-01-30 Thread Steven D'Aprano
On Tue, 30 Jan 2018 15:54:30 +, Nicholas Cole wrote: [...] > The function I am passing to map calls a function in another file within > the same model. And that file has a > > from .some_file_in_the_package import * > > line at the top. > > However, in each function called in that file, I

Re: [OT] Dutch Reach [was Re: Where has the practice of sending screen shots as source code come from?]

2018-01-30 Thread Steven D'Aprano
On Tue, 30 Jan 2018 09:39:26 -0700, Ian Kelly wrote: > Also, I just wanted to add that if you're going to use the side mirror > then you need to watch it for a couple of seconds rather than a quick > glance. Most people's mirrors are not particularly well adjusted to > capture the car's blind spot

Re: Automation query... Plz help

2018-01-30 Thread Steven D'Aprano
On Tue, 30 Jan 2018 16:00:43 +0530, Prahallad Achar wrote: > Luckily application supports headless automation now question is how to > invoke those jar using python. I can see two approaches: (1) Calling the jar directly from Python. I don't think you can do that from CPython, but you might be

Re: [OT] Dutch Reach [was Re: Where has the practice of sending screen shots as source code come from?]

2018-01-31 Thread Steven D'Aprano
On Wed, 31 Jan 2018 16:14:45 +0100, Adriaan Renting wrote: > I am Dutch and after googling the term, I can confirm that the "Dutch > Reach" is taught in driving school here. I was taught this maneuvre when > getting my licence 20 years ago. Thanks for the data point. Was it a requirement of the d

Re: Trace back error just trying to run a simple import of requests

2018-02-01 Thread Steven D'Aprano
On Thu, 01 Feb 2018 20:26:20 +, William Sewell wrote: > My python script which I run daily just blew up. So, I went into python > to diagnose and just typed in the first line - import requests. I > received screenfulls of errors. Why? What could have happened when > nothing changed on my e

Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-01 Thread Steven D'Aprano
On Thu, 01 Feb 2018 15:48:36 -0800, jladasky wrote: > Let me ask those of you who are not using Google Groups: how do you > search? In my experience, searching through mailing list archives has > been poor. https://duckduckgo.com/?q=site%3Amail.python.org+searching+through+mailing+list+archives

Re: auto-correct a speech-to-text output and relate to of the words based on syllables

2018-02-01 Thread Steven D'Aprano
On Fri, 02 Feb 2018 08:14:03 +0100, dieter wrote: >> The user speaks "Light". The system translates it as "Bright" The user >> speaks "White" The system translates it as "Bright" > > As those words are phonetically quite apart (they have very different > first consonants), some step in your proce

Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-02 Thread Steven D'Aprano
On Fri, 02 Feb 2018 08:24:36 +0100, dieter wrote: > [email protected] writes: >> ... >> Let me ask those of you who are not using Google Groups: how do you >> search? In my experience, searching through mailing list archives has >> been poor. > > I am using "gmane.org" which has quite a good sear

Re: This newsgroup (comp.lang.python) may soon be blocked by Google Groups

2018-02-04 Thread Steven D'Aprano
On Sun, 04 Feb 2018 06:49:57 +1100, Chris Angelico wrote: > On Sun, Feb 4, 2018 at 6:34 AM, Mark Lawrence > wrote: >> On 03/02/18 17:56, Peter J. Holzer wrote: >>> You seem to confuse the mailing-list and the newsgroup. The >>> mailing-list doesn't have a spam problem, and it is already (lightly)

Re: Why not have a recvall method?

2018-02-04 Thread Steven D'Aprano
On Sun, 04 Feb 2018 19:26:36 +0800, 陶青云 wrote: > Hello, allThe socket object has a `sendall` method that can send all > bytes you specified. Oppositely, socket only has a recv method. I wonder > why there is not a `recvall` method? To workaround this, I use `f = > socket.makefile('rb')`, then `cal

Re: Parsing Nested List

2018-02-04 Thread Steven D'Aprano
On Sun, 04 Feb 2018 14:26:10 -0800, Stanley Denman wrote: > I am trying to parse a Python nested list that is the result of the > getOutlines() function of module PyPFD2 using pyparsing module. pyparsing parses strings, not lists. I fear that you have completely misunderstood what pyparsing does

Re: Why no '|' operator for dict?

2018-02-05 Thread Steven D'Aprano
On Mon, 05 Feb 2018 01:14:53 -0700, Ian Kelly wrote: > On Mon, Feb 5, 2018 at 12:35 AM, Frank Millman > wrote: >> So I have 2 questions - >> >> 1. Is there any particular reason why '|' is not supported? > > '|' is the set union operation, roughly equivalent to the set.union > method. Dicts don'

Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro

2018-02-08 Thread Steven D'Aprano
On Thu, 08 Feb 2018 23:40:57 +, Mark Lawrence wrote: > I don't see any spam in my inbox as I read on gmane, I'm pointing out > the disgraceful state of gg and why it should be dropped as it's less > than useless. Who is it that you think should "drop" Google Groups? If you mean individual pe

Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro

2018-02-09 Thread Steven D'Aprano
On Fri, 09 Feb 2018 12:45:29 +, Chris Green wrote: > Mark Lawrence wrote: [...] >> Please don't waste your time with the gmane website. Just point any >> (semi-)decent mail client like Thunderbird at news.gmane.org and you've > > Surely you mean NNTP/Usenet client. That's what he said :-)

Incremental compression

2018-02-09 Thread Steven D'Aprano
I want to compress a sequence of bytes one byte at a time. (I am already processing the bytes one byte at a time, for other reasons.) I don't particularly care *which* compression method is used, and in fact I'm not even interested in the compressed data itself, only its length. So I'm looking

Re: This newsgroup (comp.lang.python) may soon be blocked by Google Gro

2018-02-09 Thread Steven D'Aprano
On Fri, 09 Feb 2018 17:30:57 -0800, codewizard wrote: > Regardless of what the policies are and how well they're enforced, if > the mailing list is cut off from GG, I will stop reading it. There is *absolutely nothing* we can do about that. Google doesn't listen to us, and the suggestion that we

Re: Incremental compression

2018-02-09 Thread Steven D'Aprano
On Fri, 09 Feb 2018 17:52:33 -0800, Dan Stromberg wrote: > Perhaps: > > import lzma > lzc = lzma.LZMACompressor() Ah, thanks for the suggestion! -- Steve -- https://mail.python.org/mailman/listinfo/python-list

Re: Regex on a Dictionary

2018-02-13 Thread Steven D'Aprano
On Tue, 13 Feb 2018 05:11:20 -0800, Stanley Denman wrote: > I am trying to performance a regex on a "string" of text that python > isinstance is telling me is a dictionary. Please believe Python when it tells you that something is a dictionary. Trust me, the interpreter knows. It doesn't matter

Re: Regex on a Dictionary

2018-02-13 Thread Steven D'Aprano
On Tue, 13 Feb 2018 13:53:04 +, Mark Lawrence wrote: > Was the string methods solution that I gave a week or so ago so bad that > you still think that you need a regex to solve this? Sometimes regexes are needed, but often Jamie Zawinski is right: Some people, when confronted with a prob

Re: Defer, ensure library is loaded

2018-02-13 Thread Steven D'Aprano
On Wed, 14 Feb 2018 03:08:07 +1100, Chris Angelico wrote: [...] > import psycopg2 > > If it's already been imported, Python will go fetch it straight from the > cache, so it's fast. Since Jason is talking about "a variety of scripts", it is quite possible that the sys.modules cache will not sav

Re: Defer, ensure library is loaded

2018-02-13 Thread Steven D'Aprano
On Tue, 13 Feb 2018 08:02:38 -0800, Jason wrote: > I have a variety of scripts that import some large libraries, and rather > than create a million little scripts with specific imports, I'd like to > so something like > > psycopg2 = ensure_imported (psycopg2) > > This way, regardless of invocati

<    18   19   20   21   22   23   24   25   26   27   >