Op 2017-09-22, Pavol Lisy schreef :
> On 9/19/17, leam hall wrote:
>> I'm working on designing the classes, sub-classes, and relationships in my
>> code. What is a good visual way to represent it so it can be stored in git
>> and shared on the list without large images or attachments?
>>
>> Thanks
On Sat, 23 Sep 2017 03:01 pm, Bill wrote:
> s='(20 - 10) > 15'
> b=(20 - 10) > 15
> print(s, " is ", ("true" if b else "false") ); ## inside parentheses
> may be removed.
>
> I am new to Python. Maybe someone here is familiar with an elegant way
> to get the the value of b directly from the s
Op 2017-09-22, Irmen de Jong schreef :
> On 09/22/2017 08:34 PM, Stephan Houben wrote:
>
>> I was vaguely tempted to offer the Mingw-w64 (GCC) Python as an
>> alternative, since it doesn't rely on any optionally-installed Microsoft
>> DLLs and so avoids this issue. But I suppose that is not really
On Friday, September 22, 2017 at 11:46:59 PM UTC-5, Cai Gengyang wrote:
> Input :
>
> # Assign True or False as appropriate on the lines below!
>
> # (20 - 10) > 15
> bool_one = False# We did this one for you!
>
> # (10 + 17) == 3**16
> # Remember that ** can be read as 'to the power of'. 3*
Bill wrote:
Cai Gengyang wrote:
Hey guys, I'm testing this on CodeAcademy, but I cant get the program
to output a result even after pressing the run button. Just wanted to
check if my logic is correct. Thanks alot
Your answers appear correct, but you could write Python statements to
test them
Cai Gengyang wrote:
Hey guys, I'm testing this on CodeAcademy, but I cant get the program to output
a result even after pressing the run button. Just wanted to check if my logic
is correct. Thanks alot
Your answers appear correct, but you could write Python statements to
test them (or any you
Input :
# Assign True or False as appropriate on the lines below!
# (20 - 10) > 15
bool_one = False# We did this one for you!
# (10 + 17) == 3**16
# Remember that ** can be read as 'to the power of'. 3**16 is about 43 million.
bool_two = False
# 1**2 <= -1
bool_three = False
# 40 * 4 >= -4
You have a lot of assignment statements, but nothing that produces output. Try
adding statements like this at appropriate places...
print ("bool_one = ", bool_one)
--
https://mail.python.org/mailman/listinfo/python-list
Hey guys, I'm testing this on CodeAcademy, but I cant get the program to output
a result even after pressing the run button. Just wanted to check if my logic
is correct. Thanks alot
# Assign True or False as appropriate on the lines below!
# (20 - 10) > 15
bool_one = False# We did this one
Bill wrote:
Mark Lawrence wrote:
On 22/09/2017 08:01, Bill wrote:
Steve D'Aprano wrote:
On Fri, 22 Sep 2017 02:57 pm, Bill wrote:
I find Python to be more more
like Java, with regard to "passing objects by reference".
Which is not a surprise, since both Python and Java use the same
value pa
Mark Lawrence wrote:
On 22/09/2017 08:01, Bill wrote:
Steve D'Aprano wrote:
On Fri, 22 Sep 2017 02:57 pm, Bill wrote:
I find Python to be more more
like Java, with regard to "passing objects by reference".
Which is not a surprise, since both Python and Java use the same
value passing
style:
On 09/22/2017 08:34 PM, Stephan Houben wrote:
> I was vaguely tempted to offer the Mingw-w64 (GCC) Python as an
> alternative, since it doesn't rely on any optionally-installed Microsoft
> DLLs and so avoids this issue. But I suppose that is not really the
> newbie-friendly solution the OP was loo
On Thursday, September 21, 2017 at 9:29:19 AM UTC-7, Tobiah wrote:
> Are these completely equivalent?
>
> def foo(thing):
>
> assert(thing > 0), "Thing must be greater than zero"
>
>
> def foo(thing):
>
> if not (thing > 0): raise AssertionError("Thing must be greater than
> z
On 9/19/17, leam hall wrote:
> I'm working on designing the classes, sub-classes, and relationships in my
> code. What is a good visual way to represent it so it can be stored in git
> and shared on the list without large images or attachments?
>
> Thanks!
>
> Leam
https://stackoverflow.com/quest
On 22/09/2017 19:50, Joey Steward wrote:
Hello,
I've been attempting to begin learning Django but have been having running
Django and Python commands on windows.
For example, when I run django-admin startproject mytestsite, I get the
following error message
django-admin : *The term 'django-adm
Hello,
I've been attempting to begin learning Django but have been having running
Django and Python commands on windows.
For example, when I run django-admin startproject mytestsite, I get the
following error message
django-admin : *The term 'django-admin' is not recognized as the name of a
cmdl
Op 2017-09-22, Thomas Jollans schreef :
> Just to make the implication explicit:
>
from math import nan
nan is nan
> True
nan == nan
> False
nan != nan
> True
To add to the fun:
>>> nan is nan
True
Stephan
--
https://mail.python.org/mailman/listinfo/python-list
Op 2017-09-21, Thomas Jollans schreef :
> On 2017-09-19 20:21, Stefan Ram wrote:
>> I do not use UTF-8
>>
>
> Why on earth not?!
Even *More* Older Man Yells at UTF-8?
--
https://mail.python.org/mailman/listinfo/python-list
Op 2017-09-20, Irmen de Jong schreef :
> The only thing I can think of is that it asks windows update to
> install said KB update but that it depends on something else that
> isn't installed or that the user running the installation doesn't have
> the rights to install windows updates. (I suspect s
Chris Angelico :
> On Fri, Sep 22, 2017 at 10:26 PM, Marko Rauhamaa wrote:
>> Chris Angelico :
>>> (Side point: Your slot_ref function is rather bizarre. It's a closure
>>> AND a class, just in case one of them isn't sufficient.
>>
>> I don't see anything bizarre in it at all.
> Sure you *can* d
Pavol Lisy wrote:
> pandas is one of reasons why python is so popular these days. But
> "there is only milion way how to do it" (and other unpythonic issues)
> I see there every time I am looking at it. :)
Yeah, such a useful tool with such a byzantine API, completely at odds with
the zen -- I w
On Fri, Sep 22, 2017 at 10:26 PM, Marko Rauhamaa wrote:
> Chris Angelico :
>> (Side point: Your slot_ref function is rather bizarre. It's a closure
>> AND a class, just in case one of them isn't sufficient.
>
> I don't see anything bizarre in it at all. I use the pattern all the
> time. It's calle
Exposito, Pedro (RIS-MDW) wrote:
> This code does a "where" clause on a panda data frame...
>
> Code:
> import pandas as pd;
> col_names = ['Name', 'Age', 'Weight', "Education"];
> # create panda dataframe
> x = pd.read_csv('test.dat', sep='|', header=None, names = col_names);
> #
i have a code in python to search and replace what i need though is to replace
the first say 10 instances of the number 1 with 2 and the second 10 instances
with the number 3. anybody knows how to do that?
fin = open(r'F:\1\xxx.txt')
fout = open(r'F:\1\xxx2.txt', "wt")
for line in fin:
fout.
On Fri, 22 Sep 2017 10:27 pm, Marko Rauhamaa wrote:
> r...@zedat.fu-berlin.de (Stefan Ram):
>
>> Marko Rauhamaa writes:
>>>swap(slot_ref(locals(), "x"), slot_ref(locals(), "y"))
>>
>> You need to be able to write the call as
>>
>> swap( x, y )
>
> Why?
Because that's the whole point of the e
> https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.ElementTree.write
>
> The argument was added in Python 3.4. Presumably, lxml implemented the
> API before this change.
>
> Maybe this would be considered a bug by lxml. Maybe it won't.
Maybe it is not a bug, just
On 2017-09-22 14:43, Steve D'Aprano wrote:
> In the case of floating point NANs, they are unordered with respect to all
> numbers. So for any number x, we always have:
>
> NAN == x
> NAN < x
> NAN > x
> NAN <= x
> NAN >= x
>
> all return False, and
>
> NAN != x
>
> return True.
Just to make t
>
>
> is a perfectly good pattern to use.
>
Thanks looks nice :)
>
>
> >
> >
> > I am a Linux user on Python 2.7
>
> Have you considered moving to Python 3?
>
Not yet , but Is there something that I need to consider in the current
context?
Regards,
Ganesh
--
https://mail.python.org/mailma
This code does a "where" clause on a panda data frame...
Code:
import pandas as pd;
col_names = ['Name', 'Age', 'Weight', "Education"];
# create panda dataframe
x = pd.read_csv('test.dat', sep='|', header=None, names = col_names);
# apply "where" condition
z = x[ (x['Age'] == 55) ]
On 2017-09-22 14:29, Nagy László Zsolt wrote:
>
>> Result:
>>
>> Traceback (most recent call last):
>> File "C:/not_telling/c14n.py", line 16, in
>> short_empty_elements=False
>> File "lxml.etree.pyx", line 1869, in lxml.etree._ElementTree.write
>> (src\lxml\lxml.etree.c:57004)
>> TypeErr
On 22/09/2017 13:34, Steve D'Aprano wrote:
On Fri, 22 Sep 2017 09:24 pm, Marko Rauhamaa wrote:
Yes, following my recipe:
def swap(ref_a, ref_b):
a, b = ref_a.get(), ref_b.get()
ref_a.set(b)
ref_b.set(a)
x = 10
y = "Z"
swap(slot_ref(locals(), "x"), slot
On Fri, 22 Sep 2017 10:03 pm, alister wrote:
> On Fri, 22 Sep 2017 21:15:54 +1000, Steve D'Aprano wrote:
>
>> On Fri, 22 Sep 2017 08:50 pm, alister wrote:
>>
The bottom line is, if I saw
if not (thing > 0): raise AssertionError(...)
in a code review, I'd probably insis
r...@zedat.fu-berlin.de (Stefan Ram):
> Marko Rauhamaa writes:
>>r...@zedat.fu-berlin.de (Stefan Ram):
>>>Marko Rauhamaa writes:
swap(slot_ref(locals(), "x"), slot_ref(locals(), "y"))
>>>You need to be able to write the call as
>>>swap( x, y )
>>Why?
>
> You responded to Bart:
>
> | sw
On 2017-09-22 14:03, alister via Python-list wrote:
> On Fri, 22 Sep 2017 21:15:54 +1000, Steve D'Aprano wrote:
>> On Fri, 22 Sep 2017 08:50 pm, alister wrote:
>>> [snip]
>>>
>>> In a code review I would want the condition changed to be less noisy/
>>> confusing to the reader.
>>>
>>> if thing <=0:
On Fri, 22 Sep 2017 09:24 pm, Marko Rauhamaa wrote:
> bartc :
>
>> On 22/09/2017 10:23, Marko Rauhamaa wrote:
>>> However, Python doesn't need any language changes to implement memory
>>> slots. A memory slot could be defined as any object that implements
>>> "get()" and "set(value)" methods:
>>
r...@zedat.fu-berlin.de (Stefan Ram):
> Marko Rauhamaa writes:
>>swap(slot_ref(locals(), "x"), slot_ref(locals(), "y"))
>
> You need to be able to write the call as
>
> swap( x, y )
Why?
Marko
--
https://mail.python.org/mailman/listinfo/python-list
> Result:
>
> Traceback (most recent call last):
> File "C:/not_telling/c14n.py", line 16, in
> short_empty_elements=False
> File "lxml.etree.pyx", line 1869, in lxml.etree._ElementTree.write
> (src\lxml\lxml.etree.c:57004)
> TypeError: write() got an unexpected keyword argument 'short_em
Chris Angelico :
> Sure, let me just put that into a function. CPython 3.7, although I'm
> pretty sure most CPython versions will do the same, as will several of
> the other Pythons.
> [demonstration that it didn't work]
Ok. The reason is this:
Note: The contents of this dictionary should not
On 22/09/2017 10:53, Bill wrote:
I just wanted to mention that my comment was made in the context that
Python is implemented by an interpreter written in C. I realize that
this may not always be the case. However, I haven't heard anyone
mention a Python interpreter written in Python yet.
T
On 22/09/2017 08:01, Bill wrote:
Steve D'Aprano wrote:
On Fri, 22 Sep 2017 02:57 pm, Bill wrote:
I find Python to be more more
like Java, with regard to "passing objects by reference".
Which is not a surprise, since both Python and Java use the same value
passing
style: pass by object refere
Here is an MWE:
import io
from lxml import etree
test_node = etree.fromstring('''
http://schemas.xmlsoap.org/soap/envelope/";
xmlns:ns1="http://docs.oasis-open.org/ws-sx/ws-trust/200512";>
''')
output = io.BytesIO(b'')
test_node.getroottree().write(output,
enc
On Fri, 22 Sep 2017 21:15:54 +1000, Steve D'Aprano wrote:
> On Fri, 22 Sep 2017 08:50 pm, alister wrote:
>
>>> The bottom line is, if I saw
>>>
>>> if not (thing > 0): raise AssertionError(...)
>>>
>>> in a code review, I'd probably insist that either it be changed to use
>>> `assert`,
>>> or t
On 22/09/2017 12:47, Chris Angelico wrote:
On Fri, Sep 22, 2017 at 9:24 PM, Marko Rauhamaa wrote:
Yes, following my recipe:
def swap(ref_a, ref_b):
a, b = ref_a.get(), ref_b.get()
ref_a.set(b)
ref_b.set(a)
x = 10
y = "Z"
swap(slot_ref(locals(), "x"),
On Fri, Sep 22, 2017 at 9:24 PM, Marko Rauhamaa wrote:
> bartc :
>
>> On 22/09/2017 10:23, Marko Rauhamaa wrote:
>>> However, Python doesn't need any language changes to implement memory
>>> slots. A memory slot could be defined as any object that implements
>>> "get()" and "set(value)" methods:
>
On Fri, 22 Sep 2017 05:01 pm, Bill wrote:
> Steve D'Aprano wrote:
>> On Fri, 22 Sep 2017 02:57 pm, Bill wrote:
>>
>>> I find Python to be more more
>>> like Java, with regard to "passing objects by reference".
>> Which is not a surprise, since both Python and Java use the same value
>> passing sty
bartc :
> On 22/09/2017 10:23, Marko Rauhamaa wrote:
>> However, Python doesn't need any language changes to implement memory
>> slots. A memory slot could be defined as any object that implements
>> "get()" and "set(value)" methods:
>
> I didn't understand your examples.
>
> Can Python be used to
On Fri, 22 Sep 2017 08:50 pm, alister wrote:
>> The bottom line is, if I saw
>>
>> if not (thing > 0): raise AssertionError(...)
>>
>> in a code review, I'd probably insist that either it be changed to use
>> `assert`,
>> or the exception be changed to ValueError, whichever better expresses
>> t
On Fri, 22 Sep 2017 08:48 pm, bartc wrote:
> Can Python be used to write, say, a swap() function that works with any
> argument types (not just classes or lists)? Example:
>
> def swap(&a,&b):# made up syntax
> a, b = b, a
>
> x=10
> y="Z"
> swap(x,y)
>
On Fri, 22 Sep 2017 07:53 pm, Bill wrote:
> Marko Rauhamaa wrote:
>> Bill :
>>
>>> I figure that, internally, an address, a pointer, is being passed by
>>> value to implement pass by reference. Why do you say "they are right"
>>> above? Are you saying it's not pass by reference?
>
> Thank you for
On Fri, 22 Sep 2017 03:44:59 +1000, Steve D'Aprano wrote:
> On Fri, 22 Sep 2017 02:29 am, Tobiah wrote:
>
>> Are these completely equivalent?
>>
>> def foo(thing):
>>
>> assert(thing > 0), "Thing must be greater than zero"
>>
>>
>> def foo(thing):
>>
>> if not (thing > 0): ra
On 22/09/2017 10:23, Marko Rauhamaa wrote:
Bill :
I figure that, internally, an address, a pointer, is being passed by
value to implement pass by reference. Why do you say "they are right"
above? Are you saying it's not pass by reference?
"Pass by reference" could be "pass by reference to obj
On 22 September 2017 at 10:05, Thomas Jollans wrote:
> On 2017-09-22 10:55, Ganesh Pal wrote:
>> I have two possible values for Z_block in the block code i.e
>> disk_object.data.data.di_data[0] or block.data.data.di_data.data[0][0]
>>
>>
>> def get_block():
>> ''' Get Z block ''
>>
>> if b
Marko Rauhamaa wrote:
Bill :
I figure that, internally, an address, a pointer, is being passed by
value to implement pass by reference. Why do you say "they are right"
above? Are you saying it's not pass by reference?
Thank you for your examples. I studied them carefully (and I'm not
throug
On 2017-09-22 10:55, Ganesh Pal wrote:
> I have two possible values for Z_block in the block code i.e
> disk_object.data.data.di_data[0] or block.data.data.di_data.data[0][0]
>
>
> def get_block():
> ''' Get Z block ''
>
> if block.data.data.di_data.data[0][0] is not None:
> Z_bl
Bill :
> I figure that, internally, an address, a pointer, is being passed by
> value to implement pass by reference. Why do you say "they are right"
> above? Are you saying it's not pass by reference?
"Pass by reference" could be "pass by reference to object" (Python,
Java, JavaScript, Lisp) or
I have two possible values for Z_block in the block code i.e
disk_object.data.data.di_data[0] or block.data.data.di_data.data[0][0]
def get_block():
''' Get Z block ''
if block.data.data.di_data.data[0][0] is not None:
Z_block = block.data.data.di_data.data[0][0]
else:
Bill wrote:
Stefan Ram wrote:
Bill writes:
Stefan Ram wrote:
bartc writes:
On 20/09/2017 02:31, Bill wrote:
it's implementation, I would say that C++ has it all over Python
from
the point of view of "intuitiveness". It's much easier to tell
what's
going on, at a glance, in a C++ program
Stefan Ram wrote:
Bill writes:
Stefan Ram wrote:
bartc writes:
On 20/09/2017 02:31, Bill wrote:
it's implementation, I would say that C++ has it all over Python from
the point of view of "intuitiveness". It's much easier to tell what's
going on, at a glance, in a C++ program.
You're being
On 9/21/17, Peter Otten <__pete...@web.de> wrote:
> zljubi...@gmail.com wrote:
>
>> I have sliced the pandas dataframe
>>
>> end_date = df[-1:]['end']
>>
>> type(end_date)
>> Out[4]: pandas.core.series.Series
>>
>> end_date
>> Out[3]:
>> 48173 2017-09-20 04:47:59
>> Name: end, dtype: datetime64[n
Steve D'Aprano wrote:
On Fri, 22 Sep 2017 02:57 pm, Bill wrote:
I find Python to be more more
like Java, with regard to "passing objects by reference".
Which is not a surprise, since both Python and Java use the same value passing
style: pass by object reference, or pass by sharing if you pref
60 matches
Mail list logo