Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
Fredrik Lundh wrote: > Talin wrote: > >> The original proposal was to make m[n] a synonym for m.group(n). >> "group()" is clearly map-like in its behavior. > > so have you checked what exception m.group(n) raises when you try to > access a group that doesn't exist ? The KeyError vs IndexError distinction is unreliable enough that I'll typically just catch LookupError if I don't know exactly what type I'm dealing with. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://www.boredomandlaziness.org ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
On 7 Dec 2006, at 21:47, Josiah Carlson wrote:
> Alastair Houghton <[EMAIL PROTECTED]> wrote:
>> On 7 Dec 2006, at 02:01, Josiah Carlson wrote:
>>> Alastair Houghton <[EMAIL PROTECTED]> wrote:
On 7 Dec 2006, at 01:01, Josiah Carlson wrote:
> If we don't want
> slicing, or if prodicing a slice would produce a semantically
> questionable state, then lets not do it.
...if you return match objects from slicing, you have problems
like m
[::-1].groups(). *I* don't know what that should return.
>>>
>>> I would argue that any 'step' != 1 has no semantically correct
>>> result
>>> for slicing on a match object, so we shouldn't support it.
>>
>> OK, but even then, if you're returning a match object, how about the
>> following:
>>
> m = re.match('(A)(B)(C)(D)(E)', 'ABCDE')
> print m[0]
>>ABCDE
> n = m[2:5]
> print list(n)
>>['B', 'C', 'D']
> print n[0]
>>B
> print n.group(0)
>>B
>>
>> The problem I have with it is that it's violating the invariant that
>> match objects should return the whole match in group(0).
>
> If we were going to go with slicing, then it would be fairly
> trivial to
> include the whole match range. Some portion of the underlying
> structure
> knows where the start of group 2 is, and knows where the end of
> group 5
> is, so we can slice or otherwise use that for subsequent sliced
> groups.
But then you're proposing that this thing (which looks like a tuple,
when you're indexing it) should slice in a funny way. i.e.
m = re.match('(A)(B)(C)(D)(E)', 'ABCDE')
print m[0]
ABCDE
print list(m)
['ABCDE', 'A', 'B', 'C', 'D', 'E']
n = m[2:5]
print list(n)
['BCD', 'B', 'C', 'D']
print len(n)
4
p = list(m)[2:5]
print p
['B', 'C', 'D']
print len(p)
Or are you saying that
m[2:5][0] != m[2:5].group(0)
but
m[0] == m.group(0)
??
Either way I think that's *really* counter-intuitive.
Honestly, I don't think that slicing should be supported if it's
going to have to result in match objects, because I can't see a way
to make them make sense.
I think that's Frederik's objection also, but unlike me he doesn't
feel that the slice operation should return something different (e.g.
a tuple).
Kind regards,
Alastair.
--
http://alastairs-place.net
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] MSI being downloaded 10x more than all other files?!
I looked through the python.org web stats (as I usually do when preparing for a keynote) and discovered that /ftp/python/2.5/python-2.5.msi is by far the top download -- 271,971 hits, more than 5x the next one, /ftp/python/2.5/Python-2.5.tgz (47,898 hits). Are these numbers real? (The byte counts suggest they are.) What could cause this dramatic popularity of Python on Windows? Does some vendor have an auto-install hook that installs Python whenever someone opens up their new computer? Or have we just hit the jackpot? -- --Guido van Rossum (home page: http://www.python.org/~guido/) ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] MSI being downloaded 10x more than all other files?!
Guido van Rossum wrote: > What could cause this dramatic popularity of Python on Windows? You should ask yourself: 1) Where else can people grab Python on Windows? 2) Where else can people grab Python for [every other operating system]? Most distros are kind enough to provide their own mirror, I would say that easily accounts for the discrepancy since I am not aware of any other place to grab a windows install. -- Scott Dial [EMAIL PROTECTED] [EMAIL PROTECTED] ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] MSI being downloaded 10x more than all other files?!
Guido van Rossum schrieb: > I looked through the python.org web stats (as I usually do when > preparing for a keynote) and discovered that > /ftp/python/2.5/python-2.5.msi is by far the top download -- 271,971 > hits, more than 5x the next one, /ftp/python/2.5/Python-2.5.tgz > (47,898 hits). Are these numbers real? (The byte counts suggest they > are.) You probably have to add the downloads for /ftp/python/2.5/Python-2.5.tar.bz2 (31,492 hits) to the last number. Also interesting are the hits for 64-bit windows Pythons: /ftp/python/2.5/python-2.5.amd64.msi (23192 hits) /ftp/python/2.5/python-2.5.ia64.msi (22523 hits) > What could cause this dramatic popularity of Python on Windows? Have the ratios changed against past figures (too lazy to look them up now)? > Does some vendor have an auto-install hook that installs Python > whenever someone opens up their new computer? Or have we just hit the > jackpot? > Thomas ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [Python-checkins] MSI being downloaded 10x more than all otherfiles?!
That was the month of October. If people believe these numbers are real, we're doing great!!! On 12/8/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > >I looked through the python.org web stats (as I usually do when > > preparing for a keynote) and discovered that > > /ftp/python/2.5/python-2.5.msi is by far the top download -- 271,971 > > hits, more than 5x the next one, /ftp/python/2.5/Python-2.5.tgz > > (47,898 hits). > > over what period ? > > fwiw, I've seen a 2.5x ratio for my stuff over the last year; I've always > assumed > that most people on other platforms are simply getting their stuff from the > vendor's > standard repository. > > > > > > ___ > Python-checkins mailing list > [EMAIL PROTECTED] > http://mail.python.org/mailman/listinfo/python-checkins > -- --Guido van Rossum (home page: http://www.python.org/~guido/) ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
Alastair Houghton <[EMAIL PROTECTED]> wrote: > On 7 Dec 2006, at 21:47, Josiah Carlson wrote: > > If we were going to go with slicing, then it would be fairly > > trivial to > > include the whole match range. Some portion of the underlying > > structure > > knows where the start of group 2 is, and knows where the end of > > group 5 > > is, so we can slice or otherwise use that for subsequent sliced > > groups. > > But then you're proposing that this thing (which looks like a tuple, > when you're indexing it) should slice in a funny way. i.e. Let me be clear: I'm not proposing anything. I have little to no interest in seeing slices available to match objects, and as said in a message 20 minutes prior to the message you are replying to, "Make the slice return a list, don't allow slicing, or make it a full on group variant. I don't really care at this point." My statement in the email you replied to above was to say that if we wanted it to return a group, then we could include subsequent .group(0) with the same semantics as the original match object. At this point it doesn't matter, Frederik will produce what he wants to produce, and I'm sure most of us will be happy with the outcome. Those that are unhappy will need to write their own patch or deal with being unhappy. - Josiah ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [NPERS] Re: a feature i'd like to see in python #2: indexing of match objects
On 8 Dec 2006, at 16:38, Josiah Carlson wrote: > My statement in the email you replied to above was to say that if we > wanted it to return a group, then we could include subsequent .group > (0) > with the same semantics as the original match object. And my reply was simply to point out that that's not workable. > At this point it doesn't matter, Frederik will produce what he > wants to > produce, and I'm sure most of us will be happy with the outcome. > Those > that are unhappy will need to write their own patch or deal with being > unhappy. I believe I've already conceded that twice. Kind regards, Alastair. -- http://alastairs-place.net ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] MSI being downloaded 10x more than all otherfiles?!
Guido van Rossum wrote: > That was the month of October. > > If people believe these numbers are real, we're doing great!!! 2.5 was of course released in september, so I assume that part of what you're seeing is simply tinkerers upgrading their existing installations. plotting weekly figures for 2.4 and 2.5 over the last few months might give you a better idea of what the "sustained" download rate is, these days. (but we're definitely doing great. let there be no doubt about that ;-) ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [Python-checkins] MSI being downloaded 10x more than all otherfiles?!
> On 12/8/06, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > fwiw, I've seen a 2.5x ratio for my stuff over the last year; I've always > > assumed > > that most people on other platforms are simply getting their stuff from the > > vendor's > > standard repository. I've noticed a similar thing, but I've also noticed that some distributions seem to like to offer old (sometimes by a year or more) packages that are known to not work with those platforms. - Josiah ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] MSI being downloaded 10x more than all other files?!
Scott Dial <[EMAIL PROTECTED]> writes: > You should ask yourself: > 1) Where else can people grab Python on Windows? > 2) Where else can people grab Python for [every other operating system]? > > Most distros are kind enough to provide their own mirror, I would say > that easily accounts for the discrepancy since I am not aware of any > other place to grab a windows install. I think that's right, Linux and BSD distros (and no doubt OS X) provide their own packaging of Python, while hackers sync with svn. But it's also fair to say that most users run Windows, and as Python goes mainstream, which seems to be the case lately, we should see an even greater proportion of Windows/everthing_else Python installations. -- KBK ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [Python-checkins] MSI being downloaded 10x more than all other files?!
Guido van Rossum schrieb: > I looked through the python.org web stats (as I usually do when > preparing for a keynote) and discovered that > /ftp/python/2.5/python-2.5.msi is by far the top download -- 271,971 > hits, more than 5x the next one, /ftp/python/2.5/Python-2.5.tgz > (47,898 hits). Are these numbers real? They should be. Thomas and I fixed the counting during the Google sprint. The log files are now processed once a day; before, they were rotated only once a week, and the web server stopped logging when the partition storing the log files were full (which frequently happened). So if you look at the statistics before August, you see that some days don't have any accesses counted - the stats can't be trusted in the period between the move away from creosote and the Google sprint. > (The byte counts suggest they > are.) What could cause this dramatic popularity of Python on Windows? > Does some vendor have an auto-install hook that installs Python > whenever someone opens up their new computer? Or have we just hit the > jackpot? I think this is Python's popularity. One factor is ready availability: "normal" users don't build Python from source. So Windows users download it from python.org, everybody else gets the binaries from the OS vendor. They come with the Linux distribution, they come with OS X, and they come with Solaris. Many of these people don't build Python themselves (and they can't, because they'll also have to rebuild mod_python, the Python subversion modules, etc). So the 50,000 source downloads are just from people who want to see the cutting egde, when their "regular" sources only provide 2.4 binaries (say). Also, Python 2.5 is relatively new. After some time, people will have local copies of the 2.5 MSI file, and don't redownload if they install on a new machine. Regards, Martin ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [Python-checkins] MSI being downloaded 10x more than all otherfiles?!
Terry Reedy schrieb: > How do the first two months downloads of 2.5.msi compare to 2.4.msi? It's actually publicly available: http://www.python.org/webstats/ Regards, Martin ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] MSI being downloaded 10x more than all other files?!
Thomas Heller schrieb: > Also interesting are the hits for 64-bit windows Pythons: > > /ftp/python/2.5/python-2.5.amd64.msi (23192 hits) > /ftp/python/2.5/python-2.5.ia64.msi (22523 hits) But maybe misleading, as well. People just don't understand Win64: the hardware guy told them they have "64-bits", and now download everything with "64" in its name - just to see the message that this file isn't for their operating system. > Have the ratios changed against past figures (too lazy to look them up now)? They did, but also because the statistics weren't updated correctly until recently. Regards, Martin ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] MSI being downloaded 10x more than all other files?!
Martin v. Löwis schrieb: >> Have the ratios changed against past figures (too lazy to look them up now)? > > They did, but also because the statistics weren't updated correctly > until recently. Qualifying a bit further: the last month that apparently had nearly correct statistics before September was February. We had these numbers for the MSI file: Jan: 2.4.2.msi 202046 Feb: 2.4.2.msi 209234 Sep: 2.4.3.msi 155689 2.5.msi 120817 Oct: 2.4.3.msi 36479 2.4.4.msi 38526 2.5.msi 271971 Nov: 2.4.4.msi 45696 2.5.msi 224247 Dec: 2.5.msi55521 (Dec 8, 6:36 CET) Regards, Martin ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [Python-checkins] MSI being downloaded 10x more than all other files?!
> I think this is Python's popularity. One factor is ready availability: > "normal" users don't build Python from source. So Windows users download > it from python.org, everybody else gets the binaries from the OS vendor. Another factor is that the ActiveState ActivePython distribution for Windows isn't available for 2.5 yet. Early adopters have even fewer places to go than normal. Mike ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] MSI being downloaded 10x more than all other files?!
Guido van Rossum wrote: > Or have we just hit the jackpot? Hi all, I've been lurking the list for a while (fun to know what you py-devs are up too!) but for this I have to speak up and give congratulations. You're all doing amazing work, and I think thats being reflected in these numbers. I know I recommend it to all of my friends, who are bogged down trying to learn Java or Perl, and they've all been amazed by how much of a joy it is to work in Python. So, if you have hit the jackpot, it's truly deserved. Congratulations again, and keep up the good work! -Jordan Greenberg ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] help for a noob - version for a sharp ARM
On Fri Dec 8 08:07:16 CET 2006, Josiah Carlson wrote: > a Fred wrote: > > > > I'm looking for advice on stripping down Python for an SBC to run Numpy > > and Scipy. I have the following notes on the system > > > > We have code that requires recent versions of Numpy and Scipy. > > The processor is a 32 bit Sharp ARM Sharp LH7A404 32 bit ARM922TDMI with > > 32MB of SDRAM. > > 512 MB flash disk - but 400 MB is reserved for data > > The OS is Linux > > only a tty interface is used. > > > > Does anyone have a feel as to whether Python for Arm is the correct > > starting point? > > Sounds like plenty of muscle to handle Python certain domain number > crunching problems. It appears that this ARM variant doesn't have a floating point coprocessor. http://www.sharpsma.com/Page.aspx/americas/en/part/LH7A404/ I hope we're dealing with those problem domains here. ;-) > > What modules can I safely add/strip out? > > Most every C module you don't need. You can also compile without > unicode. I believe you can more or less toss everything except for the > base python binary and the pythonxy.so (or pythonxy.dll) for your > platform, but I am most likely wrong. I found that Python tries to import various modules when it starts up, so you might want to be a bit conservative with the ones you discard. However, if the target platform doesn't have libraries that various extension modules require then there's clearly no point in deploying those extensions. There are lots of irrelevant modules (for your application, at least) in the standard library. Anything that's platform-specific can go, apart from any Linux-specific modules, obviously, and even those might be unnecessary. I'm not sure if it's possible to automatically strip out Tkinter (lib-tk) and IDLE (idlelib), but it's probably worth doing so in your case. I should return to my own experiments and do all that again in a systematic way, just to see what can be removed. > My (awful) suggestion: start with > a Python installation in some user path, like ~/python . Toss > everything and start adding things that it complains about until it > starts working again. Or there's that approach. A module dependency graph would be useful to have, or even just a list of modules that are required to get to the interactive prompt. It might also be worthwhile compiling all the pure Python modules to bytecode and discarding the sources, but only if the compiled code is smaller, of course. > > Will Python take more than 5-6 seconds to load? > > I have previously gotten dos versions of Python (I think 1.5 or 1.4) to > load on a 486 sx 33 with 8 megs of ram in a couple seconds. You > shouldn't have issues with startup on an ARM. Less than a second, I would imagine. Extension modules will also increase the loading time, especially if they need to be perform some tasks when they start. > > Will old Python releases, like 1.5.x, work with newer Numpy and Scipy? > > I don't know. But you should be able to remove unused portions of > Python for your platform. There are somewhat recent posts in this > mailing lists about embedded systems and Python. Others may be able to > help you more. It should be possible to compile a version of Python for the ARM922TDMI that uses Thumb instructions. These are 16 bit instructions that are expanded on the fly so that they can be processed by the CPU as normal 32 bit wide instructions. This doesn't mean that the resulting executable and libraries will be half the size that they would have been when compiled normally, but you may be able to save some storage space that way. I have no idea whether this trick will help you save RAM as well. David ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
