Rustom Mody wrote:
> Others have answered some parts
if x in x_list:
> ... print("That is a fruit.")
> ... else:
> ... print("That is not a fruit.")
> ...
>
> However one can distribute the print out of the if; Thus
>
"This is %s a fruit" % ("" if x in x_list else "not")
Which
On Tuesday 15 March 2016 16:26, Jussi Piitulainen wrote:
> Steven D'Aprano writes:
>
>> Unfortunate or not, it seems to be quite common that "zip"
>> (convolution) discards items when sequences are of different lengths.
>
> Citation needed. Where is zip called convolution?
Wikipedia :-)
Unfort
On Tue, Mar 15, 2016 at 7:39 PM, Steven D'Aprano
wrote:
>> Why should zip be called convolution?
>
> Why should anything be called anything?
>
> Don't worry, I'm not suggesting that the zip function be renamed.
>
It's like referring to the 'and' and 'or' operators as conjunctions
and disjunctions
Steven D'Aprano writes:
> On Tuesday 15 March 2016 16:26, Jussi Piitulainen wrote:
>
>> Steven D'Aprano writes:
>>
>>> Unfortunate or not, it seems to be quite common that "zip"
>>> (convolution) discards items when sequences are of different lengths.
>>
>> Citation needed. Where is zip called c
On Mon, 14 Mar 2016 20:31:06 +, BartC wrote:
> On 14/03/2016 19:45, alister wrote:
>> On Mon, 14 Mar 2016 14:43:22 +, BartC wrote:
>>
>>> On 13/03/2016 09:39, Steven D'Aprano wrote:
On Sun, 13 Mar 2016 04:54 am, BartC wrote:
>>>
> Common sense tells you it is unlikely.
P
BartC :
> But how do you pass something that refers to a itself?
>
> There are good reasons for wanting to do so. Try writing this function
> in Python:
>
> def swap(a,b):
> b,a = a,b
Have you tried writing same function in Java? Java is a hugely
successful, highly performant programming lang
Suppose somebody passes me an open file handle. What's the right way to tell
if it is seekable in Python 2?
I see that stdin has a seek and tell method, but they raise:
py> sys.stdin.tell()
Traceback (most recent call last):
File "", line 1, in
IOError: [Errno 29] Illegal seek
Are seek and te
Hi, I am using imaplib to fetch Gmail's Inbox Archived message but results are
not that much accurate. Here is code+logic:
def inbox_week():
import imaplib
EMAIL = 'myusern...@gmail.com'
PASSWORD = 'mypassword'
mail = imaplib.IMAP4_SSL('imap.gmail.com')
mail.login( EMAIL, PA
On 2016-03-15, Steven D'Aprano wrote:
> Suppose somebody passes me an open file handle. What's the right way to tell
> if it is seekable in Python 2?
>
> I see that stdin has a seek and tell method, but they raise:
>
> py> sys.stdin.tell()
> Traceback (most recent call last):
> File "", line 1,
On 14 March 2016 at 23:59, Steven D'Aprano wrote:
> On Tue, 15 Mar 2016 02:06 am, Oscar Benjamin wrote:
>
>> On 14 March 2016 at 14:35, Rick Johnson
>> wrote:
>>>
>>> I would strongly warn anyone against using the zip function
>>> unless
>> ...
>>> I meant to say: absolutely, one hundred percent
On Tuesday, March 15, 2016 at 2:00:25 PM UTC+5:30, Peter Otten wrote:
> Rustom Mody wrote:
>
> > Others have answered some parts
> if x in x_list:
> > ... print("That is a fruit.")
> > ... else:
> > ... print("That is not a fruit.")
> > ...
> >
> > However one can distribute the prin
Jon Ribbens :
> I'd just do something like:
>
> try:
> fileobj.seek(where-i-want-to-seek-to)
> except (AttributeError, EnvironmentError):
> # file is not seekable
Unlike Java, Python does not declare syntactically which exceptions the
caller should expect. Unfortunately, the libra
Okay, So basically I created a python script around 1 year ago to grab an
explain_plan from a Greenplum system (Normal SQL) and change it around and
explain each step/section, the thing is, I've came back to the python code and
I don't understand anything of what it's doing (the code specificall
On 15/03/2016 01:55, Steven D'Aprano wrote:
On Tue, 15 Mar 2016 04:53 am, BartC wrote:
I get it. The author doesn't like switch statements!
I don't think you do -- there's no "the author". It's a wiki. There's
potentially *thousands* of "authors". The page you (might have) read is a
discuss
On 15/03/2016 09:20, alister wrote:
Why would i do somthing so pointless?
Name references are pointless? OK, you're the expert ...
how does this grab you (it often catches newbies out)
def test(x):
a.append('oops')
a=['a list']
test(a)
print (a)
Not any more.
I sugest you may
On Tue, Mar 15, 2016 at 11:02 PM, BartC wrote:
> Anyway, what I'm saying is, trying to implement a language is also a good
> way of learning it, especially of finding out how it works.
Same goes for a lot of things. Want to know how Windows ticks? Try
reimplementing it - or read the comments left
On 2016-03-15, Marko Rauhamaa wrote:
> Jon Ribbens :
>> I'd just do something like:
>>
>> try:
>> fileobj.seek(where-i-want-to-seek-to)
>> except (AttributeError, EnvironmentError):
>> # file is not seekable
>
> Unlike Java, Python does not declare syntactically which exceptions th
Jon Ribbens :
> On 2016-03-15, Marko Rauhamaa wrote:
>> Having to specify the possible exceptions in Java is very painful and
>> has complicated the introduction of closures to Java quite a bit.
>
> It is one of the extremely serious design errors in Java, I think.
>
>> I think it points to a big
On 2016-03-15, Marko Rauhamaa wrote:
> Jon Ribbens :
>> On 2016-03-15, Marko Rauhamaa wrote:
>>> I think it points to a big practical problem in the whole exception
>>> paradigm.
>>
>> Well, no. That one individual language screwed up its implementation
>> of exceptions does not mean the whole co
On 2016-03-14, Seymore4Head wrote:
> Wells Fargo online will not allow you to change a payee's address. You
> have to delete the account and re enter it.
Wells Fargo is a pretty large company with a lot of money to spend.
How difficult a web site is to use is proportional to the size of
organiz
On 15/03/2016 11:52, BartC wrote:
On 15/03/2016 01:55, Steven D'Aprano wrote:
switch obj:
case "Hello", None: ...
case [1, 2, 3]: ...
case 23.01, 15+2j, Fraction(10, 11): ...
case 100**100, {}: ...
and more. This is not negotiable: having a switch statement limited to
sma
On Tue, Mar 1, 2016 at 2:41 AM, Martin A. Brown wrote:
> Please read below. I will take a stab at explaining the gaps of
> understanding you seem to have (others have tried already, but I'll
> try, as well).
>
> I am going to give you four different functions which demonstrate
> how to use excep
On Tuesday, March 15, 2016 at 5:48:15 AM UTC-5, Arshpreet Singh wrote:
> def inbox_week():
> import imaplib
> EMAIL = 'myusern...@gmail.com'
I admit that this is pedantic, but you should really use
ADDRESS instead of EMAIL. ADDRESS more correctly complements
PASSWORD. But in any event, yo
Rustom Mody wrote:
> On Tuesday, March 15, 2016 at 2:00:25 PM UTC+5:30, Peter Otten wrote:
>> Rustom Mody wrote:
>>
>> > Others have answered some parts
>> if x in x_list:
>> > ... print("That is a fruit.")
>> > ... else:
>> > ... print("That is not a fruit.")
>> > ...
>> >
>> > How
Luke Charlton wrote:
> Okay, So basically I created a python script around 1 year ago to grab an
> explain_plan from a Greenplum system (Normal SQL) and change it around and
> explain each step/section, the thing is, I've came back to the python code
> and I don't understand anything of what it's
On Tuesday, March 15, 2016 at 7:21:02 AM UTC-5, Chris Angelico wrote:
> I'm sure implementing Python is a lot more fun than reimplementing
> Windows APIs!
There's not much on this earth, that is worse than Windows APIs.
--
https://mail.python.org/mailman/listinfo/python-list
On 2016-03-15 14:37, Grant Edwards wrote:
On 2016-03-14, Seymore4Head wrote:
Wells Fargo online will not allow you to change a payee's address. You
have to delete the account and re enter it.
Wells Fargo is a pretty large company with a lot of money to spend.
How difficult a web site is to
Luke Charlton wrote:
> Okay, So basically I created a python script around 1 year ago to grab an
> explain_plan from a Greenplum system (Normal SQL) and change it around and
> explain each step/section, the thing is, I've came back to the python code
> and I don't understand anything of what it's
On 15/03/2016 14:58, BartC wrote:
On 15/03/2016 11:52, BartC wrote:
On 15/03/2016 01:55, Steven D'Aprano wrote:
switch obj:
case "Hello", None: ...
case [1, 2, 3]: ...
case 23.01, 15+2j, Fraction(10, 11): ...
case 100**100, {}: ...
and more. This is not negotiable: havin
Ben Finney wrote:
> Swanand Pashankar writes:
>> Embedding a Python file in C code works, but it exposes your Python
>> script. Didn't find any free fool-proof way to obfuscate Python code
>> either.
>
> What exactly is it you want to prevent? Why do you think obfuscating the
> code will achieve
On Tuesday, March 15, 2016 at 9:38:16 AM UTC-5, Grant Edwards wrote:
> How difficult a web site is to use is proportional to the
> size of organization that owns it and how much money they
> spent developing it.
I would also add: "The quality of the engineers who design
and implement it". This is
On Tuesday, March 15, 2016 at 1:23:58 PM UTC-5, MRAB wrote:
> Failure is not inevitable.
Inevitable? No.
Highly probable? Yes.
(This message sponsored by: The Magic Eight Ball)
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, 14 Mar 2016 20:56:44 +, Val Krem wrote:
> #!/usr/bin/python
On some Linux systems python is installed in /usr/local/bin.
I would suggest using the hash-bang below. It will insure
python will run no matter where it was installed.
#!/usr/bin/env python
--
GNU/Linux user #557453
May
On Wed, Mar 16, 2016 at 5:59 AM, Thomas 'PointedEars' Lahn
wrote:
> That said, not distributing the source code of a program as well (or at
> least making it available to users in some way) strikes me as unpythonic
> since Python is at least Open Source software, and Python 2.0.1, 2.1.1 and
> newe
Given that "Case Statements" are more compact and less redundant than a
sequence of if-elif statements, and usually can contain embedded match lists:
Is there any chance future versions of Python will adopt a case structure?
Something like
select x
case in [1,2,3,5,7,9]
print
case
Hey guys,
I'm a 16 year old Python Programmer that wanted to do something different.
But, like we know, ideas are quite difficult to find.
So I decided to develop a URL Shortener to help the Python community out and
share my coding knowledge, and today the project was launched with its first
sta
Am 14.03.16 um 23:40 schrieb BartC:
On 14/03/2016 22:20, Mark Lawrence wrote:
> The RUE kept stating that he was an expert in unicode, but never once
> provided a single shred of evidence to support his claim. Until I see
> substantiated evidence from you I am going to state quite cleary that
Chris Angelico wrote:
> On Wed, Mar 16, 2016 at 5:59 AM, Thomas 'PointedEars' Lahn
> wrote:
>> That said, not distributing the source code of a program as well (or at
>> least making it available to users in some way) strikes me as unpythonic
>> since Python is at least Open Source software, and
Vinicius Mesel wrote:
> I'm a 16 year old Python Programmer that wanted to do something different.
> But, like we know, ideas are quite difficult to find.
> So I decided to develop a URL Shortener to help the Python community out
> and share my coding knowledge, and today the project was launched
On 15/03/2016 20:46, jj0gen0i...@gmail.com wrote:
Given that "Case Statements" are more compact and less redundant than a
sequence of if-elif statements, and usually can contain embedded match lists:
Is there any chance future versions of Python will adopt a case structure?
Something like
sele
On 15/03/16 22:53, Thomas 'PointedEars' Lahn wrote:
A few
less bytes there do not count.
You mean "Fewer bytes there do not count".
E.
(But on the whole, yes, I do agree with your position in this instance.
Kudos to Vinicius for doing something productive with his time though -
I'm sure a lo
On Wed, Mar 16, 2016 at 9:53 AM, Thomas 'PointedEars' Lahn
wrote:
> Vinicius Mesel wrote:
>
>> I'm a 16 year old Python Programmer that wanted to do something different.
>> But, like we know, ideas are quite difficult to find.
>> So I decided to develop a URL Shortener to help the Python community
On Tuesday, March 15, 2016 at 5:54:46 PM UTC-5, Thomas 'PointedEars' Lahn wrote:
> Vinicius Mesel wrote:
> > I'm a 16 year old Python Programmer that wanted to do
> > something different. But, like we know, ideas are quite
> > difficult to find. So I decided to develop a URL
> > Shortener to help t
Chris Angelico wrote:
> On Wed, Mar 16, 2016 at 9:53 AM, Thomas 'PointedEars' Lahn
> wrote:
Attribution *line*, _not_ attribution novel.
>> […] I cannot be sure because I have not thought this through, but with
^^^
>> aliases for commo
Hi Chris,
On 15/03/16 23:16, Chris Angelico wrote:
So URL shorteners are invaluable tools.
Perhaps, and in the specific - transient - use-cases you describe that's
fine. The problem I have with them is that they are a level of
indirection controlled by a third party. If the source (let's say
Thanks for the informative post. I've read it and disagree with the rational,
it places Python in a decided minority of the major languages.
https://en.wikipedia.org/wiki/Conditional_(computer_programming)#Case_and_switch_statements
See section "Choice system cross reference"
Thanks again for
On Wed, Mar 16, 2016 at 10:40 AM, Erik wrote:
> Hi Chris,
>
> On 15/03/16 23:16, Chris Angelico wrote:
>>
>> So URL shorteners are invaluable tools.
>
>
> Perhaps, and in the specific - transient - use-cases you describe that's
> fine. The problem I have with them is that they are a level of indir
On Wed, Mar 16, 2016 at 10:38 AM, Thomas 'PointedEars' Lahn
wrote:
> Chris Angelico wrote:
>
>> On Wed, Mar 16, 2016 at 9:53 AM, Thomas 'PointedEars' Lahn
>> wrote:
>
>>> […] I cannot be sure because I have not thought this through, but with
> ^
On 15/03/2016 23:47, jj0gen0i...@gmail.com wrote:
Thanks for the informative post. I've read it and disagree with the rational,
it places Python in a decided minority of the major languages.
https://en.wikipedia.org/wiki/Conditional_(computer_programming)#Case_and_switch_statements
See secti
On Mon, 14 Mar 2016 10:19:23 -0500, Skip Montanaro wrote:
> Is this correct (today, with Daylight Savings in effect)?
>
import pytz
i.timezone
> 'America/Chicago'
pytz.timezone(i.timezone)
>
ot
> datetime.datetime(2016, 3, 14, 9, 30, tzinfo= 'America/New_York' EDT-1 day, 20:00:0
Rick Johnson wrote:
> On Tuesday, March 15, 2016 at 5:54:46 PM UTC-5, Thomas 'PointedEars' Lahn
> wrote:
>> Vinicius Mesel wrote:
>> > I'm a 16 year old Python Programmer that wanted to do
>> > something different. But, like we know, ideas are quite
>> > difficult to find. So I decided to develop
Hi Chris,
On 15/03/16 23:48, Chris Angelico wrote:
I agree, it's a risk. Any indirection adds that. So the benefit has to
be weighed against this inherent cost.
True, so it's not URL shorteners that I disagree with on principle, it's
the _inappropriate_ use of URL shorteners ;) If one uses th
On Wed, Mar 16, 2016 at 11:31 AM, Erik wrote:
>
>> I often like to make a small
>> change when I reimplement, though - something that I thought was
>> ill-designed in the original,
>
>
> OK, so maybe the idea for Vinicius (if he's still reading) to pursue is that
> it should be something that can
On 15/03/2016 21:02, Christian Gollwitzer wrote:
Am 14.03.16 um 23:40 schrieb BartC:
On 14/03/2016 22:20, Mark Lawrence wrote:
> The RUE kept stating that he was an expert in unicode, but never once
> provided a single shred of evidence to support his claim. Until I see
> substantiated evide
Chris Angelico wrote:
> On Wed, Mar 16, 2016 at 10:38 AM, Thomas 'PointedEars' Lahn
> wrote:
>> Chris Angelico wrote:
>>> On Wed, Mar 16, 2016 at 9:53 AM, Thomas 'PointedEars' Lahn
>>> wrote:
[…] I cannot be sure because I have not thought this through, but with
>>
Mark Lawrence wrote:
> Please ignore 'PointedEars',
Please ignore Mark Lawrence unless he has something on-topic to say.
How does that feel, Mark?
> every month or so for some weird reason
The reason being obviously that the people to whose postings I happen to
post a follow-up to do not post
On 15/03/2016 23:47, jj0gen0i...@gmail.com wrote:
Thanks for the informative post. I've read it and disagree with the rational,
it places Python in a decided minority of the major languages.
And this proposal (3103) was by the guy who invented the language!
Good thing he didn't have design-
On 16/03/2016 00:51, BartC wrote:
On 15/03/2016 23:47, jj0gen0i...@gmail.com wrote:
Thanks for the informative post. I've read it and disagree with the
rational, it places Python in a decided minority of the major languages.
And this proposal (3103) was by the guy who invented the language!
You have apparently mistaken me for someone who's worried. I don't use Python,
I was just curious as to why a construct that is found, not only to be useful
in 95% of other languages, but is generally considered more flexible and
readable than the if-elif, was missing in Python. (your link "Sw
On Tuesday 15 March 2016 19:55:52 Chris Angelico wrote:
> On Wed, Mar 16, 2016 at 10:38 AM, Thomas 'PointedEars' Lahn
>
> wrote:
> > Chris Angelico wrote:
> >> On Wed, Mar 16, 2016 at 9:53 AM, Thomas 'PointedEars' Lahn
> >>
> >> wrote:
> >>> […] I cannot be sure because I have not thought this t
Gene Heskett wrote:
> On Tuesday 15 March 2016 19:55:52 Chris Angelico wrote:
>> On Wed, Mar 16, 2016 at 10:38 AM, Thomas 'PointedEars' Lahn
>> > And as for second-level domains, consider for example “t.c” instead
>> > of “twitter.com” as part of the short URI.
>> That'll work only for the ones th
On Tuesday, March 15, 2016 at 11:05:32 PM UTC+5:30, Peter Otten wrote:
> Indeed. It's still better than
>
> "This is %s a fruit" % (x in x_list and "" or "not")
>
> The bug is intentional; the fix is of course
>
> "This is %s a fruit" % (x in x_list and "most likely" or "probably not")
>
> ;)
On Tuesday 15 March 2016 22:46:44 Thomas 'PointedEars' Lahn wrote:
> Gene Heskett wrote:
> > On Tuesday 15 March 2016 19:55:52 Chris Angelico wrote:
> >> On Wed, Mar 16, 2016 at 10:38 AM, Thomas 'PointedEars' Lahn
> >>
> >> > And as for second-level domains, consider for example “t.c”
> >> > inste
On Tuesday, March 15, 2016 at 7:23:12 PM UTC-5, Thomas 'PointedEars' Lahn wrote:
(Note: i had to rearrange your paragraph to accommodate a more
intuitive response. I apologize for this, but i'm confident
i was able to maintain your original intent)
> You are giving bad advice to a junior develope
On Tuesday, March 15, 2016 at 9:55:27 PM UTC-4, jj0ge...@gmail.com wrote:
> You have apparently mistaken me for someone who's worried. I don't use
> Python, I was just curious as to why a construct that is found, not only to
> be useful in 95% of other languages, but is generally considered more
On 16/03/2016 01:55, jj0gen0i...@gmail.com wrote:
You have apparently mistaken me for someone who's worried. I don't use Python, I was
just curious as to why a construct that is found, not only to be useful in 95% of other
languages, but is generally considered more flexible and readable than
Chris Angelico wrote:
There are many places where there are limits (hard or soft) on message
lengths. Some of us still use MUDs and 80-character line limits.
Business cards or other printed media need to be transcribed by hand.
Dictation of URLs becomes virtually impossible when they're
arbitrari
On Wed, Mar 16, 2016 at 3:27 PM, Gregory Ewing
wrote:
> Chris Angelico wrote:
>>
>> There are many places where there are limits (hard or soft) on message
>> lengths. Some of us still use MUDs and 80-character line limits.
>> Business cards or other printed media need to be transcribed by hand.
>>
On Wednesday 16 March 2016 10:38, Thomas 'PointedEars' Lahn wrote:
> Chris Angelico wrote:
>
>> On Wed, Mar 16, 2016 at 9:53 AM, Thomas 'PointedEars' Lahn
>> wrote:
>
> Attribution *line*, not attribution novel.
Chris' attribution is about 75,000 words short of even a small novel.
And it woul
69 matches
Mail list logo