473,771 Members | 2,347 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Origin of the term "first-class object"

Hi,

Does anybody know where this term comes from?

"First-class object" means "something passable as an argument in a
function call", but I fail to see the connection with "object class"
or with "first-class airplane ticket". I just find the name a bit
strange. Also, if there are first-class objects, what would the
second-class objects or economy/tourist class objects be? :)

Just wondering,

Hung Jung
Jul 18 '05
24 6750
In article <m8uub.235682$H S4.2034763@attb i_s01>,
Rainer Deyke <ra*****@eldwoo d.com> wrote:
Aahz wrote:
Rainer:

l[x * 2 + f(y)] = f(l[x * 2 + f(y)])

This statement contains an obvious redundancy that will make code
maintenance difficult. Python allows me to factor out some of the
redundancy:

index = x * 2 + f(y)
l[index] = f(l[index])

However, Python gives me no way to factor out the remaining
redundancy.
Sure it does: change the immutable to a mutable.


Not good enough.


Why not? Note that you're playing what is IMO an unfair game where you
keep changing the goalposts.
I'd rather write "l[x] = f(l[x])" with all of its redundancy than wrap
every conceivable immutable object in a mutable wrapper. Besides, I
don't *want* 'f' to change an object (which may also be referenced
elsewhere); I want it to change a binding.
Well, you're going to have to pay for what you want in some fashion;
Python's going to keep its default semantics, so you're going to need
*some* kind of wrapper.
And, really, "l[x] = f(l[x])" isn't that big of a deal. It's a bit of
redundancy that I'd rather not have, but it's not bad enough that I
feel the need to do anything about it.


<shrug> It's not a redundancy unless you're using a particular skewed
way of looking at things. If you're going to skew, you might as well
keep skewing until you're using a Pythonic mechanism.
--
Aahz (aa**@pythoncra ft.com) <*> http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote
programs, then the first woodpecker that came along would destroy civilization.
Jul 18 '05 #21
On Mon, Nov 24, 2003 at 12:33:40PM -0500, Aahz wrote:
In article <m8uub.235682$H S4.2034763@attb i_s01>,
Rainer Deyke <ra*****@eldwoo d.com> wrote:
Aahz wrote:
Rainer:

l[x * 2 + f(y)] = f(l[x * 2 + f(y)])

This statement contains an obvious redundancy that will make code
maintenance difficult. Python allows me to factor out some of the
redundancy:

index = x * 2 + f(y)
l[index] = f(l[index])

However, Python gives me no way to factor out the remaining
redundancy.

Sure it does: change the immutable to a mutable.


Not good enough.


Why not? Note that you're playing what is IMO an unfair game where you
keep changing the goalposts.
I'd rather write "l[x] = f(l[x])" with all of its redundancy than wrap
every conceivable immutable object in a mutable wrapper. Besides, I
don't *want* 'f' to change an object (which may also be referenced
elsewhere); I want it to change a binding.


Well, you're going to have to pay for what you want in some fashion;
Python's going to keep its default semantics, so you're going to need
*some* kind of wrapper.


Up for a new operator?

l[index] ()= f

<1.5-wink>, Jp

Jul 18 '05 #22
In article <ma************ *************** **********@pyth on.org>,
Jp Calderone <ex*****@intarw eb.us> wrote:
On Mon, Nov 24, 2003 at 12:33:40PM -0500, Aahz wrote:
In article <m8uub.235682$H S4.2034763@attb i_s01>,
Rainer Deyke <ra*****@eldwoo d.com> wrote:

I'd rather write "l[x] = f(l[x])" with all of its redundancy than wrap
every conceivable immutable object in a mutable wrapper. Besides, I
don't *want* 'f' to change an object (which may also be referenced
elsewhere) ; I want it to change a binding.


Well, you're going to have to pay for what you want in some fashion;
Python's going to keep its default semantics, so you're going to need
*some* kind of wrapper.


Up for a new operator?

l[index] ()= f


"Boot to the head. <thump>"
--
Aahz (aa**@pythoncra ft.com) <*> http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote
programs, then the first woodpecker that came along would destroy civilization.
Jul 18 '05 #23
Jp Calderone wrote:
Up for a new operator?

l[index] ()= f


I like it! :-)

I suppose you should be able to put extra args in, too, e.g.

l[index] (foo, 42)= f

--
Greg Ewing, Computer Science Dept,
University of Canterbury,
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg

Jul 18 '05 #24
On Tue, 25 Nov 2003 15:07:22 +1300, "Greg Ewing (using news.cis.dfn.de )" <g2********@sne akemail.com> wrote:
Jp Calderone wrote:
Up for a new operator?

l[index] ()= f
I like it! :-)

Me too ;-)
But I wonder if =()= wouldn't read more clearly, e.g.,

l[index] =()= f

and see below.
I suppose you should be able to put extra args in, too, e.g.

l[index] (foo, 42)= f

I presume that would imply that f had all optional args after the first.
What if you wanted to pass the update target in another position? E.g.,

l[index] =(foo, ??, 42)= f

where ?? is some kind of indicator for where to plug in the arg. I guess you
could use packing/unpacking if you had a tuple left side and several ??'s to match, e.g.,

a, l[index] =(foo, ??, 42, ??)= f

meaning

a, l[index] = f(foo, a, 42, l[index])

or course the targets could be simple as well

a, b =(foo, ??, ??, 42)= f

meaning

a, b = f(foo, a, b, 42)

Hm, I wonder about * for pack/unpack into arg tuple in this context

a, b =(foo, *??, 42)= f

maybe meaning

a, b = f(foo, (a,b), 42)

or did I get that backwards?

Sorry, can't help it ;-)

Regards,
Bengt Richter
Jul 18 '05 #25

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
2849
by: | last post by:
Could some help m figure out to strip an unknown range of characters in a path between the first "/" and "/" found in a folder path somewhere on my site. eg: /catamaranco/sales/boat/1.asp eg: /esserman/newseltter/2004/03/ eg: /yachtservices/excel/reports/ I wish to return only:
0
1226
by: b.orsini | last post by:
Is it possible to know if a row is the first row in a table after a page break ? After a page break, the header is put in the page ( it's ok ) but in some case i must display the first row differently :( please help ! thank you.
32
4154
by: James Curran | last post by:
I'd like to make the following proposal for a new feature for the C# language. I have no connection with the C# team at Microsoft. I'm posting it here to gather input to refine it, in an "open Source" manner, and in an attempt to build a ground-swell of support to convince the folks at Microsoft to add it. Proposal: "first:" "last:" sections in a "foreach" block The problem: The foreach statement allows iterating over all the...
5
3200
by: comp.lang.php | last post by:
$orderBy = 's.app_date desc, s.last_name asc, s.first_name asc, s.mi asc'; if ($_REQUEST) { $ascArray = array('asc' => 'desc', 'desc' => 'asc'); // ARRAY OF ALL ORDERING POSSIBILITIES $junk = preg_match('/(+)a|sc(,?.*$)/i', $orderBy, $matchArray); $orderBy = substr($orderBy, 0, strpos($orderBy, $matchArray)) . ' ' . $ascArray] . substr($orderBy, strpos($orderBy, $matchArray) +
3
5039
blazedaces
by: blazedaces | last post by:
I was working all day yesterday (and will probably be for most of today) with bytecode where java wrote the bytecode and matlab read it... I had never worked with bytecode in great detail before so this was quite a challenge. I mean, all in all, the experience was interesting and because it was harder then it should have been, more educational. Still, I've been told almost every other program reads "low byte first" and thinking about it,...
3
2817
by: amanjsingh | last post by:
I want to know what is the origin of Hello World program and who wrote it, what language it was written in and why was Hello World chosen as a phrase? Thanks a lot AJ
1
3009
by: SoNew | last post by:
I have a Database form in Single View for users to look-up and/or enter data. When the form loads the combo box is empty, which I like - but the fields in the form are all filled in with what the database sees as the "first" record - which is alphabetically not the first, but is as to the ID field. All that said, I would like the fields to either fill in with the alphabetical first record, or merely blank. I found the code to have it load New -...
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9910
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.