Hi, perl has __END__ which ignore all the lines below it.
Is there anything similar to __END__ in python? Thanks.
--
Regards,
Peng
--
https://mail.python.org/mailman/listinfo/python-list
Hi Rick!
On Wed, Dec 06, 2017 at 04:05:42PM -0800, Rick Johnson wrote:
> Python wrote:
>
> [...]
>
> > THIS IS FALSE. CALLING A FUNCTION
>
> What *FUNCTION*?
In this snippet (which again, we agreed was an incomplete academic
example):
if item:
process(item)
else:
do_w
On 12/07/2017 10:28 AM, Ethan Furman wrote:
The simple answer is No, and all the answers agree on that point.
It does beg the question of what an identity function is, though.
Thankfully, Paul answered that question with a good explanation*.
Thanks, everyone, for the discussion.
--
~Ethan~
On Thu, Dec 07, 2017 at 01:29:11PM +1100, Steve D'Aprano wrote:
> On Thu, 7 Dec 2017 08:22 am, Python wrote:
> >> > Linux doesn’t do “OS file associations”.
> >>
> >> Then how does my Linux box know that when I double-click on a text file, it
> >> launches kwrite rather than (say) the Gimp or Libr
On Wednesday, December 6, 2017 at 8:29:23 PM UTC-6, Steve D'Aprano wrote:
[...]
> If the term "OS file associations" is ever so slightly
> inaccurate (it's not the actual OS kernel that does the
> associating, but the desktop environment), well, we can
> probably say the same thing about Mac
Nathan Ernst writes:
> There is a built-in identity function in Python. The function is called
> 'id'.
It should be clear from the rest of the thread. But, to be explicit:
That's not what is meant by “identity function”, and the Python ‘id’
function is not an identity function.
The Python ‘id’
Ethan Furman writes:
> My contention is that an identity function is a do-nothing function
> that simply returns what it was given:
>
> --> identity(1)
> 1
>
> --> identity('spam')
> 'spam'
These seem good to me. One argument given, the same result returned.
> --> identity('spam', 'eggs', 7)
>
On 7 December 2017 at 20:35, Chris Angelico wrote:
> Because it's impossible to return multiple values. IMO the "identity
> function" is defined only in terms of one single argument, so all of
> this is meaningless.
Indeed, this is the key point. The Python language only allows
returning one valu
On Friday, December 8, 2017 at 5:15:35 AM UTC+13, Natalie Leung wrote:
> I have emailed the provider but their technical support staff has stated
> that they have exhausted of all ideas.
If they can’t supply you with a product fit for purpose, time to send it back
for a refund.
--
https://mail
Chris Angelico writes:
> On Fri, Dec 8, 2017 at 6:29 AM, Lele Gaifax wrote:
>> Chris Angelico writes:
>>
>>> On Fri, Dec 8, 2017 at 5:53 AM, Peter Otten <__pete...@web.de> wrote:
Hm, what does -- and what should --
identity(('spam', 'eggs', 7))
produce?
>>>
>>> The
On Fri, Dec 8, 2017 at 8:30 AM, Lele Gaifax wrote:
> Chris Angelico writes:
>
>> On Fri, Dec 8, 2017 at 6:29 AM, Lele Gaifax wrote:
>>> Chris Angelico writes:
>>>
On Fri, Dec 8, 2017 at 5:53 AM, Peter Otten <__pete...@web.de> wrote:
>
> Hm, what does -- and what should --
>
>>>
On 12/07/2017 12:24 PM, Peter Otten wrote:
identity((a, b, c))
calls identity() with one argument whereas
identity(a, b, c)
calls identity() with three arguments. That's certainly an effect; you just
undo it with your test for len(args) == 1. That means that your identity()
function throws aw
On Fri, Dec 8, 2017 at 7:25 AM, Ned Batchelder wrote:
> On 12/7/17 2:41 PM, Ethan Furman wrote:
>>
>> On 12/07/2017 11:23 AM, Ned Batchelder wrote:
>>>
>>> On 12/7/17 1:28 PM, Ethan Furman wrote:
>>
>>
--> identity('spam', 'eggs', 7)
('spam', 'eggs', 7)
>>>
>>>
>>> I don't see why this l
On 12/7/17 2:41 PM, Ethan Furman wrote:
On 12/07/2017 11:23 AM, Ned Batchelder wrote:
On 12/7/17 1:28 PM, Ethan Furman wrote:
--> identity('spam', 'eggs', 7)
('spam', 'eggs', 7)
I don't see why this last case should hold. Why does the function
take more than one argument? And if it does,
Ethan Furman wrote:
> On 12/07/2017 10:53 AM, Peter Otten wrote:
>> Ethan Furman wrote:
>>
>>> The simple answer is No, and all the answers agree on that point.
>>>
>>> It does beg the question of what an identity function is, though.
>>>
>>> My contention is that an identity function is a do-noth
There is a built-in identity function in Python. The function is called
'id'. See https://docs.python.org/3/library/functions.html#id Note that
this will not behave the same across different Python runtimes. e.g.
CPython, IronPython or Jython all implement this differently.
An example:
Python 3.5
On 12/07/2017 11:46 AM, Paul Moore wrote:
On 7 December 2017 at 18:28, Ethan Furman wrote:
The simple answer is No, and all the answers agree on that point.
It does beg the question of what an identity function is, though.
My contention is that an identity function is a do-nothing function th
On 7 December 2017 at 18:28, Ethan Furman wrote:
> The simple answer is No, and all the answers agree on that point.
>
> It does beg the question of what an identity function is, though.
>
> My contention is that an identity function is a do-nothing function that
> simply returns what it was given
On 12/07/2017 11:23 AM, Ned Batchelder wrote:
On 12/7/17 1:28 PM, Ethan Furman wrote:
--> identity('spam', 'eggs', 7)
('spam', 'eggs', 7)
I don't see why this last case should hold. Why does the function take more
than one argument? And if it does, then
why doesn't it work like this?
On Fri, Dec 8, 2017 at 6:29 AM, Lele Gaifax wrote:
> Chris Angelico writes:
>
>> On Fri, Dec 8, 2017 at 5:53 AM, Peter Otten <__pete...@web.de> wrote:
>>>
>>> Hm, what does -- and what should --
>>>
>>> identity(('spam', 'eggs', 7))
>>>
>>> produce?
>>
>> The same thing. And so should identity(((
Chris Angelico writes:
> On Fri, Dec 8, 2017 at 5:53 AM, Peter Otten <__pete...@web.de> wrote:
>>
>> Hm, what does -- and what should --
>>
>> identity(('spam', 'eggs', 7))
>>
>> produce?
>
> The same thing. And so should identity((('spam', 'eggs', 7))) and
> identity'spam', 'eggs', 7 and
On 12/7/17 1:28 PM, Ethan Furman wrote:
The simple answer is No, and all the answers agree on that point.
It does beg the question of what an identity function is, though.
My contention is that an identity function is a do-nothing function
that simply returns what it was given:
--> identity(
Chris Angelico writes:
> On Fri, Dec 8, 2017 at 5:28 AM, MRAB wrote:
>> It's probably that the code is assuming that call somewhere to the Python
>> API is returning a reference, but sometimes it isn't.
>>
>> _All_ such return values should be checked for NULL.
>
> Mmm true. Forgot about tha
On 12/07/2017 10:53 AM, Peter Otten wrote:
Ethan Furman wrote:
The simple answer is No, and all the answers agree on that point.
It does beg the question of what an identity function is, though.
My contention is that an identity function is a do-nothing function that
simply returns what it wa
On Fri, Dec 8, 2017 at 5:53 AM, Peter Otten <__pete...@web.de> wrote:
> Ethan Furman wrote:
>
>> The simple answer is No, and all the answers agree on that point.
>>
>> It does beg the question of what an identity function is, though.
>>
>> My contention is that an identity function is a do-nothing
Ethan Furman wrote:
> The simple answer is No, and all the answers agree on that point.
>
> It does beg the question of what an identity function is, though.
>
> My contention is that an identity function is a do-nothing function that
> simply returns what it was given:
>
> --> identity(1)
> 1
On Monday, December 4, 2017 at 3:44:48 PM UTC-5, christian...@gmail.com wrote:
> Same with me, except that I tried to install Python 3.6.3. Unchecking
> "Install launcher for all users" helped, however.
I'm having the same issue. I need Python to be available for all users. Has
anyone found a s
On Thursday, December 7, 2017 at 2:06:46 PM UTC, prvn...@gmail.com wrote:
> Hi All,
> I am new to python need help to write a script in python
> my requirement is :-
> write a python script to print sentence from a txt file to another txt file
>
> Regards,
> Praveen
Read this https://docs.python.
On Fri, Dec 8, 2017 at 5:28 AM, MRAB wrote:
> On 2017-12-07 17:22, Chris Angelico wrote:
>>
>> On Fri, Dec 8, 2017 at 2:36 AM, Natalie Leung
>> wrote:
>>>
>>> I am trying to use Python to communicate and send commands in MSC Marc. A
>>> part of the code looks something like this:
>>>
>>> from py_
On 2017-12-07 17:22, Chris Angelico wrote:
On Fri, Dec 8, 2017 at 2:36 AM, Natalie Leung wrote:
I am trying to use Python to communicate and send commands in MSC Marc. A part
of the code looks something like this:
from py_mentat import*
directory = '[specified the file path to my model]'
mar
The simple answer is No, and all the answers agree on that point.
It does beg the question of what an identity function is, though.
My contention is that an identity function is a do-nothing function that simply
returns what it was given:
--> identity(1)
1
--> identity('spam')
'spam'
--> ide
On Fri, Dec 8, 2017 at 2:36 AM, Natalie Leung wrote:
> I am trying to use Python to communicate and send commands in MSC Marc. A
> part of the code looks something like this:
>
> from py_mentat import*
>
> directory = '[specified the file path to my model]'
> marcModel = '[name of my model]'
>
>
On 12/07/2017 05:15 PM, Natalie Leung wrote:
> Hi Thomas,
>
> You are correct in that the software and its packages are close-sourced. I
> have emailed the provider but their technical support staff has stated that
> they have exhausted of all ideas.
>
> An interesting thing to note is that th
On 2017-12-07 15:36, Natalie Leung wrote:
I am trying to use Python to communicate and send commands in MSC Marc. A part
of the code looks something like this:
from py_mentat import*
directory = '[specified the file path to my model]'
marcModel = '[name of my model]'
py_echo(0)
openModel = '*
On Thursday, December 7, 2017 at 11:00:37 AM UTC-5, Thomas Nyberg wrote:
> On 12/07/2017 04:36 PM, Natalie Leung wrote:
> > The code stops at "py_send(openModel)" with an error message that reads:
> > Traceback (most recent call last): File "[my file path]", line 11, in
> > py_send(openModel)
> >
On 12/07/2017 04:36 PM, Natalie Leung wrote:
> The code stops at "py_send(openModel)" with an error message that reads:
> Traceback (most recent call last): File "[my file path]", line 11, in
> py_send(openModel)
> SystemError: error return without exception set
>
> I tried running the code on d
On Thu, Dec 7, 2017 at 10:36 AM, Natalie Leung
wrote:
> I am trying to use Python to communicate and send commands in MSC Marc. A
> part of the code looks something like this:
>
> from py_mentat import*
>
> directory = '[specified the file path to my model]'
> marcModel = '[name of my model]'
>
>
I am trying to use Python to communicate and send commands in MSC Marc. A part
of the code looks something like this:
from py_mentat import*
directory = '[specified the file path to my model]'
marcModel = '[name of my model]'
py_echo(0)
openModel = '*new_model yes *open_model "'+ directory +
On 07/12/17 13:19, Mario R. Osorio wrote:
On Tuesday, December 5, 2017 at 8:33:52 PM UTC-5, nick martinez wrote:
I have a question on my homework.
[snip]
Just my 2 cents:
Sigh. Please don't do people's homework for them. It doesn't teach
them anything. Now Nick had got 90% of the way
On Thu, Dec 7, 2017 at 9:06 AM, wrote:
> Hi All,
> I am new to python need help to write a script in python
> my requirement is :-
> write a python script to print sentence from a txt file to another txt file
>
> Regards,
> Praveen
> --
> https://mail.python.org/mailman/listinfo/python-list
>
So
Am 07.12.17 um 15:06 schrieb prvn.m...@gmail.com:
Hi All,
I am new to python need help to write a script in python
my requirement is :-
write a python script to print sentence from a txt file to another txt file
txt = open("another.txt", "w")
print("sentence from txt file", file = txt)
Hi All,
I am new to python need help to write a script in python
my requirement is :-
write a python script to print sentence from a txt file to another txt file
Regards,
Praveen
--
https://mail.python.org/mailman/listinfo/python-list
On Tuesday, December 5, 2017 at 8:33:52 PM UTC-5, nick martinez wrote:
> I have a question on my homework. My homework is to write a program in which
> the computer simulates the rolling of a die 50
> times and then prints
> (i). the most frequent side of the die
> (ii). the average die value o
Il giorno mercoledì 6 dicembre 2017 02:33:52 UTC+1, nick martinez ha scritto:
> I have a question on my homework. My homework is to write a program in which
> the computer simulates the rolling of a die 50
> times and then prints
> (i). the most frequent side of the die
> (ii). the average die val
> > A junior programmer sees the unlimited possibilities of programming. No
> > montain is too high to climb.
> >
> > A seasoned programmer is elated if they can get anything to work at all.
Good judgement comes from experience. And a lot of that comes
from bad judgement.
Karsten
--
https://mail
On Thu, Dec 7, 2017 at 6:54 PM, Marko Rauhamaa wrote:
> Gregory Ewing :
>
>> Rick Johnson wrote:
>>> DOLT: "Programming is easy! Once you learn the langauge,
>>> it's just a matter of fill-in-the-blanks."
>>
>> To be fair to this person, for someone who has a natural aptitude for
>> progra
46 matches
Mail list logo