Re: How to make a copy of chained dicts effectively and nicely?

2016-09-29 Thread Nagy László Zsolt
On Wed, Sep 28, 2016 at 12:54 AM, Jussi Piitulainen > wrote: >> I wasn't sure if it makes a copy or just returns the dict. But it's >> true: help(dict) says dict(mapping) is a "new dictionary initialized >> from a mapping object's (key, value) pairs". > Yep. With mutable objects, Python's docs ar

Re: [py 2.7] JSON and UTF-8

2016-09-29 Thread dieter
Gilmeh Serda writes: > Is there something that can be done when writing JSON using its dump/ > dumps feature so, e.g. Cyrillic text will show up correctly in a text > editor afterwards? > ... > The 'template.json' contains this: > > { > "test": "øæßþåнайтеĦŒŒ®®®" > } > > What the json module

Re: SOAP XML webserver in Python/Django

2016-09-29 Thread dieter
ivan77 writes: > I currently have a need to setup a webserver on one of our internal servers > that is going to send and receive XML SOAP responses to an external company > through a VPN. > > It seems like something that I could use python (maybe even Django) for. > However, even though I ha

filesystem encoding 'strict' on Windows

2016-09-29 Thread iMath
the doc of os.fsencode(filename) says Encode filename to the filesystem encoding 'strict' on Windows, what does 'strict' mean ? -- https://mail.python.org/mailman/listinfo/python-list

Re: ANN: dedent 0.5 released

2016-09-29 Thread Jussi Piitulainen
Vito De Tullio writes: > Christian Tismer wrote: > >> $ python -c """some code""" > > totally offtopic but... since when bash support python-style triple > quote?? Is it another shell?? Bash allows any odd number of quotes on each side. -- https://mail.python.org/mailman/listinfo/python-list

Re: ANN: dedent 0.5 released

2016-09-29 Thread Vito De Tullio
Christian Tismer wrote: > $ python -c """some code""" totally offtopic but... since when bash support python-style triple quote?? Is it another shell?? -- By ZeD -- https://mail.python.org/mailman/listinfo/python-list

Re: unintuitive for-loop behavior

2016-09-29 Thread Rustom Mody
On Friday, September 30, 2016 at 10:23:31 AM UTC+5:30, Gregory Ewing wrote: > namenobodywants wrote: > > can anyone help to reconcile me to this semantics? > > Not really. Most people agree that it's not desirable > behaviour, but we've ended up here due to a convoluted > history, and there doesn

Re: unintuitive for-loop behavior

2016-09-29 Thread Gregory Ewing
namenobodywa...@gmail.com wrote: > can anyone help to reconcile me to this semantics? Not really. Most people agree that it's not desirable behaviour, but we've ended up here due to a convoluted history, and there doesn't seem to be a good way to fix it without breaking a lot of existing code. C

Python grammar extension via encoding (pyxl style) questions

2016-09-29 Thread Pavel Velikhov
Hi everybody! We’re building an experimental extension to Python, we’re extending Python’s comprehensions into a full-scale query language. And we’d love to use the trick that was done in pyxl, where a special encoding of the file will trigger the preprocessor to run and compile our extend

Re: how to automate java application in window using python

2016-09-29 Thread Michael Torrie
On 09/29/2016 01:18 PM, Lawrence D’Oliveiro wrote: > On Thursday, September 29, 2016 at 11:46:59 PM UTC+13, Ned Batchelder wrote: >> This is just getting rude. Let's please drop it. > > Do you have anything substantive to contribute? He's already contributed far more to this list, and to Python,

Re: Expression can be simplified on list

2016-09-29 Thread Steve D'Aprano
On Fri, 30 Sep 2016 05:58 am, Random832 wrote: > On Thu, Sep 29, 2016, at 02:47, Rustom Mody wrote: >> Your example is exactly what I am saying; if a type has a behavior in >> which all values are always True (true-ish) its a rather strange kind >> of bool-nature. > > For a given type T, if all o

Re: how to automate java application in window using python

2016-09-29 Thread Steve D'Aprano
On Fri, 30 Sep 2016 05:18 am, Lawrence D’Oliveiro wrote: > On Thursday, September 29, 2016 at 11:46:59 PM UTC+13, Ned Batchelder > wrote: >> This is just getting rude. Let's please drop it. > > Do you have anything substantive to contribute? Infinitely more than you. *plonk* -- Steve “Che

Re: how to automate java application in window using python

2016-09-29 Thread Chris Angelico
On Fri, Sep 30, 2016 at 5:18 AM, Lawrence D’Oliveiro wrote: > On Thursday, September 29, 2016 at 11:46:59 PM UTC+13, Ned Batchelder wrote: >> This is just getting rude. Let's please drop it. > > Do you have anything substantive to contribute? Yes. He contributed the guiding hand of "please keep

Re: unintuitive for-loop behavior

2016-09-29 Thread Chris Angelico
On Fri, Sep 30, 2016 at 5:29 AM, wrote: > i've had a nodding acquaintance with python for some time, and all along i > assumed that for-loops got a namespace of their own; now i'm reading up on > the language and i find out that's not the case: the loop variable gets put > into the enclosing n

Re: Getting IDLE to use correct Tcl/Tk on MacOSX 10.6?

2016-09-29 Thread Ned Deily
On 2016-09-27 18:47, Gregory Ewing wrote: > I don't normally use IDLE, but I had occasion to use it > on MacOSX 10.6 to answer someone's question, and of course > it didn't work properly due to Apple's broken Tcl/Tk. > > I followed the advice to install ActiveState Tcl 8.5.18.0, > but my Python st

Re: Expression can be simplified on list

2016-09-29 Thread Chris Angelico
On Fri, Sep 30, 2016 at 5:58 AM, Random832 wrote: > On Thu, Sep 29, 2016, at 02:47, Rustom Mody wrote: >> Your example is exactly what I am saying; if a type has a behavior in >> which all values are always True (true-ish) its a rather strange kind >> of bool-nature. > > For a given type T, if all

Re: ANN: dedent 0.5 released

2016-09-29 Thread Christian Tismer
On 29/09/16 22:14, Lele Gaifax wrote: Christian Tismer writes: Dedent 0.5 == What is it? --- Dedent is a very simple tool for those people who like to indent their inline code nicely. p.s.: Why is that not build in by default? Isn't it roughly the same as https://docs.pyth

Re: ANN: dedent 0.5 released

2016-09-29 Thread Lele Gaifax
Christian Tismer writes: > Dedent 0.5 > == > > What is it? > --- > > Dedent is a very simple tool for those people who like to > indent their inline code nicely. > > p.s.: Why is that not build in by default? Isn't it roughly the same as https://docs.python.org/3.6/library/textwr

Re: Expression can be simplified on list

2016-09-29 Thread Random832
On Thu, Sep 29, 2016, at 02:47, Rustom Mody wrote: > Your example is exactly what I am saying; if a type has a behavior in > which all values are always True (true-ish) its a rather strange kind > of bool-nature. For a given type T, if all objects of type T are true (true-ish, truthy, whatever), i

Re: unintuitive for-loop behavior

2016-09-29 Thread Brendan Abel
Yes, loops don't have their own scope. Indeed, very few flow elements in python -- if, with, try/except -- create a new scope. In that sense, it's fairly consistent, but can be unexpected for people that have used languages with many nested scopes. The lambda behavior is a common gotcha - there

Re: Expression can be simplified on list

2016-09-29 Thread Terry Reedy
On 9/29/2016 2:47 AM, Rustom Mody wrote: On Thursday, September 15, 2016 at 1:43:05 AM UTC+5:30, Terry Reedy wrote: On 9/14/2016 3:16 AM, Rustom Mody wrote: In THOSE TYPES that element can justifiably serve as a falsey (empty) type However to extrapolate from here and believe that ALL TYPES c

unintuitive for-loop behavior

2016-09-29 Thread namenobodywants
hello pythonistas i've had a nodding acquaintance with python for some time, and all along i assumed that for-loops got a namespace of their own; now i'm reading up on the language and i find out that's not the case: the loop variable gets put into the enclosing namespace, overwriting any forme

Re: how to automate java application in window using python

2016-09-29 Thread Lawrence D’Oliveiro
On Thursday, September 29, 2016 at 11:46:59 PM UTC+13, Ned Batchelder wrote: > This is just getting rude. Let's please drop it. Do you have anything substantive to contribute? (... crickets ...) -- https://mail.python.org/mailman/listinfo/python-list

Re: Expression can be simplified on list

2016-09-29 Thread Terry Reedy
On 9/29/2016 12:36 PM, MRAB wrote: On 2016-09-29 16:56, Steve D'Aprano wrote: On Thu, 29 Sep 2016 09:53 pm, MRAB wrote: What if an _exhausted_ iterator was falsey? Logic is about binary distinctions, rather than about 'truth'. For non-buggy iterator it, the useful binary distinction is whe

Re: Expression can be simplified on list

2016-09-29 Thread MRAB
On 2016-09-29 09:14, Steven D'Aprano wrote: On Thursday 29 September 2016 16:47, Rustom Mody wrote: On Thursday, September 15, 2016 at 1:43:05 AM UTC+5:30, Terry Reedy wrote: [...] Python make no such nonsense claim. By default, Python objects are truthy. >>> bool(object()) True Because T

Re: Expression can be simplified on list

2016-09-29 Thread Chris Angelico
On Fri, Sep 30, 2016 at 2:36 AM, MRAB wrote: > On 2016-09-29 16:56, Steve D'Aprano wrote: >> >> On Thu, 29 Sep 2016 09:53 pm, MRAB wrote: >> >>> What if an _exhausted_ iterator was falsey? >> >> >> >> The problem is that in general you can't tell if an iterator is exhausted >> until you attempt to

Re: Expression can be simplified on list

2016-09-29 Thread MRAB
On 2016-09-29 16:56, Steve D'Aprano wrote: On Thu, 29 Sep 2016 09:53 pm, MRAB wrote: What if an _exhausted_ iterator was falsey? The problem is that in general you can't tell if an iterator is exhausted until you attempt to advance it. So even if bool(iterator) returns True, the call to next

Re: Expression can be simplified on list

2016-09-29 Thread Steve D'Aprano
On Thu, 29 Sep 2016 09:53 pm, MRAB wrote: > What if an _exhausted_ iterator was falsey? The problem is that in general you can't tell if an iterator is exhausted until you attempt to advance it. So even if bool(iterator) returns True, the call to next() may raise StopIteration: def gen(): y

Abusive Italian Spam

2016-09-29 Thread Tim Golden
You may have noticed one or two more of the abusive spam messages slip through onto the list. We do have traps for these but, as with most such things, they need tuning. (We've discarded many more than you've seen). As ever, kudos to Mark Sapiro of the Mailman team for tweaking our custom filters

SOAP XML webserver in Python/Django

2016-09-29 Thread ivan77
Hi All, I currently have a need to setup a webserver on one of our internal servers that is going to send and receive XML SOAP responses to an external company through a VPN. It seems like something that I could use python (maybe even Django) for. However, even though I have been using Pyth

ANN: dedent 0.5 released

2016-09-29 Thread Christian Tismer
Dedent 0.5 == What is it? --- Dedent is a very simple tool for those people who like to indent their inline code nicely. For those who got already what it is, stop reading. :-) All the others: What is it, really? --- Ok, think of some inline Python code, someth

Re: Using the Windows "embedded" distribution of Python

2016-09-29 Thread Paul Moore
On Thursday, 29 September 2016 12:56:28 UTC+1, eryk sun wrote: >> Oh, wow. Now you mention it, I recall that convention (from somewhere). >> >> I'll investigate that option (although it may not suit my use case, as >> I want multiple exes in the one "main" directory sharing a single >> "local" Py

problemes

2016-09-29 Thread Lidia ARNAL
bonjour je n'arrive plus a me connecter au script doA-Tools alors que celui si fonctionnait bien. la fenêtre reste noir et rien ne se passe  merci de votre aide   -- https://mail.python.org/mailman/listinfo/python-list

Re: Expression can be simplified on list

2016-09-29 Thread Peter Otten
MRAB wrote: > What if an _exhausted_ iterator was falsey? Many would expect it = iter("abc") while it: print(next(it)) to work (i. e. no StopIteration) -- if it doesn't, what's the actual usecase? If it does work there must be some lookahead which not all iterators can provide in a meani

Re: Using the Windows "embedded" distribution of Python

2016-09-29 Thread eryk sun
On Thu, Sep 29, 2016 at 10:41 AM, Paul Moore wrote: > On Thursday, 29 September 2016 10:39:10 UTC+1, eryk sun wrote: >> On Thu, Sep 29, 2016 at 8:35 AM, Paul Moore wrote: >> > PS It's a shame there's no way to put the embedded distribution in a >> > subdirectory >> > *without* needing to use

Re: Expression can be simplified on list

2016-09-29 Thread MRAB
On 2016-09-29 10:49, Steven D'Aprano wrote: On Thursday 29 September 2016 18:45, Jussi Piitulainen wrote: [snip] What do you say about things like iterators and generators? I'd say they are containers, but they count as true even when they are empty. No, they aren't containers, because they d

Re: how to automate java application in window using python

2016-09-29 Thread Ned Batchelder
On Wednesday, September 28, 2016 at 8:00:09 PM UTC-4, Lawrence D’Oliveiro wrote: > On Thursday, September 29, 2016 at 11:54:46 AM UTC+13, Emile van Sebille > wrote: > > Which worked for me! You should try it. Sloppy programming has always > > been unreliable. > > So it is clear you don’t have an

Re: Using the Windows "embedded" distribution of Python

2016-09-29 Thread Paul Moore
On Thursday, 29 September 2016 10:39:10 UTC+1, eryk sun wrote: > On Thu, Sep 29, 2016 at 8:35 AM, Paul Moore wrote: > > PS It's a shame there's no way to put the embedded distribution in a > > subdirectory > > *without* needing to use dynamic loading, but I guess that's basically an > > OS lim

Re: Expression can be simplified on list

2016-09-29 Thread Steven D'Aprano
On Thursday 29 September 2016 18:45, Jussi Piitulainen wrote: > Steven D'Aprano writes: > > [- -] > >> What is this truthiness abstraction? It is the difference between >> "something" and "nothing". >> >> Values which represent nothing, e.g.: >> >> - None >> - numeric zero: 0, 0.0, 0j, Decimal(0

Re: Using the Windows "embedded" distribution of Python

2016-09-29 Thread eryk sun
On Thu, Sep 29, 2016 at 8:35 AM, Paul Moore wrote: > PS It's a shame there's no way to put the embedded distribution in a > subdirectory > *without* needing to use dynamic loading, but I guess that's basically an OS > limitation. There are ways to do this. The simplest way is to use a subdirec

Re: Expression can be simplified on list

2016-09-29 Thread Lawrence D’Oliveiro
On Thursday, September 29, 2016 at 7:48:41 PM UTC+13, Rustom Mody wrote: > - And then uses a value of that type in a non-trivial bool-consuming position > such as the condition of an if/while etc > > There's a very good chance that bool-usage is buggy 👍 -- https://mail.python.org/mailman/listinf

Re: Is there a way to change the closure of a python function?

2016-09-29 Thread Lawrence D’Oliveiro
On Thursday, September 29, 2016 at 7:13:15 PM UTC+13, Gregory Ewing wrote: > Philosophical question: Is a function that never > returns actually a function? Denotational semantics calls that value “bottom”. -- https://mail.python.org/mailman/listinfo/python-list

Re: Expression can be simplified on list

2016-09-29 Thread Chris Angelico
On Thu, Sep 29, 2016 at 6:45 PM, Jussi Piitulainen wrote: > What do you say about things like iterators and generators? I'd say they > are containers, but they count as true even when they are empty. > > bool(x for x in [3,1] if x in [2,7]) # True > list(x for x in [3,1] if x in [2,7]) # [] > > I

Re: Expression can be simplified on list

2016-09-29 Thread Jussi Piitulainen
Steven D'Aprano writes: [- -] > What is this truthiness abstraction? It is the difference between > "something" and "nothing". > > Values which represent nothing, e.g.: > > - None > - numeric zero: 0, 0.0, 0j, Decimal(0) etc > - empty strings u'', '' > - empty containers [], (), {} etc. > > are t

Re: Using the Windows "embedded" distribution of Python

2016-09-29 Thread Paul Moore
On Wednesday, 28 September 2016 21:50:54 UTC+1, eryk sun wrote: > On Wed, Sep 28, 2016 at 2:35 PM, Paul Moore wrote: > > So I thought I'd try SetDllDirectory. That works for python36.dll, but if I > > load > > python3.dll, it can't find Py_Main - the export shows as "(forwarded to > > python36.

Re: Expression can be simplified on list

2016-09-29 Thread Steven D'Aprano
On Thursday 29 September 2016 16:47, Rustom Mody wrote: > On Thursday, September 15, 2016 at 1:43:05 AM UTC+5:30, Terry Reedy wrote: [...] >> Python make no such nonsense claim. By default, Python objects are truthy. >> >> >>> bool(object()) >> True >> >> Because True is the default, object ne

Re: Expression can be simplified on list

2016-09-29 Thread Chris Angelico
On Thu, Sep 29, 2016 at 4:47 PM, Rustom Mody wrote: >> Because True is the default, object need not and at least in CPython >> does not have a __bool__ (or __len__) method. Classes with no falsey >> objects, such as functions, generators, and codes, need not do anything >> either. In the absence