Thursday, December 17, 2009

comp.lang.python - 25 new messages in 16 topics - digest

comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en

comp.lang.python@googlegroups.com

Today's topics:

* Which version of MSVC?90.DLL's to distribute with Python 2.6 based Py2exe
executables? - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/54e419bf4cf17375?hl=en
* Where is PyMethod_GET_CLASS in Python 3? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/394f003fb7f7ee1e?hl=en
* More stuff added to ch 2 of my programming intro - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/12728334858e25c3?hl=en
* Raw string substitution problem - 5 messages, 4 authors
http://groups.google.com/group/comp.lang.python/t/61fdda4299b6a7b4?hl=en
* frames in toplevel Tkinter - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/06dc54f7ba4fa0b8?hl=en
* Using Python to Execute a C or FORTRAN Program (Windows) - 1 messages, 1
author
http://groups.google.com/group/comp.lang.python/t/7e2ebd426a66a7bd?hl=en
* Either IDLE Can't Start a subprocess or a firewall software firewall is
blocking the connection (Win)--Battlin McAfee - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/18961392334d1976?hl=en
* PIL: problem to convert an image array to PIL format - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/68ff1469965e5846?hl=en
* UGG、Nike dunk high shoes wholesale\retail - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/a3db54f2597fce62?hl=en
* iterators and views of lists - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/22d674ee0510cd97?hl=en
* Help with parsing a list - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/70c8433a77f5db6e?hl=en
* shouldn't list comprehension be faster than for loops? - 4 messages, 3
authors
http://groups.google.com/group/comp.lang.python/t/791b2a041acedbc0?hl=en
* pyZui - anyone know about this? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/0c158e4ab710de96?hl=en
* Samsung-B7320-Omnia-PRO - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/8f5f1a8ba7581ffc?hl=en
* Nokia-N97-Mini - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/67ff6981d3a00653?hl=en
* Nokia-E72 - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/bd7fa48dd174d6a6?hl=en

==============================================================================
TOPIC: Which version of MSVC?90.DLL's to distribute with Python 2.6 based Py2
exe executables?
http://groups.google.com/group/comp.lang.python/t/54e419bf4cf17375?hl=en
==============================================================================

== 1 of 2 ==
Date: Thurs, Dec 17 2009 8:08 am
From: python@bdurham.com


Does anyone have any recommendations on which version of the
MSVC?90.DLL's need to be distributed with a Python 2.6.4 PY2EXE (0.6.9)
based executable? (I assume I need just a matching pair of MSVCR90.DLL
and MSVCP90.DLL?)

My understanding is that I need to match the version of the DLL's that
my version of Python 2.6.4 was compiled against?

On my Windows 7 Professional (64-bit) workstation, I have the following
sets of MSVC?9.DLL files to choose from.

Directory of C:\Program Files\Sony\VAIO Care
07/14/2009 01:18 PM 245,248 msvcm90.dll
07/14/2009 01:18 PM 851,456 msvcp90.dll
07/14/2009 01:18 PM 627,200 msvcr90.dll
3 File(s) 1,723,904 bytes

Directory of C:\Program Files\Sony\VAIO
Care\plugins\Microsoft.VC90.CRT
07/14/2009 01:18 PM 245,248 msvcm90.dll
07/14/2009 01:18 PM 851,456 msvcp90.dll
07/14/2009 01:18 PM 627,200 msvcr90.dll
3 File(s) 1,723,904 bytes

Directory of C:\Program Files (x86)\Sony\VAIOData Restore Tool
11/26/2008 10:26 AM 568,832 msvcp90.dll
11/26/2008 08:57 AM 655,872 msvcr90.dll
2 File(s) 1,224,704 bytes

Directory of C:\Program Files (x86)\Sony\VAIO Recovery\plugins
07/15/2009 05:21 PM 224,768 msvcm90.dll
07/15/2009 05:21 PM 568,832 msvcp90.dll
07/15/2009 05:21 PM 655,872 msvcr90.dll
3 File(s) 1,449,472 bytes

Directory of C:\Program Files (x86)\Sony\VAIO
Recovery\plugins\x64
07/15/2009 05:21 PM 627,200 msvcr90.dll
1 File(s) 627,200 bytes
Directory of C:\Program Files (x86)\Sony\VAIO VP Utilities
04/02/2009 07:12 PM 568,832 msvcp90.dll
04/02/2009 07:12 PM 655,872 msvcr90.dll
2 File(s) 1,224,704 bytes

Directory of
C:\Windows\winsxs\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.2
1022.8_none_750b37ff97f4f68b
09/04/2009 04:35 AM 245,248 msvcm90.dll
09/04/2009 04:35 AM 851,456 msvcp90.dll
09/04/2009 04:35 AM 627,200 msvcr90.dll
3 File(s) 1,723,904 bytes

Directory of
C:\Windows\winsxs\amd64_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.3
0729.4926_none_08e1a05ba83fe554
06/10/2009 03:31 PM 245,760 msvcm90.dll
06/10/2009 03:31 PM 853,328 msvcp90.dll
06/10/2009 03:31 PM 623,440 msvcr90.dll
3 File(s) 1,722,528 bytes

Directory of
C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.210
22.8_none_bcb86ed6ac711f91
09/04/2009 04:35 AM 224,768 msvcm90.dll
09/04/2009 04:35 AM 568,832 msvcp90.dll
09/04/2009 04:35 AM 655,872 msvcr90.dll
3 File(s) 1,449,472 bytes

Directory of
C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.307
29.1_none_e163563597edeada
09/04/2009 04:19 AM 225,280 msvcm90.dll
09/04/2009 04:19 AM 572,928 msvcp90.dll
09/04/2009 04:19 AM 655,872 msvcr90.dll
3 File(s) 1,454,080 bytes

Directory of
C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.307
29.4926_none_508ed732bcbc0e5a
06/10/2009 04:14 PM 225,280 msvcm90.dll
06/10/2009 04:14 PM 569,664 msvcp90.dll
06/10/2009 04:14 PM 652,608 msvcr90.dll
3 File(s) 1,447,552 bytes

Thank you,
Malcolm


== 2 of 2 ==
Date: Thurs, Dec 17 2009 9:36 am
From: Ross Ridge


<python@bdurham.com> wrote:
>Does anyone have any recommendations on which version of the
>MSVC?90.DLL's need to be distributed with a Python 2.6.4 PY2EXE (0.6.9)
>based executable? (I assume I need just a matching pair of MSVCR90.DLL
>and MSVCP90.DLL?)

Either the one the came with your copy Microsoft Visual C++ or Python
2.6.4. Otherwise, you don't have the legal right to redistribute
Microsoft's code.

Ross Ridge

--
l/ // Ross Ridge -- The Great HTMU
[oo][oo] rridge@csclub.uwaterloo.ca
-()-/()/ http://www.csclub.uwaterloo.ca/~rridge/
db //

==============================================================================
TOPIC: Where is PyMethod_GET_CLASS in Python 3?
http://groups.google.com/group/comp.lang.python/t/394f003fb7f7ee1e?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 17 2009 8:11 am
From: Antoine Pitrou


Le Tue, 15 Dec 2009 08:08:01 -0800, Infinity77 a écrit :
>
> When building C extensions In Python 2.X, there was a magical
> PyMethod_GET_CLASS implemented like this:
>
> #define PyMethod_GET_CLASS(meth) \
> (((PyMethodObject *)meth) -> im_class)
>
> It looks like Python 3 has wiped out the "im_class" attribute. Which is
> the alternative was to handle this case in Python 3?

First, is it a bound method? Unbound methods are just function objects in
py3k. Check that PyMethod_Check() returns true.
Second, have you tried Py_TYPE(PyMethod_GET_SELF(meth))?

> BTW, it's very, very,
> *very* hard to find any possible reference to help migrating existing C
> extensions from Python 2.X to Python 3.

There's http://docs.python.org/3.1/howto/cporting.html
You are encouraged to post any suggestions or corrections on the bug
tracker: http://bugs.python.org

Finally, there's also a dedicated mailing-list for porting to py3k:
http://mail.python.org/mailman/listinfo/python-porting
While it hasn't seen a lot of activity lately, I'm sure there are people
there willing to answer any questions you have!

Regards

Antoine.

==============================================================================
TOPIC: More stuff added to ch 2 of my programming intro
http://groups.google.com/group/comp.lang.python/t/12728334858e25c3?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 17 2009 8:12 am
From: Benjamin Kaplan


On Thu, Dec 17, 2009 at 5:33 AM, Ned Deily <nad@acm.org> wrote:
>
>> > or (for MacPorts fans):
>> >
>> > $ sudo port install python31
>>
>>
>> And since I haven't got one, this also tells me nothing.
>
> http://www.macports.org/
>
> "The MacPorts Project is an open-source community initiative to design
> an easy-to-use system for compiling, installing, and upgrading either
> command-line, X11 or Aqua based open-source software on the Mac OS X
> operating system."

Description sans marketing fluff: It's a Mac package manager. It's
basically the same as Gentoo's portage if you've ever used that. It
downloads source tarballs and patches and then compiles them locally.
There are built-in lists of "variants", basically sets of configure
args, to compile each package.

==============================================================================
TOPIC: Raw string substitution problem
http://groups.google.com/group/comp.lang.python/t/61fdda4299b6a7b4?hl=en
==============================================================================

== 1 of 5 ==
Date: Thurs, Dec 17 2009 8:24 am
From: "Richard Brodie"

"Alan G Isaac" <alan.isaac@gmail.com> wrote in message
news:qemdnRUT0JvJ1LfWnZ2dnUVZ_vqdnZ2d@rcn.net...

> Naturally enough. So I think the right answer is:
>
> 1. this is a documentation bug (i.e., the documentation
> fails to specify unexpected behavior for raw strings), or
> 2. this is a bug (i.e., raw strings are not handled correctly
> when used as replacements)

<neo> There is no raw string. </neo>

A raw string is not a distinct type from an ordinary string
in the same way byte strings and Unicode strings are. It
is a merely a notation for constants, like writing integers
in hexadecimal.

>>> (r'\n', u'a', 0x16)
('\\n', u'a', 22)

== 2 of 5 ==
Date: Thurs, Dec 17 2009 8:51 am
From: Alan G Isaac


On 12/17/2009 11:24 AM, Richard Brodie wrote:
> A raw string is not a distinct type from an ordinary string
> in the same way byte strings and Unicode strings are. It
> is a merely a notation for constants, like writing integers
> in hexadecimal.
>
>>>> (r'\n', u'a', 0x16)
> ('\\n', u'a', 22)

Yes, that was a mistake. But the problem remains::

>>> re.sub('abc', r'a\nb\n.c\a','123abcdefg') == re.sub('abc', 'a\\nb\\n.c\\a',' 123abcdefg') == re.sub('abc', 'a\nb\n.c\a','123abcdefg')
True
>>> r'a\nb\n.c\a' == 'a\\nb\\n.c\\a' == 'a\nb\n.c\a'
False

Why are the first two strings being treated as if they are the last one?
That is, why isn't '\\' being processed in the obvious way?
This still seems wrong. Why isn't it?

More simply, consider::

>>> re.sub('abc', '\\', '123abcdefg')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\re.py", line 151, in sub
return _compile(pattern, 0).sub(repl, string, count)
File "C:\Python26\lib\re.py", line 273, in _subx
template = _compile_repl(template, pattern)
File "C:\Python26\lib\re.py", line 260, in _compile_repl
raise error, v # invalid expression
sre_constants.error: bogus escape (end of line)

Why is this the proper handling of what one might think would be an
obvious substitution?

Thanks,
Alan Isaac


== 3 of 5 ==
Date: Thurs, Dec 17 2009 9:19 am
From: "D'Arcy J.M. Cain"


On Thu, 17 Dec 2009 11:51:26 -0500
Alan G Isaac <alan.isaac@gmail.com> wrote:
> >>> re.sub('abc', r'a\nb\n.c\a','123abcdefg') == re.sub('abc', 'a\\nb\\n.c\\a',' 123abcdefg') == re.sub('abc', 'a\nb\n.c\a','123abcdefg')
> True

Was this a straight cut and paste or did you make a manual change? Is
that leading space in the middle one a copying error? I get False for
what you actually have there for obvious reasons.

> >>> r'a\nb\n.c\a' == 'a\\nb\\n.c\\a' == 'a\nb\n.c\a'
> False
>
> Why are the first two strings being treated as if they are the last one?

They aren't. The last string is different.

>>> for x in (r'a\nb\n.c\a', 'a\\nb\\n.c\\a', 'a\nb\n.c\a'): print repr(x)
...
'a\\nb\\n.c\\a'
'a\\nb\\n.c\\a'
'a\nb\n.c\x07'

> That is, why isn't '\\' being processed in the obvious way?
> This still seems wrong. Why isn't it?

What do you think is wrong? What would the "obvious" way of handling
'//' be?
>
> More simply, consider::
>
> >>> re.sub('abc', '\\', '123abcdefg')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "C:\Python26\lib\re.py", line 151, in sub
> return _compile(pattern, 0).sub(repl, string, count)
> File "C:\Python26\lib\re.py", line 273, in _subx
> template = _compile_repl(template, pattern)
> File "C:\Python26\lib\re.py", line 260, in _compile_repl
> raise error, v # invalid expression
> sre_constants.error: bogus escape (end of line)
>
> Why is this the proper handling of what one might think would be an
> obvious substitution?

Is this what you want? What you have is a re expression consisting of
a single backslash that doesn't escape anything (EOL) so it barfs.

>>> re.sub('abc', r'\\', '123abcdefg')
'123\\defg'

--
D'Arcy J.M. Cain <darcy@druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.


== 4 of 5 ==
Date: Thurs, Dec 17 2009 9:38 am
From: MRAB


Alan G Isaac wrote:
> On 12/17/2009 11:24 AM, Richard Brodie wrote:
>> A raw string is not a distinct type from an ordinary string
>> in the same way byte strings and Unicode strings are. It
>> is a merely a notation for constants, like writing integers
>> in hexadecimal.
>>
>>>>> (r'\n', u'a', 0x16)
>> ('\\n', u'a', 22)
>
>
>
> Yes, that was a mistake. But the problem remains::
>
> >>> re.sub('abc', r'a\nb\n.c\a','123abcdefg') == re.sub('abc',
> 'a\\nb\\n.c\\a',' 123abcdefg') == re.sub('abc', 'a\nb\n.c\a','123abcdefg')
> True
> >>> r'a\nb\n.c\a' == 'a\\nb\\n.c\\a' == 'a\nb\n.c\a'
> False
>
> Why are the first two strings being treated as if they are the last one?
> That is, why isn't '\\' being processed in the obvious way?
> This still seems wrong. Why isn't it?
>
> More simply, consider::
>
> >>> re.sub('abc', '\\', '123abcdefg')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "C:\Python26\lib\re.py", line 151, in sub
> return _compile(pattern, 0).sub(repl, string, count)
> File "C:\Python26\lib\re.py", line 273, in _subx
> template = _compile_repl(template, pattern)
> File "C:\Python26\lib\re.py", line 260, in _compile_repl
> raise error, v # invalid expression
> sre_constants.error: bogus escape (end of line)
>
> Why is this the proper handling of what one might think would be an
> obvious substitution?
>
Regular expressions and replacement strings have their own escaping
mechanism, which also uses backslashes.

Some of these regex escape sequences are the same as those of string
literals, eg \n represents a newline; others are different, eg \b in a
regex represents a word boundary and not a backspace as in a string
literal.

You can match a newline in a regex by either using an actual newline
character ('\n' in a string literal) or an escape sequence ('\\n' or
r'\n' in a string literal). If you want a regex to match an actual
backslash followed by a letter 'n' then you need to escape the backslash
in the regex and then either use a raw string literal or escape it again
in a non-raw string literal.

Match characters: <newline>
Regex: \n
Raw string literal: r'\n'
Non-raw string literal: '\\n'

Match characters: \n
Regex: \\n
Raw string literal: r'\\n'
Non-raw string literal: '\\\\n'

Replace with characters: <newline>
Replacement: \n
Raw string literal: r'\n'
Non-raw string literal: '\\n'

Replace with characters: \n
Replacement: \\n
Raw string literal: r'\\n'
Non-raw string literal: '\\\\n'


== 5 of 5 ==
Date: Thurs, Dec 17 2009 9:54 am
From: Alan G Isaac


> Alan G Isaac<alan.isaac@gmail.com> wrote:
>> >>> re.sub('abc', r'a\nb\n.c\a','123abcdefg') == re.sub('abc', 'a\\nb\\n.c\\a','123abcdefg') == re.sub('abc', 'a\nb\n.c\a','123abcdefg')
>> True
>> Why are the first two strings being treated as if they are the last one?

On 12/17/2009 12:19 PM, D'Arcy J.M. Cain wrote:
> They aren't. The last string is different.

Of course it is different.
That is the basis of my question.
Why is it being treated as if it is the same?
(See the end of this post.)


> Alan G Isaac<alan.isaac@gmail.com> wrote:
>> More simply, consider::
>>
>> >>> re.sub('abc', '\\', '123abcdefg')
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in<module>
>> File "C:\Python26\lib\re.py", line 151, in sub
>> return _compile(pattern, 0).sub(repl, string, count)
>> File "C:\Python26\lib\re.py", line 273, in _subx
>> template = _compile_repl(template, pattern)
>> File "C:\Python26\lib\re.py", line 260, in _compile_repl
>> raise error, v # invalid expression
>> sre_constants.error: bogus escape (end of line)
>>
>> Why is this the proper handling of what one might think would be an
>> obvious substitution?


On 12/17/2009 12:19 PM, D'Arcy J.M. Cain wrote:
> Is this what you want? What you have is a re expression consisting of
> a single backslash that doesn't escape anything (EOL) so it barfs.
>>>> re.sub('abc', r'\\', '123abcdefg')
> '123\\defg'


Turning again to the documentation:
"if it is a string, any backslash escapes in it are processed.
That is, \n is converted to a single newline character, \r is
converted to a linefeed, and so forth."
So why is '\n' converted to a newline but '\\' does not become a literal
backslash? OK, I don't do much string processing, so perhaps this is where
I am missing the point: how is the replacement being "converted"?
(As Peter's example shows, if you supply the replacement via
a function, this does not happen.) You suggest it is just a matter of
it being an re, but::

>>> re.sub('abc', 'a\\nc','1abcd') == re.sub('abc', 'a\nc','1abcd')
True
>>> re.compile('a\\nc') == re.compile('a\nc')
False

So I have two string that are not the same, nor do they compile
equivalently, yet apparently they are "converted" to something
equivalent for the substitution. Why? Is my question clearer?

If the answer looks too obvious to state, assume I'm missing it anyway
and please state it. As I said, I seldom use the re module.

Alan Isaac

==============================================================================
TOPIC: frames in toplevel Tkinter
http://groups.google.com/group/comp.lang.python/t/06dc54f7ba4fa0b8?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 17 2009 8:26 am
From: J Wolfe


On Dec 16, 11:09 pm, J Wolfe <vorticitywo...@gmail.com> wrote:
> Probably a stupid question, but can you have a frames in a toplevel
> widget? Anything I try to put in a frame goes back to the main or root
> widget and not the toplevel or pop-up widget.
>
> Thanks for the help!
> Jonathan

Thank you John,

from Tkinter import *
root = Tk()
Label(root, text='This is the root window').pack()
top = Toplevel(root)
fr = Frame(top) # frame child of Toplevel called top
fr.pack()
Label(fr, text='This is in a frame in the Toplevel window').pack()
root.mainloop()

I swear I tried that about 20 times yesterday...and it kept putting it
in my main window. Perhaps I had a naming issue.

Thanks!
Jonathan

==============================================================================
TOPIC: Using Python to Execute a C or FORTRAN Program (Windows)
http://groups.google.com/group/comp.lang.python/t/7e2ebd426a66a7bd?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 17 2009 8:29 am
From: "W. eWatson"


sturlamolden wrote:
> On 17 Des, 03:41, "W. eWatson" <wolftra...@invalid.com> wrote:
>
>> His program was originally written in Python, but a new
>> hardware device (capture card) had no good interface with Python, so he
>> wrote it in C++, which does. From my knowledge of the Python program
>> before the entry of c++, it seems he could have farmed out the hardware
>> interface in much the same way he had done it before with a capture card
>> well know to him.
>
> This sounds a bit incompetent.
>
> Why didn't he just write an extension module in C++?
>
> Also, if you don't know how to spawn a subprocess, I'd question your
> competence as well.
>

I can't read his mind.

==============================================================================
TOPIC: Either IDLE Can't Start a subprocess or a firewall software firewall is
blocking the connection (Win)--Battlin McAfee
http://groups.google.com/group/comp.lang.python/t/18961392334d1976?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 17 2009 8:31 am
From: "W. eWatson"


Alf P. Steinbach wrote:
> * W. eWatson:
>> See Subject msg from Python 2.5 Win XP. It is preceded by a "Socket
>> Error". It happened while I had a simple program displayed, and I
>> wanted to see the shell. The msg occurred when I pressed Shell on Run
>> from the menu. I played around for awhile, but got nowhere. Same msg.
>> I did remove my McAfee firewall protection, and it worked once, but
>> reverted to not working.
>>
>> I rebooted and the first time I could use Shell, it succeeded. After
>> that it failed. Comments? Geeze! Mcaffe turned on the firewall again
>> after the reboot.
>>
>> All seems well now. Nope. McAfee turned the firewall back on. It
>> decided to warn me it was off, but now has allowed me to ignore the
>> fact it is "no longer protecting me". I'll just let Win firewall do
>> that, thank you.
>>
>> Nope it's back. I'll just stop here and let anyone who wants to just
>> chime in. If I get it to stop, I'll be back.
>
> I recall vaguely some similar problem caused by a program attempting to
> connect to localhost, and the solution then was to edit the hosts file
> (don't ask me for details, but perhaps that'll help you search: that
> problem had entirely to do with Windows' very over-zealous "security"
> measures).
>
>
> Cheers & hth.,
>
> - Alf
As it turns out, I can "sneak" around it, so I'm putting it aside.

==============================================================================
TOPIC: PIL: problem to convert an image array to PIL format
http://groups.google.com/group/comp.lang.python/t/68ff1469965e5846?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 17 2009 8:33 am
From: Sverre


On 17 Des, 15:45, Peter Otten <__pete...@web.de> wrote:
>
> This has come up before, see
>
> http://mail.python.org/pipermail/python-list/2009-October/1221578.html
>

> Peter

Thank you!


==============================================================================
TOPIC: UGG、Nike dunk high shoes wholesale\retail
http://groups.google.com/group/comp.lang.python/t/a3db54f2597fce62?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 17 2009 8:36 am
From: hihy li


UGG、Nike dunk high shoes wholesale\retail

Our company mainly deal with the import and export of the brand sports
shoes, clothes, jewelry, bags , glasses, etc . Products such as Nike
Jordan sell well in America , Canada , as well as Europe and other
countries. Our objective is to supply products of first-class quality
and advanced technology. Customers satisfaction is our greatest
pursuit. We thank you for your attention and wish having a long time
business relationship with all buyers from all over the world.

we take PAYPAL as the method of payment!
please kindly visite our website: http://www.ccshoe.com

==============================================================================
TOPIC: iterators and views of lists
http://groups.google.com/group/comp.lang.python/t/22d674ee0510cd97?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 17 2009 8:41 am
From: Anh Hai Trinh


> I have a couple of thoughts:
> 1. Since [:] by convention already creates a copy, it might violate
> people's expectations if that syntax were used.

Indeed, listagent returns self on __getitem__[:]. What I meant was
this:

x = [0, 1, 2, 3, 4, 5, 6, 7]
a = listagent(x)[::2]
a[:] = listagent(x)[::-2]

And we get x = [7, 1, 5, 3, 3, 5, 1, 7], the copying happens in-place,
of course.


> 2. I'd give the listagent the mutable sequence interface

Done! I put the code in a repository here for those who might be
interested:
<http://github.com/aht/listagent.py>.

In retrospect, the Python gurus here was right though. Copy, modify
then replace is good enough, if not better since items are just
pointers instead of values. For reversing, you need to translate all
the indices (which cost exactly one addition and one multiplication
per index). Is that cheaper than copying all the pointers to a new
list? For sorting, you definitely need to construct a lookup table
since the sort algorithm needs to look over the indices multiple
times, which means you are using two pointer indirections per index.
Is that cheaper than just copying all the pointers to a new list? Even
if there is any benefit at all, you'll need to implement listagent in
C to squeeze it out.

However, using listagents is faster if you just want a few items out
of the slice. And it's cute.

Peace,
----aht

==============================================================================
TOPIC: Help with parsing a list
http://groups.google.com/group/comp.lang.python/t/70c8433a77f5db6e?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 17 2009 9:10 am
From: "thunderfoot@gmail.com"


On Dec 17, 6:05 am, Sallu <praveen.sunsetpo...@gmail.com> wrote:
> Hi i tried with thunderfoot code
>
> error:
>
> Traceback (most recent call last):
>   File "<stdin>", line 8, in ?
> ValueError: need more than 1 value to unpack- Hide quoted text -
>

hence, my 'seemingly' functional qualification. :)

that's most likely to due to a datum starting with '\t' instead of '
\t'. yet another reason that emile's code is superior to my one off.

==============================================================================
TOPIC: shouldn't list comprehension be faster than for loops?
http://groups.google.com/group/comp.lang.python/t/791b2a041acedbc0?hl=en
==============================================================================

== 1 of 4 ==
Date: Thurs, Dec 17 2009 9:37 am
From: Carlos Grohmann


Hello all

I am testing my code with list comprehensions against for loops.

the loop:

dipList=[float(val[1]) for val in datalist]
dip1=[]
for dp in dipList:
if dp == 90:
dip1.append(dp - 0.01)
else:
dip1.append(dp)

listcomp:

dipList=[float(val[1]) for val in datalist]
dip1=[(dp, dp-0.01)[dp==90.0] for dp in dipList]


Tenting the time spent by each approach (using time.clock()), with a
file with about 100,000 entries, I get 0.03s for the loop and 0.05s
for the listcomp.

thoughts?

TIA
Carlos

== 2 of 4 ==
Date: Thurs, Dec 17 2009 9:42 am
From: Tobias Weber


In article
<979c8ffe-dc39-4b2b-ab9b-12ecefc12d7a@y24g2000yqb.googlegroups.com>,
Carlos Grohmann <carlos.grohmann@gmail.com> wrote:

> thoughts?

Well, for the loop you use an if statement, for the list you create a
tuple, so your benchmark is invalid. Try again.

Also, I wouldn't worry about speed and use what looks better in writing.

--
Tobias Weber


== 3 of 4 ==
Date: Thurs, Dec 17 2009 9:42 am
From: "Alf P. Steinbach"


* Carlos Grohmann:
> Hello all
>
> I am testing my code with list comprehensions against for loops.
>
> the loop:
>
> dipList=[float(val[1]) for val in datalist]
> dip1=[]
> for dp in dipList:
> if dp == 90:
> dip1.append(dp - 0.01)
> else:
> dip1.append(dp)
>
> listcomp:
>
> dipList=[float(val[1]) for val in datalist]
> dip1=[(dp, dp-0.01)[dp==90.0] for dp in dipList]
>
>
> Tenting the time spent by each approach (using time.clock()), with a
> file with about 100,000 entries, I get 0.03s for the loop and 0.05s
> for the listcomp.
>
> thoughts?

In the list comprehension you're constructing n tuples that you're not
constructing in the loop.

Have you tried this with

dip1 = [dp - 0.01 if dp == 90 else dp for dp in dipList]

?


Cheers & hth.,

- Alf


== 4 of 4 ==
Date: Thurs, Dec 17 2009 10:04 am
From: Carlos Grohmann

> Have you tried this with
>
>    dip1 = [dp - 0.01 if dp == 90 else dp for dp in dipList]
>

Yes that is better! many thanks!


==============================================================================
TOPIC: pyZui - anyone know about this?
http://groups.google.com/group/comp.lang.python/t/0c158e4ab710de96?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 17 2009 9:46 am
From: Terry Reedy


On 12/17/2009 2:14 AM, Donn wrote:
> On Wednesday 16 December 2009 07:03:19 David Roberts wrote:
>> It involves scaling an image to various resolutions, and partitioning
>> them into fixed-size tiles. It's roughly the same technique used by
>> Google Maps/Earth.
> Thanks. That gives me something to go on. Wikipedia didn't like my search
> terms.
>
>>> ZUIs are useful for particular types of data - images& mapping
>>> especially - but I'd hate to have to navigate my desktop using its
>>> approach.
> Ever since Corel Draw in the 90's zoomed into my life I have been in love with
> the idea of an endless canvas that makes me feel like a satellite on a bungee
> cord. I think it would fit the desktop very well.
>
> Personally I see a merging of normal app windows and a zui: some kind of new
> window manager.

The original idea, perhaps, was from Jef Raskin in The Human Interface.
Wikipedia has articles on both. His idea was for a document rather than
app centric plain. Not clear how one would pipe data from app to app in
his model, though.

tjr


==============================================================================
TOPIC: Samsung-B7320-Omnia-PRO
http://groups.google.com/group/comp.lang.python/t/8f5f1a8ba7581ffc?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 17 2009 10:08 am
From: Muhammad Salman


Samsung B7320 OMNIA Pro Phone - Lets Work and play togather Samsung
B7320 Omnia PRO comes with powerful connectivity so you can get the
most out of your mobile Phone.
For details: http://infomobilepk.blogspot.com
Note: Don't forget to click on ads.

==============================================================================
TOPIC: Nokia-N97-Mini
http://groups.google.com/group/comp.lang.python/t/67ff6981d3a00653?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 17 2009 10:09 am
From: Muhammad Salman


New Nokia N97 Mini Mobile Phone - Simply the right choice The sleek
Nokia N97 mini phone integrates the web into your life & seamlessly
connects you to your friends & favourite online services.
For details: http://infomobilepk.blogspot.com
Note: Don't forget to click on ads.

==============================================================================
TOPIC: Nokia-E72
http://groups.google.com/group/comp.lang.python/t/bd7fa48dd174d6a6?hl=en
==============================================================================

== 1 of 1 ==
Date: Thurs, Dec 17 2009 10:13 am
From: Muhammad Salman


Nokia E72 Mobile Phone Nokia E72 is a high-performance device made
for seamless business and personal communication. Use the highly
responsive Optical Navi Key™ of Nokia E72 to scroll quickly &
smoothly through webpages, emails, & menus.
For details: http://infomobilepk.blogspot.com
Note: Don't forget to click on ads.


==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en

To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate