Steven D'Aprano writes:
> On Fri, 6 May 2016 04:27 am, Jussi Piitulainen wrote:
>
>> Random832's pattern is fine. You need to use re.fullmatch with it.
>
> py> re.fullmatch
> Traceback (most recent call last):
> File "", line 1, in
> AttributeError: 'module' object has no attribute 'fullmatch'
On Fri, May 6, 2016 at 1:07 PM, Dan Sommers wrote:
> On Fri, 06 May 2016 02:46:22 +, Dan Sommers wrote:
>
>> Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
>> [GCC 5.3.1 20160409] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> filter
On Fri, 06 May 2016 02:46:22 +, Dan Sommers wrote:
> Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
> [GCC 5.3.1 20160409] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> filter(lambda x:x+1, [1, 2, 3, 4])
> [1, 2, 3, 4]
>
> P
The best way to increase your motivation to learn Python is:
1. Select a non-trivial problem that you need to solve with programming.
2. Try to write the program you need in any other language (that you don't
already know well).
3. Write the program you need in Python.
4. Gaze in astonishment at
On Thu, May 5, 2016, at 07:46 PM, Dan Sommers wrote:
> On Thu, 05 May 2016 18:37:11 -0700, Stephen Hansen wrote:
>
> > ''.join(x for x in string if x.isupper())
>
> > The difference is, both filter and your list comprehension *build a
> > list* which is not needed, and wasteful. The above ski
On Fri, May 6, 2016 at 12:46 PM, Dan Sommers wrote:
> filter used to build a list, but now it doesn't (where "used to" means
> Python 2.7 and "now" means Python 3.5; I'm too lazy to track down the
> exact point(s) at which it changed):
>
> Python 2.7.11+ (default, Apr 17 2016, 14:00:29)
>
On Fri, May 6, 2016 at 12:49 PM, Michael Torrie wrote:
> On 05/04/2016 02:59 AM, Steven D'Aprano wrote:
>> A year ago, Gavin Vickery decided to move away from Python and give
>> Javascript with Node.js a try. Twelve months later, he has written about his
>> experiences:
>>
>>
>> http://geekforbrai
On Thu, 05 May 2016 18:37:11 -0700, Stephen Hansen wrote:
> ''.join(x for x in string if x.isupper())
> The difference is, both filter and your list comprehension *build a
> list* which is not needed, and wasteful. The above skips building a
> list, instead returning a generator ...
filter u
On 05/04/2016 02:59 AM, Steven D'Aprano wrote:
> A year ago, Gavin Vickery decided to move away from Python and give
> Javascript with Node.js a try. Twelve months later, he has written about his
> experiences:
>
>
> http://geekforbrains.com/post/after-a-year-of-nodejs-in-production
Very inter
On Thu, May 5, 2016, at 06:26 PM, Christopher Reimer wrote:
> Which is one is correct (Pythonic)? Or does it matter?
First, pylint is somewhat opinionated, and its default options shouldn't
be taken as gospel. There's no correct: filter is fine.
That said, the general consensus is, I believe, tha
On Fri, May 6, 2016 at 11:26 AM, Christopher Reimer
wrote:
> Below is the code that I mentioned in an earlier thread.
>
> string = "Whiskey Tango Foxtrot"
> ''.join(list(filter(str.isupper, string)))
>
> 'WTF'
>
> That works fine and dandy. Except Pylint doesn't like it. According to t
Greetings,
Below is the code that I mentioned in an earlier thread.
string = "Whiskey Tango Foxtrot"
''.join(list(filter(str.isupper, string)))
'WTF'
That works fine and dandy. Except Pylint doesn't like it. According to
this link, list comprehensions have replaced filters and the
On Fri, 6 May 2016 04:27 am, Jussi Piitulainen wrote:
> Random832's pattern is fine. You need to use re.fullmatch with it.
py> re.fullmatch
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'fullmatch'
--
Steven
--
https://mail.python
On Thu, May 5, 2016 at 3:47 PM, wrote:
>
> I try to make the GetIconInfo function work, but I can't figure out
> what I'm doing wrong.
>
> From the MSDN documentation the function is
>
> https://msdn.microsoft.com/en-us/library/windows/desktop/ms648070%28v=vs.85%29.aspx
>
> # BOOL WINAPI GetI
On 5/5/2016 1:39 AM, Stephen Hansen wrote:
Given:
input = [u'Espa\xf1ol', 'Health & Fitness Clubs (36)', 'Health Clubs & Gymnasiums (42)', 'Health Fitness Clubs',
'Name', 'Atlanta city guide', 'edit address', 'Tweet', 'PHYSICAL FITNESS CONSULTANTS & TRAINERS', 'HEALTH CLUBS &
GYMNASIUMS', 'H
On 5/5/2016 2:56 PM, Stephen Hansen wrote:
On Thu, May 5, 2016, at 05:31 AM, DFS wrote:
You are out of your mind.
Whoa, now. I might disagree with Steven D'Aprano about how to approach
this problem, but there's no need to be rude.
Seriously not trying to be rude - more smart-alecky than anyt
On 5/5/2016 1:54 PM, Steven D'Aprano wrote:
On Thu, 5 May 2016 10:31 pm, DFS wrote:
You are out of your mind.
That's twice you've tried to put me down, first by dismissing my comments
about text processing with "Linguist much", and now an outright insult. The
first time I laughed it off and m
> I generally avoid c_void_p because its lenient from_param method
> (called to convert arguments) doesn't provide much type safety. If a
> bug causes an incorrect argument to be passed, I prefer getting an
> immediate ctypes.ArgumentError rather than a segfault or data
> corruption. For example, w
Hello,
I try to make the GetIconInfo function work, but I can't figure out
what I'm doing wrong.
>From the MSDN documentation the function is
https://msdn.microsoft.com/en-us/library/windows/desktop/ms648070%28v=vs.85%29.aspx
# BOOL WINAPI GetIconInfo(
# _In_ HICON hIcon,
# _Ou
On Thu, May 5, 2016 at 10:42 AM, Joseph L. Casale
wrote:
> I have CDLL function I use to get a pointer, several other functions happily
> accept this
> pointer which is really a long when passed to ctypes.c_void_p. However, only
> one with
> same type def in the prototype overflows. Docs suggest
On 04/24/2016 08:20 AM, Ian Kelly wrote:
On Sun, Apr 24, 2016 at 1:20 AM, Ethan Furman wrote:
What fun things can Java enums do?
Everything that Python enums can do, plus:
>
--> Planet.EARTH.value
(5.976e+24, 6378140.0)
--> Planet.EARTH.surface_gravity
9.802652743337129
This is incredibly
On Thu, May 5, 2016, at 11:03 AM, Steven D'Aprano wrote:
> - Nobody could possibly want to support non-ASCII text. (Apart from the
> approximately 6.5 billion people in the world that don't speak English of
> course, an utterly insignificant majority.)
Oh, I'd absolutely want to support non-ASCII
https://motherboard.vice.com/blog/python-is-an-equal-opportunity-programming-language
from an 'Intel® Software Evangelist'
--
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, May 5, 2016, at 05:31 AM, DFS wrote:
> You are out of your mind.
Whoa, now. I might disagree with Steven D'Aprano about how to approach
this problem, but there's no need to be rude. Everyone's trying to help
you, after all.
--
Stephen Hansen
m e @ i x o k a i . i o
--
https://mail.pyt
On Thu, May 5, 2016, at 10:43 AM, Steven D'Aprano wrote:
> On Thu, 5 May 2016 11:32 pm, Stephen Hansen wrote:
>
> > On Thu, May 5, 2016, at 12:36 AM, Steven D'Aprano wrote:
> >> Oh, a further thought...
> >>
> >> On Thursday 05 May 2016 16:46, Stephen Hansen wrote:
> >> > I don't even care about
On Thu, May 5, 2016, at 14:27, Jussi Piitulainen wrote:
> Random832's pattern is fine. You need to use re.fullmatch with it.
Heh, in my previous post I said "and one could easily imagine an API
that implicitly anchors at the end". So easy to imagine it turns out
that someone already did, as it tur
On Thu, May 5, 2016, at 14:03, Steven D'Aprano wrote:
> You failed to anchor the string at the beginning and end of the string,
> an easy mistake to make, but that's the point.
I don't think anchoring is properly a concern of the regex itself -
.match is anchored implicitly at the beginning, and o
PyDev 5.0.0 Released
Release Highlights:
---
* **Important** PyDev now requires Java 8.
* PyDev 4.5.5 is the last release supporting Java 7.
* See: http://www.pydev.org/update_sites/index.html for the update site of
older versions of PyDev.
* See: the **PyDev does not
Steven D'Aprano writes:
> On Fri, 6 May 2016 03:49 am, Jussi Piitulainen wrote:
>
>> Steven D'Aprano writes:
>>
>>> I get something like this:
>>>
>>> r"(^[A-Z]+$)|(^([A-Z]+[ ]*\&[ ]*[A-Z]+)+$)"
>>>
>>>
>>> but it fails on strings like "AA & A & A". What am I doing wrong?
>>
>> It cannot spl
On Fri, 6 May 2016 03:49 am, Jussi Piitulainen wrote:
> Steven D'Aprano writes:
>
>> I get something like this:
>>
>> r"(^[A-Z]+$)|(^([A-Z]+[ ]*\&[ ]*[A-Z]+)+$)"
>>
>>
>> but it fails on strings like "AA & A & A". What am I doing wrong?
>
> It cannot split the string as (LETTERS & LETTERS)(L
On Thu, 5 May 2016 11:21 pm, Random832 wrote:
> On Thu, May 5, 2016, at 03:36, Steven D'Aprano wrote:
>> Putting non-ASCII letters aside for the moment, how would you match these
>> specs as a regular expression?
>
> Well, obviously *your* language (not the OP's), given the cases you
> reject, is
Steven D'Aprano writes:
> I get something like this:
>
> r"(^[A-Z]+$)|(^([A-Z]+[ ]*\&[ ]*[A-Z]+)+$)"
>
>
> but it fails on strings like "AA & A & A". What am I doing wrong?
It cannot split the string as (LETTERS & LETTERS)(LETTERS & LETTERS)
when the middle part is just one LETTER. That's som
On Thu, 5 May 2016 10:31 pm, DFS wrote:
> You are out of your mind.
That's twice you've tried to put me down, first by dismissing my comments
about text processing with "Linguist much", and now an outright insult. The
first time I laughed it off and made a joke about it. I won't do that
again.
Y
On Thu, 5 May 2016 11:32 pm, Stephen Hansen wrote:
> On Thu, May 5, 2016, at 12:36 AM, Steven D'Aprano wrote:
>> Oh, a further thought...
>>
>> On Thursday 05 May 2016 16:46, Stephen Hansen wrote:
>> > I don't even care about faster: Its overly complicated. Sometimes a
>> > regular expression rea
On Fri, 6 May 2016 01:42 am, Joseph L. Casale wrote:
> I have CDLL function I use to get a pointer, several other functions
> happily accept this pointer which is really a long when passed to
> ctypes.c_void_p. However, only one with same type def in the prototype
> overflows. Docs suggest c_void_
On Thu, 5 May 2016 11:13 pm, Random832 wrote:
> On Thu, May 5, 2016, at 04:41, Steven D'Aprano wrote:
>> > There's no situation where "&" and " " will exist in the given
>> > dataset, and recognizing that is important. You don't have to account
>> > for every bit of nonsense.
>>
>> Whenev
I have CDLL function I use to get a pointer, several other functions happily
accept this
pointer which is really a long when passed to ctypes.c_void_p. However, only
one with
same type def in the prototype overflows. Docs suggest c_void_p takes an int
but that
is not what the first call returns,
On Thu, 5 May 2016 06:17 pm, Peter Otten wrote:
>> I get something like this:
>>
>> r"(^[A-Z]+$)|(^([A-Z]+[ ]*\&[ ]*[A-Z]+)+$)"
>>
>>
>> but it fails on strings like "AA & A & A". What am I doing wrong?
> test("^A+( *& *A+)*$")
Thanks Peter, that's nice!
--
Steven
--
https://mail.pyt
On 5/5/2016 9:32 AM, Stephen Hansen wrote:
On Thu, May 5, 2016, at 12:36 AM, Steven D'Aprano wrote:
Oh, a further thought...
On Thursday 05 May 2016 16:46, Stephen Hansen wrote:
I don't even care about faster: Its overly complicated. Sometimes a
regular expression really is the clearest way to
On Thu, May 5, 2016, at 12:36 AM, Steven D'Aprano wrote:
> Oh, a further thought...
>
> On Thursday 05 May 2016 16:46, Stephen Hansen wrote:
> > I don't even care about faster: Its overly complicated. Sometimes a
> > regular expression really is the clearest way to solve a problem.
>
> Putting no
On Thu, May 5, 2016, at 03:36, Steven D'Aprano wrote:
> Putting non-ASCII letters aside for the moment, how would you match these
> specs as a regular expression?
Well, obviously *your* language (not the OP's), given the cases you
reject, is "one or more sequences of letters separated by
space*-a
On Thu, May 5, 2016, at 04:41, Steven D'Aprano wrote:
> > There's no situation where "&" and " " will exist in the given
> > dataset, and recognizing that is important. You don't have to account
> > for every bit of nonsense.
>
> Whenever a programmer says "This case will never happen",
On 5/5/2016 1:53 AM, Jussi Piitulainen wrote:
Either way is easy to approximate with a regex:
import re
upper = re.compile(r'[A-Z &]+')
lower = re.compile(r'[^A-Z &]')
print([datum for datum in data if upper.fullmatch(datum)])
print([datum for datum in data if not lower.search(datum)])
This
On 5/5/2016 1:39 AM, Stephen Hansen wrote:
pattern = re.compile(r"^[A-Z\s&]+$")
output = [x for x in list if pattern.match(x)]
Holy Shr"^[A-Z\s&]+$" One line of parsing!
I was figuring a few list comprehensions would do it - this is better.
(note: the reason I specified 'spaces aroun
On 5/5/2016 2:04 AM, Steven D'Aprano wrote:
On Thursday 05 May 2016 14:58, DFS wrote:
Want to whittle a list like this:
[...]
Want to keep all elements containing only upper case letters or upper
case letters and ampersand (where ampersand is surrounded by spaces)
Start by writing a functi
On Wed, May 4, 2016 at 4:04 PM, Akira Li <4kir4...@gmail.com> wrote:
>
> Pass stdin=PIPE, stdout=PIPE and use p.stdin, p.stdout file objects to
> write input, read output from the child process.
>
> Beware, there could be buffering issues or the child process may change
> its behavior some other wa
I have a python 2.7.10 script which is being run under a windows service on
windows 2012 server .
The python script uses smtplib to send an email.
It works fine when the windows service is run as a local user, but not when the
windows service is configured to run as Local System account. I get n
There's a gmane 'newsgroup from a mailing list' for sqlite:-
gmane.comp.db.sqlite.general
It's quite active and helpful too. (Also 'announce' and others)
--
Chris Green
·
--
https://mail.python.org/mailman/listinfo/python-list
On Thursday 05 May 2016 17:34, Stephen Hansen wrote:
> Meh. You have a pedantic definition of wrong. Given the inputs, it
> produced right output. Very often that's enough. Perfect is the enemy of
> good, it's said.
And this is a *perfect* example of why we have things like this:
http://www.bbc
Steven D'Aprano wrote:
> Oh, a further thought...
>
>
> On Thursday 05 May 2016 16:46, Stephen Hansen wrote:
>
>> On Wed, May 4, 2016, at 11:04 PM, Steven D'Aprano wrote:
>>> Start by writing a function or a regex that will distinguish strings
>>> that match your conditions from those that don'
Oh, a further thought...
On Thursday 05 May 2016 16:46, Stephen Hansen wrote:
> On Wed, May 4, 2016, at 11:04 PM, Steven D'Aprano wrote:
>> Start by writing a function or a regex that will distinguish strings that
>> match your conditions from those that don't. A regex might be faster, but
>> he
On Thu, May 5, 2016, at 12:04 AM, Steven D'Aprano wrote:
> On Thursday 05 May 2016 16:46, Stephen Hansen wrote:
> > > On Wed, May 4, 2016, at 11:04 PM, Steven D'Aprano wrote:
> >> Start by writing a function or a regex that will distinguish strings that
> >> match your conditions from those that do
On Thursday 05 May 2016 16:46, Stephen Hansen wrote:
> On Wed, May 4, 2016, at 11:04 PM, Steven D'Aprano wrote:
>> Start by writing a function or a regex that will distinguish strings that
>> match your conditions from those that don't. A regex might be faster, but
>> here's a function version.
>>
53 matches
Mail list logo