Ian Kelly wrote:
> On Wed, Dec 24, 2014 at 1:34 PM, Rustom Mody
> wrote:
>> +1 for the slice in succinct form
>
> Not only more succinct but also more correct. The purpose of islice is to
> slice arbitrary iterables as opposed to just sequences. But this function
> requires a reentrant iterable
Hello,
Is it possible in python:
if ((x = a(b,c)) == 'TRUE'):
print x
Thanks.
--
https://mail.python.org/mailman/listinfo/python-list
> Is it possible in python:
>
> if ((x = a(b,c)) == 'TRUE'):
> print x
Nope. Assignment is not allowed in a conditional.
Cheers,
Daniel
> Thanks.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
--
https://m
On Thu, Dec 25, 2014 at 8:18 AM, JC wrote:
>
> Hello,
>
> Is it possible in python:
>
> if ((x = a(b,c)) == 'TRUE'):
> print x
No, assignments in Python are statements, not expressions.
--
https://mail.python.org/mailman/listinfo/python-list
Hi all,
I was using sl4a for quite some time on android and it basically
worked very well although some features are missing. It looks like
sl4a is dead, although I could be wrong. Does anyone knowledgeable
have any further info on the future of sl4a? For instance it doesn't
work with android 5 an
One line assignment is ok, but, seems like you can't perform actions.
#the following will work:
I = 1 if True else 2
#but the following will generate an error:
if I == 1: print("one")
And, not sure if/how to work around that second one myself.
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
One line assignment is ok, but, seems like you can't perform actions.
#the following will work:
I = 1 if True else 2
#but the following will generate an error:
if I == 1: print("one")
And, not sure if/how to work around that second one myself.
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
I don't get an error.
>>> I = 1 if True else 2
>>> if I == 1: print("one")
...
one
>>>
What error did you get?
Skip
--
https://mail.python.org/mailman/listinfo/python-list
On Thursday, December 25, 2014 10:16:54 AM UTC-6, Jacob Kruger wrote:
> One line assignment is ok, but, seems like you can't perform actions.
>
> #the following will work:
> I = 1 if True else 2
>
> #but the following will generate an error:
> if I == 1: print("one")
Only if "I" is undefined.
--
On Tue, 23 Dec 2014 20:28:30 -0500, Dave Tian wrote:
> Hi,
>
> There are 2 statements:
> A: a = ‘h’
> B: b = ‘hh’
>
> According to me understanding, A should be faster as characters would
> shortcut this 1-byte string ‘h’ without malloc; B should be slower than
> A as characters does not work fo
try kivy, instead of sl4a http://kivy.org/
I believe in the past year or two, the python foundation gave a grant to
kivy to add further functionality..
According to wikipedia http://en.wikipedia.org/wiki/Guido_van_Rossum Guido
works for dropbox.
Billy
On Thu, Dec 25, 2014 at 9:31 AM, Fetchinso
On Thursday, December 25, 2014 9:19:25 AM UTC-6, JC wrote:
> Hello,
>
> Is it possible in python:
>
> if ((x = a(b,c)) == 'TRUE'):
> print x
>
> Thanks.
Could you not simply rephrase:
result = foo()
if result == 'TRUE':
do_something()
Of course, another oddity is fact th
Actually more that in the interpreter, it's prompting me with ... as if I had
left out a closing ) or something, but, suppose it could work fine in an actual
imported bit of code?
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
"Roger Wilco wants to welcome you...to the space janitor's closet
> Actually more that in the interpreter, it's prompting me with ... as if I
had left out a closing ) or something, but, suppose it could work fine in
an actual imported bit of code?
That's how it's supposed to work. Given that Python block structure is
determined by indentation, you need some way
Ok, makes sense - just slipped same one line if: action bit of code inside a
function, and worked fine.
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
"Roger Wilco wants to welcome you...to the space janitor's closet..."
- Original Message -
From: Skip Montanaro
To: Jacob Kru
Ok, makes sense - just slipped same one line if: action bit of code inside a
function, and worked fine.
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
"Roger Wilco wants to welcome you...to the space janitor's closet..."
- Original Message -
From: Skip Montanaro
To: Jacob Kru
On 12/25/14, Billy Earney wrote:
> try kivy, instead of sl4a http://kivy.org/
>
> I believe in the past year or two, the python foundation gave a grant to
> kivy to add further functionality..
Thanks, I didn't know about kivy but it looks quite nice, will give it a try!
Hopefully it will be aroun
From: "joshuaemsteves"
There is a familiar chance Pdf to Doc wasn't going to take off as long as
don't be an idiot and use this pdf to docx converter. I expect this was a
bad hypothesis, but you really have to open your mind. While Pdf to Doc is
used in those situations, it was shown that Pdf t
On 24/12/2014 2:20 AM, Grant Edwards wrote:
And even _with_ all the technical jibber-jabber, none of it explained
or justified the whole "writing a virus to infect the brain through
the optic nerve" thing which might just have well been magick and
witches.
While I love SNOW CRASH, I do think it
On 24/12/2014 9:50 PM, alister wrote:
what feels like 3 or 4 chapters in & it is still trying to set the scene,
an exercise in stylish writing with very little content so far.
even early scifi written for magazines on a per word basis were not this
excessive (because if they were they would proba
On 26/12/2014 1:18 AM, JC wrote:
Is it possible in python:
if ((x = a(b,c)) == 'TRUE'):
print x
One approach is to use a function in the condition to do the assignment:
x = None
def assign_to_x(val):
global x
x = val
return val
def a(x, y):
I would like to parse the VIN, frame and engine numbers found on this page
(below). I don't really know any regex, I have looked a little at
pyparsing. I have some other similar numbers to. I am looking for
suggestions, which "tool" should I learn, how should I approach this.
http://www.britishspar
On Thu, Dec 25, 2014 at 4:02 PM, Vincent Davis wrote:
> I would like to parse the VIN, frame and engine numbers found on this page
> (below). I don't really know any regex, I have looked a little at pyparsing.
> I have some other similar numbers to. I am looking for suggestions, which
> "tool" sho
These are vintage motorcycles so the "VIN's" are not like modern VIN's
these are frame numbers and engine number.
I don't want to parse the page, I what a function that given a VIN (frame
or engine number) returns the year the bike was made.
Vincent Davis
720-301-3003
On Thu, Dec 25, 2014 at 5:5
On 2014-12-25 17:59, Vincent Davis wrote:
> These are vintage motorcycles so the "VIN's" are not like modern
> VIN's these are frame numbers and engine number.
> I don't want to parse the page, I what a function that given a VIN
> (frame or engine number) returns the year the bike was made.
While
Vincent Davis writes:
> I don't want to parse the page, I what a function that given a VIN
> (frame or engine number) returns the year the bike was made.
So the page has a collection of tables which the reader can use to
manually look up the VIN, or elements of the VIN, to determine the range
of
Tim and Ben,
Thanks for your input, I am working on it now and will come back when I
have questions.
Any comment on using pyparsing VS regex
Vincent Davis
720-301-3003
On Thu, Dec 25, 2014 at 7:18 PM, Ben Finney
wrote:
> Vincent Davis writes:
>
> > I don't want to parse the page, I what a func
On 2014-12-25 19:58, Vincent Davis wrote:
> Any comment on using pyparsing VS regex
If the VIN had any sort of regular grammar (especially if it involved
nesting) then pyparsing would have value.
I defaulted to regexp (1) because it's available out of the box, and
(2) while it might be overkill,
You're extracting structured data from an html file. You might want to look
at the lxml.etree module. (I think that's where ElementTree landed when it
was adopted into the stdlib).
Skip
--
https://mail.python.org/mailman/listinfo/python-list
JC wrote:
> Hello,
>
> Is it possible in python:
>
> if ((x = a(b,c)) == 'TRUE'):
> print x
Fortunately, no. Assignment as an expression is an anti-pattern and a bug
magnet.
The above is best written as:
if a(b,c) == 'TRUE':
print 'TRUE'
If you need the result of calling the a() fun
alex23 wrote:
> On 26/12/2014 1:18 AM, JC wrote:
>> Is it possible in python:
>>
>> if ((x = a(b,c)) == 'TRUE'):
>> print x
>
> One approach is to use a function in the condition to do the assignment:
Let me fix that for you:
/s/approach/bad idea/
All you have done is replace one anti-pattern
alex23 wrote:
> On 24/12/2014 2:20 AM, Grant Edwards wrote:
>> And even _with_ all the technical jibber-jabber, none of it explained
>> or justified the whole "writing a virus to infect the brain through
>> the optic nerve" thing which might just have well been magick and
>> witches.
>
> While I
On Wed, Dec 24, 2014 at 5:21 AM, Rustom Mody wrote:
> On Tuesday, December 23, 2014 6:30:30 PM UTC+5:30, shawool wrote:
>> Thank you for answering my query.
>>
>> Fonts and colors are reset to defaults now. Sorry for the inconvenience
>> caused.
>>
>> Regards,
>> Shawool
>
> Sorry for the peevish
Fetchinson . wrote:
> Guido is still working at google, right?
No. Google is still using Python for lots of things, but Guido is now
working for Dropbox.
https://www.python.org/~guido/
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano writes:
> However, be warned that there are two subtly different models for
> delegation. Here's the one that people seem to forget:
>
> http://code.activestate.com/recipes/519639-true-lieberman-style-delegation-in-python/
Very interesting!
The recipe at that URL works only on P
On 26/12/2014 1:37 PM, Steven D'Aprano wrote:
One approach is to use a function in the condition to do the assignment:
Let me fix that for you:
/s/approach/bad idea/
I never said it was a _good_ approach ;)
And you don't even save any lines! Instead of a one-liner, you have six
lines!
Wh
Vincent Davis writes:
> Any comment on using pyparsing VS regex
A full-blown parser (with ‘pyparsing’) is overkill for this.
Even regular expressions isn't needed.
The built-in text type (‘str’) in Python 3 should have everything you
need; you only need to match prefixes. No need in this task
37 matches
Mail list logo