Terry Reedy writes:
> ...
>> The problem seems to come from my expectation that a file
>> is its own iterator and in python3 that is no longer true
>> for a NamedTemporaryFile.
> ...
>> Should this be considered a bug?
>
> No. The doc for NamedTemporaryFile does not even claim that the
> return i
Ethan Furman writes:
> I may have a need in the immediate future to work with SOAP and WSDL
> services, and a quick search
> turned up Zeep (http://docs.python-zeep.org/en/latest/) -- does anyone have
> any experience with it?
> Or any other libraries that can be recommended?
I am using "suds"
Hi group,
I'm using CPython 3.5.1. Currently I'm writing some delicate code that
is doing the right thing in 99% of the cases and screws up on the other 1%.
I would like to have tracing in some very inner loops:
if self._debug:
print("Offset %d foo bar" % (self._offset))
However, this incurs
On Saturday, July 30, 2016 at 4:32:25 AM UTC-4, Johannes Bauer wrote:
> Hi group,
>
> I'm using CPython 3.5.1. Currently I'm writing some delicate code that
> is doing the right thing in 99% of the cases and screws up on the other 1%.
>
> I would like to have tracing in some very inner loops:
>
On 30/07/2016 04:35, Steven D'Aprano wrote:
On Sat, 30 Jul 2016 06:19 am, BartC wrote:
The language requires that blocks always contains 1 or more statements.
Fair enough, except that 0 statements are often needed
They really aren't.
The standard library uses more "pass" statements than most
Cool ... can you give a concrete example ?
On Friday, July 29, 2016 at 10:27:08 PM UTC+8, Steven D'Aprano wrote:
> On Fri, 29 Jul 2016 07:44 pm, Cai Gengyang wrote:
>
> > Can someone explain in layman's terms what "float" means ?
>
> Floating point number:
>
> https://en.wikipedia.org/wiki/Floa
On Sat, 30 Jul 2016 08:21 pm, Cai Gengyang wrote:
> Cool ... can you give a concrete example ?
A concrete example of a float?
I already gave two:
>> Python floats use 64 bits (approximately 18 decimal digits). Because the
>> decimal point can "float" from place to place, they can represent ver
On Sat, 30 Jul 2016 06:32 pm, Johannes Bauer wrote:
> Hi group,
>
> I'm using CPython 3.5.1. Currently I'm writing some delicate code that
> is doing the right thing in 99% of the cases and screws up on the other
> 1%.
>
> I would like to have tracing in some very inner loops:
>
> if self._debu
On Sat, Jul 30, 2016 at 8:15 PM, BartC wrote:
> Anyway, if you're going to talk about annoying things forced upon you by the
> language, what about:
>
> "()" in "print (x)" for Python 3
Why are you singling out print? It's just a function like any other.
Are you complaining about the way function
On Saturday, July 30, 2016 at 4:56:01 PM UTC+5:30, Chris Angelico wrote:
> On Sat, Jul 30, 2016 at 8:15 PM, BartC wrote:
> > Anyway, if you're going to talk about annoying things forced upon you by the
> > language, what about:
> >
> > "()" in "print (x)" for Python 3
>
> Why are you singling out
You mentioned that : A floating point number[2] is number that is not an
integer (and not a
complex number)
Hence ,
10 is not a floating point number because it is an integer
25 is not a floating point number because it is an integer
7 + 3i is not a floating number because it is a complex num
On Sat, Jul 30, 2016 at 9:39 PM, Rustom Mody wrote:
> On Saturday, July 30, 2016 at 4:56:01 PM UTC+5:30, Chris Angelico wrote:
>> On Sat, Jul 30, 2016 at 8:15 PM, BartC wrote:
>> > Anyway, if you're going to talk about annoying things forced upon you by
>> > the
>> > language, what about:
>> >
>>
On Sat, Jul 30, 2016 at 9:44 PM, Cai Gengyang wrote:
> You mentioned that : A floating point number[2] is number that is not an
> integer (and not a
> complex number)
>
> Hence ,
>
> 10 is not a floating point number because it is an integer
> 25 is not a floating point number because it is an in
On Saturday, July 30, 2016 at 5:19:25 PM UTC+5:30, Chris Angelico wrote:
> On Sat, Jul 30, 2016 at 9:39 PM, Rustom Mody wrote:
> > On Saturday, July 30, 2016 at 4:56:01 PM UTC+5:30, Chris Angelico wrote:
> >> On Sat, Jul 30, 2016 at 8:15 PM, BartC wrote:
> >> > Anyway, if you're going to talk abou
On Sat, Jul 30, 2016 at 10:11 PM, Rustom Mody wrote:
>> > - Poorer error catching: What was a straight syntax error is now a
>> > lint-catch (at best)
>> > [print (x) for x in range(20)]
>>
>> Huh? Aside from the fact that you're constructing a useless list of
>> Nones, what's the error?
>
> Hu
On 30/07/2016 12:49, Chris Angelico wrote:
On Sat, Jul 30, 2016 at 9:39 PM, Rustom Mody wrote:
Its a function… ok.
Its ‘just’ a function… Arguable
For example:
- Prior Art: Its builtin and special in Fortran, Pascal, Basic
And it's not built-in or special in C, or a bunch of other languag
On Sat, Jul 30, 2016 at 10:27 PM, BartC wrote:
>> where the print function allows full customization
>> of both end= and sep=.
>
>
> This is one thing I can never get right in Python: controlling when a
> newline is or isn't generated and what happens with separators.
>
> (In fact when I used Pyth
On Saturday, July 30, 2016 at 5:53:12 PM UTC+5:30, Chris Angelico wrote:
> On Sat, Jul 30, 2016 at 10:11 PM, Rustom Mody wrote:
> >> > - Poorer error catching: What was a straight syntax error is now a
> >> > lint-catch (at best)
> >> > [print (x) for x in range(20)]
> >>
> >> Huh? Aside from t
On 30/07/2016 13:22, Chris Angelico wrote:
print(*range(10), sep='\n')
0
1
2
3
4
5
6
7
8
9
Beat that, print statement.
for i in range(10): print i
Same number of characters, but a lot less punctuation!
--
Bartc
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, Jul 30, 2016 at 10:31 PM, Rustom Mody wrote:
> What makes you think I wanted to print those numbers??
> Maybe I wanted a list of 10 None-s??
Because you NEVER SAID what you wanted! How can you talk about error
detection if you won't say what the programmer's intention was? You're
forcing
On Sat, Jul 30, 2016 at 10:39 PM, BartC wrote:
> On 30/07/2016 13:22, Chris Angelico wrote:
>
> print(*range(10), sep='\n')
>>
>> 0
>> 1
>> 2
>> 3
>> 4
>> 5
>> 6
>> 7
>> 8
>> 9
>
>
>>
>> Beat that, print statement.
>
>
> for i in range(10): print i
>
> Same number of characters, but a
On Sat, Jul 30, 2016 at 10:47 PM, Chris Angelico wrote:
> So, no improvement - exactly equal. And no longer a single expression,
> ergo no longer valid in as many contexts. (Also, it requires the use
> and damage of some iterator variable, which may be significant in some
> contexts.)
In case it'
On Sat, 30 Jul 2016 08:15 pm, BartC wrote:
> Interesting use of 'pass' in this example:
>
> http://pastebin.com/aYJdgEL4
>
> (I do believe he's using 'pass' as 'end'! Although he misses some out in
> that case.)
I wouldn't call it so much "interesting" as "a good example of how not to
program".
On Sat, Jul 30, 2016 at 11:06 PM, Steven D'Aprano wrote:
>> "for i in range(N):" just to repeat a block N times...
>
> Why should there be special syntax just for repeating a block N times?
> There's a general purpose for-loop which performs iteration. Why do you
> need special syntax to do what i
On 30/07/2016 14:36, Chris Angelico wrote:
On Sat, Jul 30, 2016 at 11:06 PM, Steven D'Aprano wrote:
"for i in range(N):" just to repeat a block N times...
Why should there be special syntax just for repeating a block N times?
There's a general purpose for-loop which performs iteration. Why do
On 30/07/2016 14:06, Steven D'Aprano wrote:
End of story. As far as I am concerned, the 97% of languages which allow the
visual structure of the code to differ from their logical structure are BAD
LANGUAGES.
You mean languages that allow code like this:
a = (
b
+c *
d)
?
Anoth
On Sat, 30 Jul 2016 11:15:12 +0100
BartC wrote:
>> Doesn't it look like there's something missing in the Python? Both
> the 'fi' or 'end', and the possibility of an 'h' statement.
>
> Note the Algol68-style style is more free-format where indents are
> not significant.
>
> Anyway, if you're goin
On Sat, 30 Jul 2016 09:39 pm, Rustom Mody wrote:
> On Saturday, July 30, 2016 at 4:56:01 PM UTC+5:30, Chris Angelico wrote:
>> On Sat, Jul 30, 2016 at 8:15 PM, BartC wrote:
>> > Anyway, if you're going to talk about annoying things forced upon you
>> > by the language, what about:
>> >
>> > "()" i
On Sat, 30 Jul 2016 10:27 pm, BartC wrote:
> This is one thing I can never get right in Python: controlling when a
> newline is or isn't generated and what happens with separators.
In Python 3, that's easy: the default space separator and newline at the end
can both be customized to any string yo
On Sat, 30 Jul 2016 10:31 pm, Rustom Mody wrote:
> What makes you think I wanted to print those numbers??
The fact that you called print.
> Maybe I wanted a list of 10 None-s??
The idiomatic Python way of doing it would be:
[None]*10
The beginner's way of doing it would be:
[None, None, Non
On 30/07/2016 15:39, D'Arcy J.M. Cain wrote:
By the way, the last time I replied to you it went to the list but your
address bounced. Was that a glitch or are you using an invalid address
in a mailing list?
Do you mean my email address? That was valid once but no longer. (If you
want to send
On Sat, 30 Jul 2016 11:58 pm, BartC wrote:
> The 'i' is superfluous. Why not:
>
> for 10:
Why bother? What's so special about this that it needs dedicated syntax?
Hypertalk (and related XTalk languages) offer a number of dedicated looping
constructs. Using square brackets [] for optional term
On Sun, 31 Jul 2016 12:16 am, BartC wrote:
> On 30/07/2016 14:06, Steven D'Aprano wrote:
>
>> End of story. As far as I am concerned, the 97% of languages which allow
>> the visual structure of the code to differ from their logical structure
>> are BAD LANGUAGES.
>
> You mean languages that allo
On Sat, 30 Jul 2016 11:06 pm, Steven D'Aprano wrote:
> If it a sign of a poor programmer that
> ignores the common idioms of a language and writes in another
> language's "grammar".
/face-palm
"If it a sign..."
Of course that was not intentional. What's the law that says that any post
complaini
On Saturday, July 30, 2016 at 8:17:19 PM UTC+5:30, Steven D'Aprano wrote:
> On Sat, 30 Jul 2016 09:39 pm, Rustom Mody wrote:
>
> > On Saturday, July 30, 2016 at 4:56:01 PM UTC+5:30, Chris Angelico wrote:
> >> On Sat, Jul 30, 2016 at 8:15 PM, BartC wrote:
> >> > Anyway, if you're going to talk abou
TUA writes:
> Calls to my REST api may either return a dict (for single results) or
> a list of dicts (for multiple results).
I think John's answer missed this part.
> I receive these results using the requests library.
>
> I want to retrieve the value for a key 'ID' but only if I have a
> sing
On Saturday, July 30, 2016 at 9:45:34 PM UTC+5:30, Rustom Mody wrote:
> Ok Python is better than Java is better than C++
> But it cannot stand up to scheme as a teaching language
> [The MIT Profs who replaced scheme by python admit to as much viz.
Send pressed prematurely — Sorry
MIT on practical
On Sun, Jul 31, 2016 at 1:48 AM, Steven D'Aprano wrote:
> Hypertalk (and related XTalk languages) offer a number of dedicated looping
> constructs. Using square brackets [] for optional terms:
>
> repeat [forever]
> repeat [for] number [times]
> repeat until condition
> repeat while condition
> re
On Sun, Jul 31, 2016 at 2:15 AM, Rustom Mody wrote:
> Diff between
> print "x"
> and
> print("x")
> is one char — the closing ‘)’
>
> To make a dispute about that — I’ll leave to BartC!
>
> The more general baby that is significant is that beginners should have
> it easy to distinguish procedure a
On Sun, 31 Jul 2016 12:47 am, Steven D'Aprano wrote:
> On Sat, 30 Jul 2016 09:39 pm, Rustom Mody wrote:
[...]
>> - Prior Art: Its builtin and special in Fortran, Pascal, Basic
>
> Possibly Fortran. But which version of Fortran? Do we really want to take
> decisions made in 1953 for the first ever
On Saturday, July 30, 2016 at 10:07:59 PM UTC+5:30, Chris Angelico wrote:
> On Sun, Jul 31, 2016 at 2:15 AM, Rustom Mody wrote:
> > Diff between
> > print "x"
> > and
> > print("x")
> > is one char — the closing ‘)’
> >
> > To make a dispute about that — I’ll leave to BartC!
> >
> > The more gener
On Sat, 30 Jul 2016 16:14:18 +0100
BartC wrote:
> > By the way, the last time I replied to you it went to the list but
> > your address bounced. Was that a glitch or are you using an
> > invalid address in a mailing list?
>
> Do you mean my email address? That was valid once but no longer. (If
>
On Sun, Jul 31, 2016 at 2:58 AM, Rustom Mody wrote:
>> Where, in any useful production code, is the difference between
>> functions and procedures actually helpful? Or where, in student code,
>> would it be useful to distinguish? I've been teaching Python to
>> students with a variety of backgroun
On Saturday, July 30, 2016 at 10:45:23 PM UTC+5:30, Chris Angelico wrote:
> On Sun, Jul 31, 2016 at 2:58 AM, Rustom Mody wrote:
> >> Where, in any useful production code, is the difference between
> >> functions and procedures actually helpful? Or where, in student code,
> >> would it be useful to
On Sun, 31 Jul 2016 02:29 am, Rustom Mody wrote:
> MIT on practical reasons for python over scheme:
>
https://www.wisdomandwonder.com/link/2110/why-mit-switched-from-scheme-to-python
> Berkeley on fundamental reasons for the opposite choice:
> https://people.eecs.berkeley.edu/~bh/proglang.html
No
On 07/30/2016 11:53 AM, Steven D'Aprano wrote:
> On Sun, 31 Jul 2016 02:29 am, Rustom Mody wrote:
>
>> MIT on practical reasons for python over scheme:
>>
> https://www.wisdomandwonder.com/link/2110/why-mit-switched-from-scheme-to-python
>> Berkeley on fundamental reasons for the opposite choice:
On Sat, Jul 30, 2016 at 4:03 PM, Dennis Lee Bieber
wrote:
> And in a rather convoluted route, one can get to the underlying
> representation...
>
import struct
f = struct.pack(">f", 3.0)
i = struct.pack(">i", 3)
fi = struct.unpack(">i", f)
ii = struct.unpack(">i",
On 30/07/2016 18:11, D'Arcy J.M. Cain wrote:
Maybe you should just change it to I_Am_a_Troll@nowhere. It's becoming
increasingly obvious that you have absolutely no interest in Python and
are just trying to get a rise out of people.
Calm down. I enjoy programming language design and especial
On 30/07/2016 16:48, Steven D'Aprano wrote:
On Sat, 30 Jul 2016 11:58 pm, BartC wrote:
The 'i' is superfluous. Why not:
for 10:
Why bother? What's so special about this that it needs dedicated syntax?
No named loop variable to invent, create, maintain, and destroy. No
range object to cr
On 30/07/2016 17:15, Rustom Mody wrote:
On Saturday, July 30, 2016 at 8:17:19 PM UTC+5:30, Steven D'Aprano wrote:
On Sat, 30 Jul 2016 09:39 pm, Rustom Mody wrote:
On Saturday, July 30, 2016 at 4:56:01 PM UTC+5:30, Chris Angelico wrote:
On Sat, Jul 30, 2016 at 8:15 PM, BartC wrote:
Anyway, if
Hi all,
I'm wondering about the use of partial in writing parallel code. Is is it
quicker than re-evaluating arguments for a multiple session.get()'s method
with different , for example (of requests) ?
Or maybe it is used to make sure the arguments differ per each invocation
? (the parallel inv
Michael Torrie wrote:
Python would have been alright to teach "programming," but to
teach the actual theory of programming languages (lambda calculus, lists
as a foundation unit for all other data structures)
I wouldn't say that "lists as a foundation unit for all other
data structures" is (or
Chris Angelico wrote:
So do I need to be able to "call a function as if it
were a procedure", or is there a stark difference between the two
types of callable?
Well, Pascal makes a stark distinction between them -- it's
a compile-time error to call a procedure as though it were
a function or vi
On Sun, 31 Jul 2016 04:46 am, BartC wrote:
> On 30/07/2016 16:48, Steven D'Aprano wrote:
>> On Sat, 30 Jul 2016 11:58 pm, BartC wrote:
>>
>>> The 'i' is superfluous. Why not:
>>>
>>> for 10:
>>
>> Why bother? What's so special about this that it needs dedicated syntax?
>
> No named loop variabl
On Sun, Jul 31, 2016 at 11:45 AM, Gregory Ewing
wrote:
> Chris Angelico wrote:
>>
>> So do I need to be able to "call a function as if it
>> were a procedure", or is there a stark difference between the two
>> types of callable?
>
>
> Well, Pascal makes a stark distinction between them -- it's
> a
On Sunday, July 31, 2016 at 7:07:45 AM UTC+5:30, Gregory Ewing wrote:
> Michael Torrie wrote:
> > Python would have been alright to teach "programming," but to
> > teach the actual theory of programming languages (lambda calculus, lists
> > as a foundation unit for all other data structures)
>
> I
Chris Angelico wrote:
I mean, "for i in 3.5" should start half way down the loop body, complete that
loop, and
then do three complete loops.
+1, this is the best idea for a "loop-and-a-half"
construct I've ever seen.
--
Greg
--
https://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
In English,
we can talk about having a quick meal of fast food, but not a fast meal of
quick food.
If you interpret "quick" in its original sense of "alive"
then it's theoretically possible, although not practised
much in civilised society these days. Yoghurt might
qualif
On Sun, 31 Jul 2016 04:16 am, Michael Torrie wrote:
> On 07/30/2016 11:53 AM, Steven D'Aprano wrote:
>> On Sun, 31 Jul 2016 02:29 am, Rustom Mody wrote:
>>
>>> MIT on practical reasons for python over scheme:
>>>
>>
https://www.wisdomandwonder.com/link/2110/why-mit-switched-from-scheme-to-python
On Saturday, July 30, 2016 at 5:21:44 PM UTC+5:30, Chris Angelico wrote:
> On Sat, Jul 30, 2016 at 9:44 PM, Cai Gengyang wrote:
> > You mentioned that : A floating point number[2] is number that is not an
> > integer (and not a
> > complex number)
> >
> > Hence ,
> >
> > 10 is not a floating poin
On Sun, 31 Jul 2016 12:17 pm, 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).
Correct.
> It means you can't
> upgrade something fr
On Sunday, July 31, 2016 at 8:44:13 AM UTC+5:30, Steven D'Aprano wrote:
> It has always perplexed me that Lisp's prefix notation is held up as
> the /sine qua non/ of elegance and power, while Forth is ignored if not
> ridiculed. Forth is just as expressive as Lisp, just as meta, just as
> customi
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
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
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 be an obvious error (possibly even a
> compile-time syntax error) instead of
On Sun, Jul 31, 2016 at 1:32 PM, Steven D'Aprano wrote:
>> It means you can't
>> upgrade something from "always returns None" to "returns the number of
>> objects frobbed" without breaking compat.
>
> You shouldn't ever need to. At least that's the theory. In practice its not
> quite cut and dried
On Sun, Jul 31, 2016 at 1:12 PM, Gregory Ewing
wrote:
> Chris Angelico wrote:
>>
>> I mean, "for i in 3.5" should start half way down the loop body, complete
>> that loop, and
>> then do three complete loops.
>
>
> +1, this is the best idea for a "loop-and-a-half"
> construct I've ever seen.
It w
On Sun, Jul 31, 2016 at 1:34 PM, Rustom Mody wrote:
> to
>> > teach the actual theory of programming languages (lambda calculus, lists
>> > as a foundation unit for all other data structures), Scheme was an ideal
>> > choice for teaching these fundamentals.
>>
>> People misuse language. You say th
On Sun, Jul 31, 2016 at 1:51 PM, Random832 wrote:
> 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).
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
Steven D'Aprano writes:
>> Maybe. Lisp and Scheme are great languages to teach the theory..
> Doesn't sound like a good teaching language to me.>
> Meta-reasoning is harder than regular reasoning. That's why metaclasses are
> harder to use than ordinary classes.
Python metaclasses are monstrousl
On Sun, 31 Jul 2016 02:01 pm, 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 be an obv
On Sunday, July 31, 2016 at 9:43:03 AM UTC+5:30, Chris Angelico wrote:
> On Sun, Jul 31, 2016 at 1:34 PM, Rustom Mody wrote:
> > to
> >> > teach the actual theory of programming languages (lambda calculus, lists
> >> > as a foundation unit for all other data structures), Scheme was an ideal
> >> >
On Sunday, July 31, 2016 at 12:10:33 PM UTC+5:30, Steven D'Aprano wrote:
> On Sun, 31 Jul 2016 02:01 pm, 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
On Sun, Jul 31, 2016 at 4:40 PM, Steven D'Aprano wrote:
>> While neither is a syntax error, the latter is definitely a run-time
>> error:
>>
> mylist.sort().reverse()
>> Traceback (most recent call last):
>> File "", line 1, in
>> AttributeError: 'NoneType' object has no attribute 'reverse'
75 matches
Mail list logo