So, being a little pedantic, the answer to your question is "no". I say that because you asked "generally speaking...". I answer "no" because there is no general cultural rule to draw from to answer your question. Some companies are perfectly fine with this, others are not. This is much like saying, "what's the dress code?" or "what's the software language a company uses" without knowing what company you're talking about.
I have seen many companies that are OK with napping, many others which are not. Some even set up nap rooms to encourage the behavior, others do not. Some allow it by policy, but then the peer culture is such that you're not tolerated by your coworkers if you take advantage of that corporate leniency.
Sometimes it's really counter to what you might expect from other cultural norms. I've seen companies that have a strict dress code and hours of business that are more lax on sleeping at your desk than others which let folks come and go as they please and wear whatever they want.
EDIT
I want to add a little more because my comment in another answer was edging out of comment territory and into answer territory.
I will argue that it's actually not just company specific, but also can depend on your role in the company (hourly, salaried, billable salaried, etc) and the kind of company it is (I know you said 'software', but there's a difference in approaches for, e.g. a game dev company, a small mobile startup, a corporate internal dev team for a non-software company, etc).
If you're being paid by the hour, or if your time is billable, then no you cannot nap while "on the clock". That said, I'm currently in a company where the developers are all salaried, but we log time worked against each project we're working on, and so if I decide to nap (or go for a workout or whatever) during the day, I'm simply not going to mark that time against a project.
Similarly, if you're pure salary, in my experience it's a rare salaried employee who only works 40 hours a week, unless your time is billable (see above) you generally don't clock in and out. In many cases you have the flexibility to work weird hours or from home, etc, and so there's even less of an issue for taking breaks during the day, etc, because you're being paid for delivering someting on time and to standard, how you get there is up to you.
As for the "kind" of company, it's related to the above, but also I find that the closer you are to green field or pure "design" work, the more understanding there is for the need to take breaks, let the creative juices recharge, talk about stuff over coffee to let your subconscious have a shot etc. If you're in pure bugfix mode, the perception (not necessarily the reality) is often that you're more likely able to just grind through it and get it done.