Re: Possible bug with TypeError in Python

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30Jan2008 07:40, Aaron Konstam <akonstam@xxxxxxxxxxxxx> wrote:
| The following seems like an bug in python in both f7 and f8 but I would
| like input before I post a bugzilla. It seems the exception handler
| cannot trap the TypeError in python.
| For example:
| def plus(a,b):
| 	try:
| 		return(a+b)
| 	except TypeError:
| 		return None
| 
| If we define plus as above and call it with: plus(3,) we should get
| nothing returned. Instead we get:
| Traceback (most recent call last):
|   File "./calculator", line 47, in <module>
|     exec("register=op[tokens[0]](register)")
|   File "<string>", line 1, in <module>
| TypeError: plus() takes exactly 2 arguments (1 given)
| 
| This seems like a bug. An ideas out there?

The 'b' argument to plus() is not optional. This isn't Perl.  plus()
is not being called, and your try/except is not being reached.

Not a bug.
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Just because Unix is a multiuser system doesn't mean I want to share it with
anybody!        - Paul Tomblin, in rec.aviation.military

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux