Le 24/09/2019 à 15:51, אורי a écrit :
https://stackoverflow.com/a/24752607/1412564
thank you for link. it's clear now
--
https://mail.python.org/mailman/listinfo/python-list
https://stackoverflow.com/a/24752607/1412564
אורי
u...@speedy.net
On Tue, Sep 24, 2019 at 4:07 PM ast wrote:
> Hi
>
> It is not clear to me why the following code
> generates 2 exceptions, ZeroDivisionError and
> ArithmeticError. Since ZeroDivisionError is
> catched, it shoud not bubble out.
>
I believe the idea is that previously, if you were handling an exception, and
your handling code caused its own exception, then you would get no info about
the original exception. So all useful information about the original problem
would get lost because of an oopsie in the handling code. So
On 2017-10-07 17:38, Prabu T.S. wrote:
I would like to continue to second function invocation
"checkServiceStatus('AdobeARMservice')" even if the first
checkServiceStatus('Tomcat9') has any exception.Please advice.Second
function invocation not getting executed if any exception occurs in
On 2017-10-07, Jorge Gimeno wrote:
> Catching all exceptions in a try-except block is almost always a bad
> idea.
Catching it and ignoring it as the OP was doing (or assuming it's some
particular exception) certainly is.
If you know (or suspect) that stderr isn't going
Catching all exceptions in a try-except block is almost always a bad idea.
You can't tell the difference between an exception that you are looking to
handle and an exception that should cause your program to crash and burn
(because something is wrong). It's best to catch a specific exception.
What
On Saturday, October 7, 2017 at 12:38:11 PM UTC-4, Prabu T.S. wrote:
> I would like to continue to second function invocation
> "checkServiceStatus('AdobeARMservice')" even if the first
>checkServiceStatus('Tomcat9') has any exception.Please advice.Second
> function invocation not getting
Palpandi writes:
> I am using methods from pyd files. At some cases, it is throwing some error
> messages in the console.
>
> When I use try.. except.. I am getting only the exception name.
> Not able to catch the entire error message.
>
> How do I get the the entire error
On Monday, February 8, 2016 at 1:05:08 AM UTC-7, shaunak...@gmail.com wrote:
> On Sunday, February 7, 2016 at 1:23:32 AM UTC-7, dieter wrote:
> > Shaunak Bangale writes:
> > > ...
> > > while (count > 0):
> > > try :
> > > # read line from file:
> > >
On Sunday, February 7, 2016 at 1:23:32 AM UTC-7, dieter wrote:
> Shaunak Bangale writes:
> > ...
> > while (count > 0):
> > try :
> > # read line from file:
> > print(file.readline())
> > # parse
> > parse_json(file.readline())
> >
Shaunak Bangale writes:
> ...
> while (count > 0):
> try :
> # read line from file:
> print(file.readline())
> # parse
> parse_json(file.readline())
> count = count - 1
> except socket.error as e:
>
Hi Martin,
Thanks for the detailed reply. I edited, saved and opened the file again.
Still I am getting exactly the same error.
Putting bigger chunk of code and the error again:
# create socket
s = socket.socket(socket.AF_INET)
#create a SSL context with the recommended security settings for
Hi Martin,
Answering your questions below:
On Fri, Feb 5, 2016 at 1:50 PM, Shaunak Bangale
wrote:
> Hi Martin,
>
> Thanks for the detailed reply. I edited, saved and opened the file again.
> Still I am getting exactly the same error.
>
> Putting bigger chunk of code
I do have the initiation command defined. Just that I am not allowed to
make the username, pwd public.
I am absolutely sure I am running the same code. Now opened the same file
with Python 3.5 shell and I get following error:
from _ssl import RAND_status, RAND_egd, RAND_add
ImportError:
On 02/05/2016 07:26 PM, shaunak.bang...@gmail.com wrote:
from _ssl import RAND_status, RAND_egd, RAND_add
ImportError: cannot import name 'RAND_egd'
I believe I've already seen this issue myself. It has to do with
LibreSSL not having RAND_egd for some reason I can't recall.
This seems
On Friday, February 5, 2016 at 12:58:37 PM UTC-7, shaunak...@gmail.com wrote:
> I am running this python script on R-studio. I have Python 3.5 installed on
> my system.
>
> count = 10
> while (count > 0):
> try :
> # read line from file:
> print(file.readline())
> #
On Feb 5, 2016 15:01, wrote:
>
> I am running this python script on R-studio. I have Python 3.5 installed
on my system.
>
> count = 10
> while (count > 0):
> try :
> # read line from file:
> print(file.readline())
> # parse
>
On Friday, February 5, 2016 at 1:09:35 PM UTC-7, Martin A. Brown wrote:
> >except socket.error as e
>
> >line 53 except socket.error as e ^ SyntaxError: invalid syntax
> >
> >I tried changing socket.error to ConnectionRefusedError. and still
> >got the same error.
>
> >Please tell me if the
On 02/05/2016 07:01 PM, Chris Angelico wrote:
On Sat, Feb 6, 2016 at 6:58 AM, wrote:
I am running this python script on R-studio. I have Python 3.5 installed on my
system.
Let's just try a quick smoke test. Run this script:
import sys
print(sys.version)
On Sat, Feb 6, 2016 at 8:08 AM, Bernardo Sulzbach
wrote:
> On 02/05/2016 07:01 PM, Chris Angelico wrote:
>>
>> On Sat, Feb 6, 2016 at 6:58 AM, wrote:
>>>
>>> I am running this python script on R-studio. I have Python 3.5 installed
>>> on my
On Friday, February 5, 2016 at 12:58:37 PM UTC-7, shaunak...@gmail.com wrote:
> I am running this python script on R-studio. I have Python 3.5 installed on
> my system.
>
> count = 10
> while (count > 0):
> try :
> # read line from file:
> print(file.readline())
> #
On Friday, February 5, 2016 at 1:08:11 PM UTC-7, Nathan Hilterbrand wrote:
> On Feb 5, 2016 15:01, wrote:
> >
> > I am running this python script on R-studio. I have Python 3.5 installed
> on my system.
> >
> > count = 10
> > while (count > 0):
> > try :
> >
On Sat, Feb 6, 2016 at 6:58 AM, wrote:
> I am running this python script on R-studio. I have Python 3.5 installed on
> my system.
>
Let's just try a quick smoke test. Run this script:
import sys
print(sys.version)
input("Press Enter to exit...")
That'll tell you a
Hi there,
>Thanks for the detailed reply. I edited, saved and opened the file
>again. Still I am getting exactly the same error.
>
>Putting bigger chunk of code and the error again:
[snipped; thanks for the larger chunk]
>Error:
>except socket.error as e:
> ^
>except socket.error as e
>line 53 except socket.error as e ^ SyntaxError: invalid syntax
>
>I tried changing socket.error to ConnectionRefusedError. and still
>got the same error.
>Please tell me if the problem is with Rstudio, Python version or
>the syntax.
Syntax.
Your code has,
On Friday, February 5, 2016 at 1:11:19 PM UTC-7, shaunak...@gmail.com wrote:
> On Friday, February 5, 2016 at 1:08:11 PM UTC-7, Nathan Hilterbrand wrote:
> > On Feb 5, 2016 15:01, wrote:
> > >
> > > I am running this python script on R-studio. I have Python 3.5
Hi there Shaunak,
I saw your few replies to my (and Nathan's) quick identification of
syntax error. More comments follow, here.
>I am running this python script on R-studio. I have Python 3.5 installed on my
>system.
>
>count = 10
>while (count > 0):
>try :
># read line from
On Friday, February 5, 2016 at 2:09:11 PM UTC-7, Bernardo Sulzbach wrote:
> On 02/05/2016 07:01 PM, Chris Angelico wrote:
> > On Sat, Feb 6, 2016 at 6:58 AM, wrote:
> >> I am running this python script on R-studio. I have Python 3.5 installed
> >> on my system.
> >>
>
On Sat, Feb 6, 2016 at 9:35 AM, wrote:
> On Friday, February 5, 2016 at 12:58:37 PM UTC-7, shaunak...@gmail.com wrote:
>> I am running this python script on R-studio. I have Python 3.5 installed on
>> my system.
>>
>> count = 10
>> while (count > 0):
>> try :
>>
On 2015-08-24 06:49, 344276105 wrote:
Hi all,
I am a python learner. I encountered a problem when i was testing the
following code. What is strange is that if I replace the object name
with zhang, the program would be ok. And if I replace the
Person.population with self.__class__.population, it
Hi Chris,
Thanks a lot for such a comprehensive reply, I got it fixed now. Thanks
again :)
On Tue, May 5, 2015 at 2:52 PM, Chris Angelico ros...@gmail.com wrote:
On Tue, May 5, 2015 at 7:23 PM, david jhon djhon9...@gmail.com wrote:
from threading import Timer, Lock
class
On Tue, May 5, 2015 at 7:23 PM, david jhon djhon9...@gmail.com wrote:
from threading import Timer, Lock
class miTestClass(EventMixin):
def __init__(self, t, r, bw):
self.statMonitorLock = Lock() #to lock the multi access threads
self.statMonitorLock.acquire()
Palpandi palpandi...@gmail.com writes:
Thanks for your responses. And I have one more question.
This is the situation. A python application which reads data from one .xml
file and generates some other file. Here what kind of exceptions occur?
Ideally, you would not get any exceptions.
In
On Thu, 9 Apr 2015 07:31 pm, Palpandi wrote:
Hi all,
Is there any way to roll back or undo changes which are all done before
exception occurs.
Not automatically. You have to program it yourself.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Apr 9, 2015 at 7:31 PM, Palpandi palpandi...@gmail.com wrote:
Hi all,
Is there any way to roll back or undo changes which are all done before
exception occurs.
In Python itself? Not directly; there are no facilities for undoing
Python code. But if you're serious about integrity, you
Well I am not sure what advantage this has for the user, not my code as
I don't advocate the import to begin with it, its fine spelled as it was
from where it was...
The advantage for the user is:
/snip
Hey Steven,
Sorry for the late reply (travelling). My comment wasn't clear, I was
I see that you've solved your immediate problem, but you shouldn't call
__setattr__ directly. That should actually be written
setattr(bar, 'a_new_name', MyError)
But really, since bar is (apparently) a module, and it is *bar itself*
setting the attribute, the better way is
On Wed, 14 May 2014 09:21:50 +, Joseph L. Casale wrote:
I see that you've solved your immediate problem, but you shouldn't call
__setattr__ directly. That should actually be written
setattr(bar, 'a_new_name', MyError)
But really, since bar is (apparently) a module, and it is *bar
On Wed, May 14, 2014 at 11:08 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
One should code as if the next person who reads your program is an easily
upset psychotic axe-murderer who knows where you live. You wouldn't
condone writing y = x.__add__(1) instead of y = x + 1, you
On Wed, May 14, 2014 at 2:59 AM, Joseph L. Casale
jcas...@activenetwerx.com wrote:
During handling of the above exception, another exception occurred:
File C:/dir/test.py, line 12, in module
except a_new_name as exc:
TypeError: catching classes that do not inherit from BaseException is
Best would be to print out what's in a_new_name to see if it really is
what you think it is. If you think it is what you think it is, have a
look at its __mro__ (method resolution order, it's an attribute of
every class), to see what it's really inheriting. That should show you
what's
On Tue, 13 May 2014 16:59:46 +, Joseph L. Casale wrote:
I am working with a module that I am seeing some odd behavior.
A module.foo builds a custom exception, module.foo.MyError, its done
right afaict.
Another module, module.bar imports this and calls
bar.__setattr__('a_new_name',
snarf wrote:
Greetings,
As I tread through my journey of OO I am trying to determine if there is a
good approach for exception handling within classes.
From my readings and gatherings - it seems I have found a common theme, but I
am trying to solicit from the experts.
Here is what I
On Fri, 23 Aug 2013 22:25:55 -0700, snarf wrote:
[...]
* Seems like exception handing within Classes is largely avoided and is
typically only used when calling external libraries.
There is certainly no rule avoid exceptions inside classes. Methods
often raise exceptions to signal an error,
On 24/08/2013 11:27, Steven D'Aprano wrote:
On Fri, 23 Aug 2013 22:25:55 -0700, snarf wrote:
[snip]
* Using
Exception is typically a bad. More specific the better.
Yes, you should always try to catch the specific exceptions you care
about:
# Best
except ValueError, OverflowError,
On 8/24/2013 6:27 AM, Steven D'Aprano wrote:
On Fri, 23 Aug 2013 22:25:55 -0700, snarf wrote:
[...]
* Seems like exception handing within Classes is largely avoided and is
typically only used when calling external libraries.
There is certainly no rule avoid exceptions inside classes. Methods
On Sat, 24 Aug 2013 15:57:55 -0400, Terry Reedy wrote:
# Worst
except:
Don't use the last one, except maybe in the interactive interpreter,
Stick with never. except: means the same thing as except
BaseException:, except that the latter indicates a deliberate choice
rather than an
Hi Steven,
Yea this is great. Thanks for the feedback.
On Saturday, August 24, 2013 3:27:45 AM UTC-7, Steven D'Aprano wrote:
On Fri, 23 Aug 2013 22:25:55 -0700, snarf wrote:
[...]
* Seems like exception handing within Classes is largely avoided and is
typically only used when
Appreciate the feedback. I was hoping to get as much perspective as possible.
On Saturday, August 24, 2013 12:18:59 AM UTC-7, Dave Angel wrote:
snarf wrote:
Greetings,
As I tread through my journey of OO I am trying to determine if there is a
good approach for exception
On Thursday, February 21, 2013 2:20:41 AM UTC+8, MRAB wrote:
On 2013-02-20 08:26, Ziliang Chen wrote: Hi Guys, I am using the
multiprocessing module. The following code snippet occasionally throws the
Exception in thread QueueFeederThread (most likely raised during interpreter
shutdown)
On 2013-02-20 08:26, Ziliang Chen wrote:
Hi Guys,
I am using the multiprocessing module. The following code snippet occasionally throws the
Exception in thread QueueFeederThread (most likely raised during interpreter
shutdown) exception.
I searched google for the cause, someone says there are
I know nothing about this gnuradio thingie, and you didn't supply a
website url. I was wondering if the module is even intended to be run
standalone, but I suppose the if __name__ == __main__ thing is a clue
that it's supposed to.
I found the mixture of trace lines to
Ami Tavory wrote:
From: Peter Otten __pete...@web.de
To: python-list@python.org
Cc:
Date: Thu, 14 Feb 2013 09:00:58 +0100
Subject: Re: Exception ... in generator object ... ignored Messages
How did the subject get into the message body?
Ami Tavory wrote:
Hi,
Running the unit
On 02/15/2013 02:00 PM, matt.doolittl...@gmail.com wrote:
I am using using ubuntu 12.10 i am trying to run a python block, namely OP25,
in GNU Radio Companion v3.6.3-35-g4435082f, which uses python version 2.7.3 for
some reason although python3.2 is in the lib folder. I run the following trace
Ami Tavory wrote:
Hi,
Running the unit tests for some generator code, prints, as a side
effect,
numerous messages of the form:
...
Exception NameError: global name 'l' is not defined in generator object
_dagpype_internal_fn_act at 0x9d4c500 ignored
Exception AttributeError:
On 2012-10-15 17:00, Wanderer wrote:
How do you get Exceptions to print messages? I have an exception defined like
this
class PvCamError(Exception):
def __init__(self, msg):
self.msg = msg
But when the error is raised I get this:
Traceback (most recent call last):
File
In mailman.2217.1350317845.27098.python-l...@python.org MRAB
pyt...@mrabarnett.plus.com writes:
Why wasn't the message printed out?
You didn't add a __str__ method:
class PvCamError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
On 2012-10-15 17:22, John Gordon wrote:
In mailman.2217.1350317845.27098.python-l...@python.org MRAB
pyt...@mrabarnett.plus.com writes:
Why wasn't the message printed out?
You didn't add a __str__ method:
class PvCamError(Exception):
def __init__(self, msg):
self.msg = msg
On 10/15/2012 12:34 PM, MRAB wrote:
On 2012-10-15 17:22, John Gordon wrote:
In mailman.2217.1350317845.27098.python-l...@python.org MRAB
pyt...@mrabarnett.plus.com writes:
Why wasn't the message printed out?
You didn't add a __str__ method:
class PvCamError(Exception):
def
On Monday, October 15, 2012 12:34:53 PM UTC-4, MRAB wrote:
Yes, but you've put the message in msg, and Exception doesn't have that
attribute.
That's weird. I got this Exception class definition idea from this post by
Guido van Rostrum, Where he gives this main function to look like
On Monday, October 15, 2012 1:18:52 PM UTC-4, Wanderer wrote:
On Monday, October 15, 2012 12:34:53 PM UTC-4, MRAB wrote:
Yes, but you've put the message in msg, and Exception doesn't have that
attribute.
That's weird. I got this Exception class definition idea
On 2012-10-15 18:18, Wanderer wrote:
On Monday, October 15, 2012 12:34:53 PM UTC-4, MRAB wrote:
Yes, but you've put the message in msg, and Exception doesn't have that
attribute.
That's weird. I got this Exception class definition idea from this post by
Guido van Rostrum, Where he gives
On Monday, October 15, 2012 1:34:24 PM UTC-4, MRAB wrote:
On 2012-10-15 18:18, Wanderer wrote:
On Monday, October 15, 2012 12:34:53 PM UTC-4, MRAB wrote:
Yes, but you've put the message in msg, and Exception doesn't have that
attribute.
That's weird. I got this
On 10/15/2012 12:22 PM, John Gordon wrote:
In mailman.2217.1350317845.27098.python-l...@python.org MRAB
pyt...@mrabarnett.plus.com writes:
Why wasn't the message printed out?
You didn't add a __str__ method:
class PvCamError(Exception):
def __init__(self, msg):
self.msg =
On Mon, 15 Oct 2012 09:00:15 -0700, Wanderer wrote:
How do you get Exceptions to print messages? I have an exception defined
like this
class PvCamError(Exception):
def __init__(self, msg):
self.msg = msg
Please don't invent yet another interface for exception messages.
Charles Hixson wrote:
On 06/25/2012 12:48 AM, Steven D'Aprano wrote:
Catch any exception is almost certainly the wrong thing to do, almost
always.
This time it was the right thing
No, it wasn't. If you hadn't caught it, Python would have printed it
out for you, along with the full
On 06/25/2012 12:48 AM, Steven D'Aprano wrote:
On Sun, 24 Jun 2012 16:16:25 -0700, Charles Hixson wrote:
But what I wanted was to catch any exception.
Be careful of what you ask for, since you might get it.
Catch any exception is almost certainly the wrong thing to do, almost
On Jun 28, 10:13 am, Charles Hixson charleshi...@earthlink.net
wrote:
On 06/25/2012 12:48 AM, Steven D'Aprano wrote:
Catch any exception is almost certainly the wrong thing to do, almost
always.
This time it was the right thing, as I suspected that *SOME* exception
was being thrown, but
On Wed, 27 Jun 2012 17:13:00 -0700, Charles Hixson wrote:
On 06/25/2012 12:48 AM, Steven D'Aprano wrote:
On Sun, 24 Jun 2012 16:16:25 -0700, Charles Hixson wrote:
But what I wanted was to catch any exception.
Be careful of what you ask for, since you might get it.
Catch any
(You posted privately to me again; I hope you don't mind my responding
on-list as this appears to have been merely oversight.)
On Wed, Jun 27, 2012 at 5:25 AM, Charles Hixson
charleshi...@earthlink.net wrote:
Only thing is, this whole mess started when I was trying to trace down and
expected
On 26/06/2012 22:36, Chris Angelico wrote:
(You posted privately to me again; I hope you don't mind my responding
on-list as this appears to have been merely oversight.)
On Wed, Jun 27, 2012 at 5:25 AM, Charles Hixson
charleshi...@earthlink.net wrote:
Only thing is, this whole mess started
On 6/25/2012 12:27 AM, Charles Hixson wrote:
The documentation section covering the except statement could stand to
be a *LOT* clearer. I read the sections on the except statement and
exception handlers several times and couldn't figure out was the as
argument of the except statement was
On Sun, 24 Jun 2012 18:45:45 -0400, Dave Angel wrote:
Bare exceptions are the bane of
programming; Using it is like trying to learn to drive while
blindfolded.
+1 QOTW
I really wish bare exceptions were removed from Python 3. There's no
point to try...except any longer, and it's just an
On Sun, 24 Jun 2012 16:16:25 -0700, Charles Hixson wrote:
But what I wanted was to catch any exception.
Be careful of what you ask for, since you might get it.
Catch any exception is almost certainly the wrong thing to do, almost
always. The one good reason I've seen for a bare except is to
On Mon, 25 Jun 2012 09:51:15 +1000, Chris Angelico wrote:
Mind you, I think every programmer should spend some time debugging
blind.
You're a cruel, cruel man.
I suppose next you're going to say that every programmer should spend
some time programming using Notepad as their only editor.
On Mon, Jun 25, 2012 at 5:49 PM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
On Mon, 25 Jun 2012 09:51:15 +1000, Chris Angelico wrote:
Mind you, I think every programmer should spend some time debugging
blind.
You're a cruel, cruel man.
I suppose next you're going to say
On 06/24/2012 11:23 PM, Andrew Berg wrote:
On 6/25/2012 12:27 AM, Charles Hixson wrote:
The documentation section covering the except statement could stand to
be a *LOT* clearer. I read the sections on the except statement and
exception handlers several times and couldn't figure out was
On Tue, Jun 26, 2012 at 1:14 AM, Charles Hixson
charleshi...@earthlink.net wrote:
I read that that would happen, but print (sys.exc_info()[:2]) didn't
even yield a blank line. It must have executed, because the print statement
on the line before it executed, and there wasn't a loop or a
Sorry, I left out:
er$ python3 --version
Python 3.2.3rc1
On 06/24/2012 03:26 PM, Charles Hixson wrote:
The code:
print(pre-chunkLine)
chunks=[]
try:
chunks=self.chunkLine (l)
except:
On Mon, Jun 25, 2012 at 8:26 AM, Charles Hixson
charleshi...@earthlink.net wrote:
The code:
finally:
print (at finally)
print (chunks =)
produces this result:
path 3...
Can you state more clearly the problem, please? I'm seeing output that
On 24/06/2012 23:26, Charles Hixson wrote:
The code:
print(pre-chunkLine)
chunks=[]
try:
chunks=self.chunkLine (l)
except:
print(caught exception)
On 06/24/2012 06:30 PM, Charles Hixson wrote:
Sorry, I left out:
er$ python3 --version
Python 3.2.3rc1
On 06/24/2012 03:26 PM, Charles Hixson wrote:
The code:
print(pre-chunkLine)
chunks=[]
try:
chunks=
On 24/06/2012 23:36, Chris Angelico wrote:
On Mon, Jun 25, 2012 at 8:26 AM, Charles Hixson
charleshi...@earthlink.net wrote:
The code:
finally:
print (at finally)
print (chunks =)
produces this result:
path 3...
Can you state more clearly the
On 06/24/2012 03:43 PM, MRAB wrote:
On 24/06/2012 23:26, Charles Hixson wrote:
The code:
print(pre-chunkLine)
chunks=[]
try:
chunks=self.chunkLine (l)
except:
On Mon, Jun 25, 2012 at 9:16 AM, Charles Hixson
charleshi...@earthlink.net wrote:
But what I wanted was to catch any exception. A problem was happening and I
had no clue as to what it was. (It turned out to be self is not defined.
A silly mistake, but a real one.)
The odd thing was that if
On 06/24/2012 07:16 PM, Charles Hixson wrote:
On 06/24/2012 03:43 PM, MRAB wrote:
On 24/06/2012 23:26, Charles Hixson wrote:
SNIP
Don't use a bare except; it'll catch _any__exception. Catch only what
you expect.
For all I know, it could be that the name l doesn't exist.
But what I wanted
On 06/24/2012 03:43 PM, Charles Hixson wrote:
On 06/24/2012 03:36 PM, Chris Angelico wrote:
On Mon, Jun 25, 2012 at 8:26 AM, Charles Hixson
charleshi...@earthlink.net wrote:
The code:
finally:
print (at finally)
print (chunks =)
produces
If you are not sure about the Exception, You can adopt a generic way of
handling exception.
try:
except Exception,e:
print str(e)
-Shambhu
-Original Message-
From: MRAB [mailto:pyt...@mrabarnett.plus.com]
Sent: 25/06/2012 4:14 AM
To: python-list@python.org
Subject: Re
Am 23.10.2011 14:41, schrieb Stefan Behnel:
That's just fine. If you are interested in the inner mechanics of the
CPython runtime, reading the source is a very good way to start getting
involved with the project.
However, many extension module authors don't care about these inner
mechanics and
Ulrich Eckhardt, 25.10.2011 08:49:
Am 23.10.2011 14:41, schrieb Stefan Behnel:
That's just fine. If you are interested in the inner mechanics of the
CPython runtime, reading the source is a very good way to start getting
involved with the project.
However, many extension module authors don't
Lee, 23.10.2011 06:09:
Where does PyExc_TypeError (and alike) points to? I can see its
declaration - PyAPI_DATA(PyObject *) PyExc_TypeError; - in pyerrors.h
but I cannot figure out what it is its value, where it is
initialized.
It gets initialised inside of the interpreter core and then points
Thanks Stefan,
I am just interested to understand the mechanism inside python.
If it points to an object that means I can defered it (through
ob_type).
From there, how a function like PyErr_SetString knows what exception
is?
Where its value is kept?
Lee
On Oct 23, 10:06 pm, Stefan Behnel
Am 23.10.2011 06:09, schrieb Lee:
Hi all,
Where does PyExc_TypeError (and alike) points to? I can see its
declaration - PyAPI_DATA(PyObject *) PyExc_TypeError; - in pyerrors.h
but I cannot figure out what it is its value, where it is
initialized.
It's initialized in Objects/exceptions.c
Hi,
note that I reformatted your posting to get the replies back into order.
Lee, 23.10.2011 13:32:
On Oct 23, 10:06 pm, Stefan Behnel wrote:
Lee, 23.10.2011 06:09:
Where does PyExc_TypeError (and alike) points to? I can see its
declaration - PyAPI_DATA(PyObject *) PyExc_TypeError; - in
For a moment, back to the basics...
I am using the example provided by docs at 2.1.2
Providing finer control Using say:
mynoddy = noddy2.Noddy()
mynoddy.first = a
mynoddy.last = 0
the last line causes an ugly crash (on python 2.6.5 on winxp).
No way to catch the exception.
As I understand
Paul Rubin no.em...@nospam.invalid writes:
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes:
Apart from this horrible idiom:
def func(iterable):
it = iter(iterable)
failed = False
try:
x = next(it)
except StopIteration:
failed = True
if
Arnaud,
Wouldn't your first suggestion exit after the first element in iterable?
And would your second suggestion throw an exception after normal
processing of all elements in the interator?
RobR
-Original Message-
I missed the start of this discussion but there are two simpler ways:
Please don't top-post.
Rob Richardson wrote:
-Original Message-
I missed the start of this discussion but there are two simpler ways:
def func(iterable):
for x in iterable:
print(x)
return
raise ValueError(... empty iterable)
Or using 3.x's next's optional
Rob Richardson rob.richard...@rad-con.com writes:
You shouldn't top-post!
Arnaud,
Wouldn't your first suggestion exit after the first element in iterable?
Yes, after printing that element, which is what the code I quoted did.
And would your second suggestion throw an exception after normal
Arnaud Delobelle wrote:
I missed the start of this discussion but there are two simpler ways:
def func(iterable):
for x in iterable:
print(x)
return
raise ValueError(... empty iterable)
For the immediate case this is a cool solution.
Unfortunately, it doesn't fix
1 - 100 of 434 matches
Mail list logo