Re: how to search item in list of list

2016-06-13 Thread Larry Hudson via Python-list
On 06/12/2016 08:29 PM, meInvent bbird wrote: once a nested list have a word "node" then true else false def search(current_item): if isinstance(current_item, list): if len(current_item)==4: if [item for item in current_item if item[4] == "node"] != []:

Re: for / while else doesn't make sense

2016-06-13 Thread Michael Selik
On Mon, Jun 13, 2016 at 10:46 PM Steven D'Aprano wrote: > On Tue, 14 Jun 2016 09:45 am, Michael Selik wrote: > > On Sun, Jun 12, 2016 at 10:16 PM Steven D'Aprano > > wrote: > >> On Mon, 13 Jun 2016 04:44 am, Michael Selik wrote: > >> > On Sun, Jun 12, 2016 at 6:11 AM Steven D'Aprano < > >> > ste

Python 3.6.0a2 is now available

2016-06-13 Thread Ned Deily
On behalf of the Python development community and the Python 3.6 release team, I'm happy to announce the availability of Python 3.6.0a2. 3.6.0a2 is the first of four planned alpha releases of Python 3.6, the next major release of Python. During the alpha phase, Python 3.6 remains under heavy devel

Re: Indentation example?

2016-06-13 Thread ICT Ezy
On Monday, June 13, 2016 at 3:09:15 AM UTC+5:30, Marc Dietz wrote: > On Sun, 12 Jun 2016 08:10:27 -0700 ICT Ezy wrote: > > > Pl explain with an example the following phase "Indentation cannot be > > split over multiple physical lines using backslashes; the whitespace up > > to the first backslash

Re: for / while else doesn't make sense

2016-06-13 Thread Steven D'Aprano
On Tue, 14 Jun 2016 09:45 am, Michael Selik wrote: > On Sun, Jun 12, 2016 at 10:16 PM Steven D'Aprano > wrote: > >> On Mon, 13 Jun 2016 04:44 am, Michael Selik wrote: >> >> > On Sun, Jun 12, 2016 at 6:11 AM Steven D'Aprano < >> > steve+comp.lang.pyt...@pearwood.info> wrote: >> > >> >> - run the

Re: base64.b64encode(data)

2016-06-13 Thread Random832
On Mon, Jun 13, 2016, at 19:12, Gregory Ewing wrote: > They could maybe be made a bit cheaper still by arranging > some way for a bytes object and an ascii-only str object > to share underlying storage. While we're at it, why not allow bytes to share storage with FSR latin-1 strings and the cached

Please use the Python Job Board for recruiting (was: [recruitment message])

2016-06-13 Thread Ben Finney
pan...@openmindtechno.com writes: > I am looking to hire for an excellent opportunity Please do not use this forum for recruiting. Instead, use the Python Job Board https://www.python.org/community/jobs/> maintained for that purpose. -- \ “The fact that I have no remedy for all the so

Re: Overriding methods inherited from a superclass with methods from a mixin

2016-06-13 Thread Michael Selik
On Mon, Jun 13, 2016 at 7:46 PM wrote: > I ... am making an effort to get used to the rtl order as quickly as > possible. > Funny, you keep saying right-to-left. I think the issue is you think the parent class is more important. Fight the power! Youth revolt! In Python, the children are in contr

Re: for / while else doesn't make sense

2016-06-13 Thread Michael Selik
On Sun, Jun 12, 2016 at 10:16 PM Steven D'Aprano wrote: > On Mon, 13 Jun 2016 04:44 am, Michael Selik wrote: > > > On Sun, Jun 12, 2016 at 6:11 AM Steven D'Aprano < > > steve+comp.lang.pyt...@pearwood.info> wrote: > > > >> - run the for block > >> - THEN unconditionally run the "else" block > >>

Re: Overriding methods inherited from a superclass with methods from a mixin

2016-06-13 Thread alanqueiros
On Monday, June 13, 2016 at 7:29:05 PM UTC-3, Gregory Ewing wrote: > > I see that in most cases the order doesn't matter, but still I would > > think that since the correct order is from right to left, that should be the > > common practice. > > This order is only "correct" if overriding is what y

Re: base64.b64encode(data)

2016-06-13 Thread Gregory Ewing
Chris Angelico wrote: Maybe what Python needs is an "ascii" type that's a subclass of both str and bytes, and requires that the contents be <0x80. It is text, so it can be combined with text strings; but it is also bytes, so when you combine it with bytes strings, it'll behave as most people expe

Re: base64.b64encode(data)

2016-06-13 Thread Gregory Ewing
Michael Torrie wrote: On 06/12/2016 11:16 PM, Steven D'Aprano wrote: Squirt it down a wire as bytes? Almost certainly. Sometimes yes. But not always. And even when the ultimate destination is a wire, a Python programmer is more likely to be accessing the wire through some high-level interf

Re: Overriding methods inherited from a superclass with methods from a mixin

2016-06-13 Thread Michael Selik
On Mon, Jun 13, 2016 at 2:46 PM wrote: > Thank you for your replies. I don't know if I'm quoting you correctly, I'm > quite confused with Google Groups... not sure if it's a "forum", something > like a mailing list, or both... or neither. > Mailing list. A "forum" in the metaphorical sense, not

Looking for Python Engineering Manager or Python experts for world's leading Artificial Intelligence Company in San Francisco,CA

2016-06-13 Thread pankaj
Hi, I am looking to hire for an excellent opportunity for an Python Engineering Manager or Python experts for world's leading Arti-0878ficial Intelligence Company in San Francisco,CA. Please do refer or contact me at cell 510-396-0878. Both Full time Perm and Contract opportunities are open.

Re: Overriding methods inherited from a superclass with methods from a mixin

2016-06-13 Thread Gregory Ewing
alanquei...@gmail.com wrote: I see that in most cases the order doesn't matter, but still I would think that since the correct order is from right to left, that should be the common practice. This order is only "correct" if overriding is what you want. That's not always going to be the case. Th

Re: Conversion: execfile --> exec

2016-06-13 Thread Michael Selik
On Mon, Jun 13, 2016 at 1:51 PM Rustom Mody wrote: > looks (to me) like an intent to import the package chaco with no locals > and globals -- Just guessing of course > And without creating a module object. I suppose that means it doesn't get cached in sys.modules either. Not sure if that's a fea

Re: Overriding methods inherited from a superclass with methods from a mixin

2016-06-13 Thread alanqueiros
Thank you for your replies. I don't know if I'm quoting you correctly, I'm quite confused with Google Groups... not sure if it's a "forum", something like a mailing list, or both... or neither. > The class' MRO ("Method Resolution Order") determines in which > order attributes are looked up. > E

Re: Conversion: execfile --> exec

2016-06-13 Thread Rustom Mody
On Monday, June 13, 2016 at 10:48:33 PM UTC+5:30, Michael Selik wrote: > On Mon, Jun 13, 2016, 10:36 AM Rustom Mody wrote: > > > On Monday, June 13, 2016 at 7:41:33 PM UTC+5:30, MRAB wrote: > > > On 2016-06-13 14:24, Long Yang wrote: > > > > The python 2.x command is as following: > > > > ---

Re: Overriding methods inherited from a superclass with methods from a mixin

2016-06-13 Thread Michael Selik
On Mon, Jun 13, 2016 at 12:01 AM wrote: > I haven't used Python for some time so I don't feel confident to judge > Yet, you are clearly judging the code you pasted as not OK. Perhaps you guys could help me either convincing me that the bpaste code is > OK > It would be helpful for you to expla

Re: Conversion: execfile --> exec

2016-06-13 Thread Michael Selik
On Mon, Jun 13, 2016, 10:36 AM Rustom Mody wrote: > On Monday, June 13, 2016 at 7:41:33 PM UTC+5:30, MRAB wrote: > > On 2016-06-13 14:24, Long Yang wrote: > > > The python 2.x command is as following: > > > --- > > > info = {} > > > execfile(join('chaco', '__init__.py'), i

Re: base64.b64encode(data)

2016-06-13 Thread Chris Angelico
On Tue, Jun 14, 2016 at 1:15 AM, Michael Torrie wrote: >> Looking at this from the high-level perspective of Python, that makes it >> conceptually bytes not text. > > I don't see how this is always the case. From a high-level python > perspective it's definitely text. That's the whole point of b

Re: base64.b64encode(data)

2016-06-13 Thread Michael Torrie
On 06/12/2016 11:16 PM, Steven D'Aprano wrote: > "Safe to transmit in text protocols" surely should mean "any Unicode code > point", since all of Unicode is text. What's so special about the base64 > ones? > > Well, that depends on your context. For somebody who cares about sending > bits over a p

Re: Conversion: execfile --> exec

2016-06-13 Thread Rustom Mody
On Monday, June 13, 2016 at 7:41:33 PM UTC+5:30, MRAB wrote: > On 2016-06-13 14:24, Long Yang wrote: > > The python 2.x command is as following: > > --- > > info = {} > > execfile(join('chaco', '__init__.py'), info) > > -- > > > > But execfile has

Re: Conversion: execfile --> exec

2016-06-13 Thread MRAB
On 2016-06-13 14:24, Long Yang wrote: The python 2.x command is as following: --- info = {} execfile(join('chaco', '__init__.py'), info) -- But execfile has been removed in python 3.x. So my problem is how to convert the above to a 3.x based co

Re: base64.b64encode(data)

2016-06-13 Thread Random832
On Mon, Jun 13, 2016, at 06:35, Steven D'Aprano wrote: > But this is a Python forum, and Python 3 is a language that tries > very, very hard to keep a clean separation between bytes and text, Yes, but that doesn't mean that you're right about which side of that divide base64 output belongs on. >

Re: Altering sys.argv on startup in Python 2

2016-06-13 Thread Adam Bartoš
Thank you very much, the hook gets invoked at the right place. Adam Bartoš -- https://mail.python.org/mailman/listinfo/python-list

Conversion: execfile --> exec

2016-06-13 Thread Long Yang
The python 2.x command is as following: --- info = {} execfile(join('chaco', '__init__.py'), info) -- But execfile has been removed in python 3.x. So my problem is how to convert the above to a 3.x based command? thanks very much -- https://mai

Re: Overriding methods inherited from a superclass with methods from a mixin

2016-06-13 Thread Ian Kelly
On Mon, Jun 13, 2016 at 1:13 AM, dieter wrote: > alanquei...@gmail.com writes: > >> I'm trying to override methods inherited from a superclass by methods >> defined in a mixin class. >> Here's an sscce: >> https://bpaste.net/show/6c7d8d590658 (never expires) >> >> I've had problems finding the pr

Re: passing dictionay as argument

2016-06-13 Thread marco . nawijn
On Monday, June 13, 2016 at 12:54:45 PM UTC+2, Arshpreet Singh wrote: > I have to pass dictionary as function argument for following code: > > > import authorize > > authorize.Configuration.configure( > authorize.Environment.TEST, > 'api_login_id', > 'api_transaction_key', > ) > > r

Re: passing dictionay as argument

2016-06-13 Thread Frank Millman
"Arshpreet Singh" wrote in message news:0b6372ce-3f16-431b-9e72-42d5c935d...@googlegroups.com... I have to pass dictionary as function argument for following code: [...] result = authorize.Transaction.sale({ 'amount': 40.00, 'credit_card': { 'card_number': '411

Re: passing dictionay as argument

2016-06-13 Thread David Navarro
To be equivalent to the other one it should be: result = authorize.Transaction.sale({'amount': 40.00, 'credit_card': credit_card}) In this line: result = authorize.Transaction.sale({40.00,credit_card}) You are not putting keys in the dictionary. If there are no keys Python creates a 'set literal

passing dictionay as argument

2016-06-13 Thread Arshpreet Singh
I have to pass dictionary as function argument for following code: import authorize authorize.Configuration.configure( authorize.Environment.TEST, 'api_login_id', 'api_transaction_key', ) result = authorize.Transaction.sale({ 'amount': 40.00, 'credit_card': { 'card_

Re: base64.b64encode(data)

2016-06-13 Thread Steven D'Aprano
On Mon, 13 Jun 2016 03:33 pm, Random832 wrote: > Why do you say these things like you assume I will agree with them. Because I gave you the benefit of the doubt that you were a reasonable person open to good-faith discussion, rather than playing John Cleese's role in your own personal version of

Re: Overriding methods inherited from a superclass with methods from a mixin

2016-06-13 Thread Peter Otten
alanquei...@gmail.com wrote: > Hello there. > > I'm trying to override methods inherited from a superclass by methods > defined in a mixin class. Here's an sscce: > https://bpaste.net/show/6c7d8d590658 (never expires) > #the following represents classes I don't have control over > class Base(obj

Re: Overriding methods inherited from a superclass with methods from a mixin

2016-06-13 Thread dieter
alanquei...@gmail.com writes: > I'm trying to override methods inherited from a superclass by methods defined > in a mixin class. > Here's an sscce: > https://bpaste.net/show/6c7d8d590658 (never expires) > > I've had problems finding the proper way to do that, since at first the base > class was

Re: loading trees...

2016-06-13 Thread dieter
Fillmore writes: > Hi, problem for today. I have a batch file that creates "trees of data". > I can save these trees in the form of python code or serialize them with > something > like pickle. > > I then need to run a program that loads the whole forest in the form of a > dict() > where each i