A snake expert said it was possible that the python was spooked and simply clung to whatever it landed on.
Autopsies on the brothers, ages 5 and 7, were being performed Tuesday. They had been visiting the apartment of a friend above an exotic pet store in Campbellton, New Brunswick, said Royal Canadian Mounted Police Const. Julie Rogers-Marsh.
Rogers-Marsh said the snake apparently escaped during the night and made its way into the apartment through the ventilation system. A friend of the boys was sleeping in another room and was unharmed, she said.
The pet store owner, Jean-Claude Savoie, told the Global News television station that he didn't hear a sound and discovered the "horrific scene" when he went into his living room, where the two boys had been sleeping, on Monday morning.
"I can't believe this is real," Savoie said.
The boys were the children of his best friend and were often at his apartment to visit his son, Savoie said. The python, which he has had for at least 10 years, had been kept alone in its enclosure and was not handled by anyone else, he added.
The snake is about 4.3 meters (4.7 yards) long, RCMP Sgt. Alain Tremblay said. He said police were looking at whether the store followed the province's regulations on exotic animals.
"It's a criminal investigation," Tremblay said. "We're going to look at all avenues."
The town's deputy mayor, Ian Comeau, said the Reptile Ocean shop was licensed to operate and "everything was according to our bylaws, to the provincial guidelines." He said he saw alligators, crocodiles and snakes when he toured the shop with the fire department about two years ago.
Snake expert John Kendrick, a manager at the Reptile Store in Hamilton, Ontario, said it sounds like the python was not enclosed properly and might have been spooked. He called the strangling deaths "very unusual" but said African rock pythons tend to be a little more high-strung.
"It's very odd that one would go out and seek out a person. They don't recognize us as food," he said.
Pythons can sense heat, and if they are startled they can grab something, Kendrick said. He said snakes are very long and their muscles run lengthwise through their body, so they are not very stable unless they are holding on to something.
"A snake that size was just trying to hold on securely enough to make sure he felt like he wasn't falling or going anywhere; he has enough muscle power to cut off circulation," he said.
It's possible that the python was just holding on to what it landed on Kendrick said.
"Once they are in constricting mode, any part of their body that is touching something that moves, they'll wrap it. I've seen snakes with two different prey items at the same time, one with the back of the body and one with the front. It could have been an incident like that."
Associated Press writer Rob Gillies in Toronto contributed to this report.
Copyright 2013 The Associated Press.