theh...@gmail.com:
> You seem to have missed the point. Nobody is suggesting, I don't
> believe, that all of a language should be intuitive. Rather that if
> any part of it is unnecessarily counter-intuitive, it may be worth
> looking for a better solution. Python is a very well designed language
On Saturday, May 21, 2016 at 1:51:19 AM UTC+5:30, Christopher Reimer wrote:
> On 5/20/2016 8:59 AM, Zachary Ware wrote:
>
> > On Fri, May 20, 2016 at 3:09 AM, Erik wrote:
> >> On 20/05/16 00:51, Gregory Ewing wrote:
> >>> It's not so bad with "else" because you need to look back
> >>> to find out
On Sat, 21 May 2016 03:19:49 +, Dan Sommers wrote:
>> Is there something shorter and sweeter for the summation?
>
> from itertools import groupby
> from operator import itemgetter
>
> result = [(k,
>sum(map(itemgetter(2), v)),
>sum(map(itemgetter(3
On Sat, May 21, 2016 at 2:47 PM, wrote:
> It's amazing the "tool" is so simple. Actually I feel a little embarrassed
> that I do know every statements in it but just no idea of combining them
> together. Thanks a lot, Chris.
>
It's a pretty complicated tool, actually - but you're using it in a
On Sat, 21 May 2016 11:05 am, jf...@ms4.hinet.net wrote:
> Is there any tools which can do the memory dump of an object so I can view
> their content or implementation?
No standard tool. There may be third-party tools, but they would be
implementation-specific.
> For example,
>
s1 = '\x
Sorry, forget to mention that I am working on version 3.4
Following the steps given in Chris's reply, I get the result from bytes string:
>>> b1 = b'\x80abc'
>>> ctypes.cast(id(b1), ctypes.c_voidp)
c_void_p(35495992)
>>> sys.getsizeof(b1)
21
>>> b1ptr = ctypes.cast(id(b1), ctypes.POINTER(ctypes.c
On Sat, May 21, 2016 at 1:50 PM, Steven D'Aprano wrote:
> On Sat, 21 May 2016 10:24 am, Jon Ribbens wrote:
>
>> On 2016-05-20, Ethan Furman wrote:
>
>>> If you don't take the extra step of _break_ it is the usual case.
>>
>> Having an "for: else:" clause without a "break" would be so unusual
>> t
On Wed, May 18, 2016 at 10:47 AM, Steven D'Aprano wrote:
> Getting the middle N seems like it ought to be easy:
>
> s[N//2:-N//2]
>
> but that is wrong. It's not even the right length!
>
> py> s = 'aardvark'
> py> s[5//2:-5//2]
> 'rdv'
>
>
> So after spending a ridiculous amount of time on what s
On Sat, 21 May 2016 10:24 am, Jon Ribbens wrote:
> On 2016-05-20, Ethan Furman wrote:
>> If you don't take the extra step of _break_ it is the usual case.
>
> Having an "for: else:" clause without a "break" would be so unusual
> that it's literally nonexistent, because it would always be a bug.
On 5/20/2016 7:31 PM, Chris Angelico wrote:
On Sat, May 21, 2016 at 11:23 AM, Christopher Reimer
wrote:
On 5/20/2016 3:43 PM, Steven D'Aprano wrote:
But the idea that you should avoid a Python feature while programming in
Python because Javascript doesn't have it, or Ruby, or C, is surely th
On Wed, 18 May 2016 20:59:55 -0400, DFS wrote:
> Have aList = [
> ('x','Name1', 1, 85),
> ('x','Name2', 3, 219),
> ('x','Name2', 1, 21),
> ('x','Name3', 6, 169)
> ]
>
> want
>
> aList = [
> ('Name1', 1, 85),
> ('Name2', 4, 240),
> ('Name3', 6, 169)
> ]
[snip]
> Is there something shorter and
On Sat, May 21, 2016 at 11:23 AM, Christopher Reimer
wrote:
> On 5/20/2016 3:43 PM, Steven D'Aprano wrote:
>
>> But the idea that you should avoid a Python feature while programming in
>> Python because Javascript doesn't have it, or Ruby, or C, is surely the
>> height of muddleheaded thinking. Yo
On Sat, May 21, 2016 at 11:05 AM, wrote:
> Is there any tools which can do the memory dump of an object so I can view
> their content or implementation? For example,
>
s1 = '\x80abc'
b1 = b'\x80abc'
>
> What are exactly stored in memory for each of them? Is their content really
> the
On 5/20/2016 3:43 PM, Steven D'Aprano wrote:
But the idea that you should avoid a Python feature while programming in
Python because Javascript doesn't have it, or Ruby, or C, is surely the
height of muddleheaded thinking. You're not programming Javascript, Ruby or
C, you're programming in Pytho
On 2016-05-20, Steven D'Aprano wrote:
> On Sat, 21 May 2016 05:20 am, Christopher Reimer wrote:
>
>> According to "Effective Python: 59 Specific Ways to Write Better Python"
>> by Brett Slatkin, Item 12 recommends against using the else block after
>> for and while loops (see page 25): "Avoid usin
On Sat, May 21, 2016 at 10:35 AM, Jon Ribbens
wrote:
> On 2016-05-20, Steven D'Aprano wrote:
>> By that logic, we ought to:
>>
>> - avoid using floats because their behaviour isn't intuitive and
>> can be confusing;
>
> To be fair, I'm very sympathetic to that argument. I think programming
> la
On Friday, May 20, 2016 at 9:05:51 PM UTC-4, jf...@ms4.hinet.net wrote:
> Is there any tools which can do the memory dump of an object so I can view
> their content or implementation? For example,
>
> >>> s1 = '\x80abc'
> >>> b1 = b'\x80abc'
>
> What are exactly stored in memory for each of them
Hello,
Greetings!
I would like to get your advice wrt following situation:
I have a Linux daemon written in python (version 2.7) using the python-daemon
(https://pypi.python.org/pypi/python-daemon) module. The objective of using
python daemon is to run as an init.d script in Linux. This gets i
Is there any tools which can do the memory dump of an object so I can view
their content or implementation? For example,
>>> s1 = '\x80abc'
>>> b1 = b'\x80abc'
What are exactly stored in memory for each of them? Is their content really the
same? This kind of tool should be helpful "for me" to l
On 2016-05-20, Steven D'Aprano wrote:
> By that logic, we ought to:
>
> - avoid using floats because their behaviour isn't intuitive and
> can be confusing;
To be fair, I'm very sympathetic to that argument. I think programming
languages should never magically produce floats out of nowhere unle
On 2016-05-20, Ethan Furman wrote:
> On 05/20/2016 04:55 AM, Jon Ribbens wrote:
>> Certainly. "else:" is (almost?) invariably used in the situation where
>> you are iterating through something in order to find a value which
>> matches a certain condition. So the "for:" block means "find this
>> va
Steven D'Aprano writes:
> Just about the only things in Python which are intuitive and not
> confusing to somebody are None and ints.
I'll go even further:
* The behaviour of ‘int’ is confusing to some. For example, to those who
expect integers to produce fractions when divided.
* The behavi
On 05/20/2016 04:55 AM, Jon Ribbens wrote:
On 2016-05-20, Steven D'Aprano wrote:
On Fri, 20 May 2016 03:55 am, Jon Ribbens wrote:
I guess we should thank our lucky stars that you don't have a time
machine then, since that change would very much be one for the worse
in my opinion. for...else i
You seem to have missed the point. Nobody is suggesting, I don't believe, that
all of a language should be intuitive. Rather that if any part of it is
unnecessarily counter-intuitive, it may be worth looking for a better solution.
Python is a very well designed language when it comes to in lingu
On Sat, 21 May 2016 05:20 am, Christopher Reimer wrote:
> According to "Effective Python: 59 Specific Ways to Write Better Python"
> by Brett Slatkin, Item 12 recommends against using the else block after
> for and while loops (see page 25): "Avoid using else blocks after loops
> because their beh
On Fri, May 20, 2016 at 5:39 PM, Xristos Xristoou wrote:
> hello i want to ask if a python is a good for to do it a complete
> program(.exe)?
> with user interface,module interface,background scripts where compile if
> the users calls some scripts,windows with interaction with the users?
> how ca
hello i want to ask if a python is a good for to do it a complete program(.exe)?
with user interface,module interface,background scripts where compile if
the users calls some scripts,windows with interaction with the users?
how can i do that with the python?
how can libs need for this ?
some tutor
i want to use python API from the QGIS in my python idle out from QGIS program
, but i have some errors if i try to import qgis.core in my idle. i have python
2.7 64 bit (my version) and i install QGIS via OSGeo4W64.
first i try to set two PATHS PYTHONPATH =
C:\OSGeo4W64\apps\qgis\pythonPYTHONP
On 5/20/2016 8:59 AM, Zachary Ware wrote:
On Fri, May 20, 2016 at 3:09 AM, Erik wrote:
On 20/05/16 00:51, Gregory Ewing wrote:
It's not so bad with "else" because you need to look back
to find out what condition the "else" refers to anyway.
With my tongue only slightly in my cheek, if it wa
On 5/20/2016 11:50 AM, Christopher Reimer wrote:
This code does work, blows up the unit test, and keeps PyCharm happy.
@property
def position(self):
return super().position
@position.setter
def position(self, position):
pass
Re-declaring @property and calling s
Greetings,
My chess engine has a Piece class with the following methods that use
the @property decorator to read and write the position value.
@property
def position(self):
return self._position
@position.setter
def position(self, position):
if self._first_move
On Fri, May 20, 2016 at 3:09 AM, Erik wrote:
> On 20/05/16 00:51, Gregory Ewing wrote:
>>
>> It's not so bad with "else" because you need to look back
>> to find out what condition the "else" refers to anyway.
>
>
> With my tongue only slightly in my cheek, if it was desirable to
> "fix"/clarify t
On 05/20/2016 01:30 AM, Robert Clove wrote:
> Hi,
>
> Can someone give me pseudo code to download and JNLP file from a URL and
> run it?
>
> Looks like a advance concept in python
You could use the urllib module to download the file, then use the
subprocess module to spawn the javaws executable
On Thu, May 19, 2016 at 1:04 PM Ian Kelly wrote:
> On Thu, May 19, 2016 at 10:31 AM, Herkermer Sherwood
> wrote:
> > Most keywords in Python make linguistic sense, but using "else" in for
> and
> > while structures is kludgy and misleading. I am under the assumption that
> > this was just utiliz
On Tuesday, May 17, 2016 at 12:20:53 AM UTC-5, Steven D'Aprano wrote:
> On Tuesday 17 May 2016 12:56, Chris Angelico wrote:
>
> > On Tue, May 17, 2016 at 12:37 PM, Steven D'Aprano <>
> > wrote:
> >> On Tue, 17 May 2016 09:07 am, Chris Angelico wrote:
> >>
> >>> I'm not overly bothered by the use o
We are pleased to introduce our second keynote speaker for EuroPython
2016:
*** Jameson Rollins ***
About Jameson Rollins
-
Jameson is a staff scientist in the LIGO project, based at the
California Institute of Technology:
"I have worked on many as
On 2016-05-20, Steven D'Aprano wrote:
> On Fri, 20 May 2016 03:55 am, Jon Ribbens wrote:
>> I guess we should thank our lucky stars that you don't have a time
>> machine then, since that change would very much be one for the worse
>> in my opinion. for...else is perfectly straightforward and clear
A little while ago I wrote uncompyle6 which can deparse Python C bytecode.
Currently it runs on 2.6-2.7 and 3.2 and up.
I think an underused part of that is that you can at runtime give it a bytecode
offset and it will show you where inside a line you are at. It also can show
the surrounding e
On Thursday, May 19, 2016 at 5:10:08 PM UTC-4, Fillmore wrote:
> Hello PyMasters!
>
> Long story short:
>
> cat myfile.txt | python -m pdb myscript.py
>
> doens't work (pdb hijacking stdin?).
>
> Google indicates that someone has fixed this with named pipes, but, call
> me stupid, I don't unde
On 20/05/16 00:51, Gregory Ewing wrote:
It's not so bad with "else" because you need to look back
to find out what condition the "else" refers to anyway.
With my tongue only slightly in my cheek, if it was desirable to
"fix"/clarify this syntax then I would suggest adding some optional
(exist
Hi,
Can someone give me pseudo code to download and JNLP file from a URL and
run it?
Looks like a advance concept in python
Regards
--
https://mail.python.org/mailman/listinfo/python-list
41 matches
Mail list logo